DAPP马蹄链智能合约系统开发(案例)丨DAPP马蹄链开发(源码)

84 阅读1分钟

  Smart contracts have the following characteristics:First,they are normative.Smart contracts are based on computer code and can minimize language ambiguity,presented through a rigorous logical structure.The content and execution process of smart contracts are transparent and visible to all nodes,which can observe,record,and verify contract status through the user interface.Secondly,irreversibility.Once the conditions are met,the contract automatically executes the expected plan.Under a given factual input,the smart contract inevitably outputs the correct results and is visualized in the display horizon.

  def fuse_bias_add(self):

  开发功能I35设计7O98详细O7I8

  Fuse Pattern like Conv+Add,ConvTranspose+Add,Gemm+Add

  This fusion will require a constant input as bias.

  """

  graph=self.graph

  for op in[_ for _ in graph.operations.values()]:

  if op.type in{'Conv','ConvTranspose','Gemm'}:关于区块链项目技术开发唯:MrsFu123,代币发行、dapp智能合约开发、链游开发、多链钱包开发

  交易所开发、量化合约开发、互助游戏开发、Nft数字藏品开发、众筹互助开发、元宇宙开发、swap开发、

  链上合约开发、ido开发、商城开发等,开发过各种各样的系统模式,更有多种模式、制度、案例、后台等,成熟技术团队,欢迎实体参考。

  #check if current op has only 1 downstream op

  channel_dimension=1#NCHW,NCHWD,NCH

  if op.type=='Gemm':channel_dimension

  if len(graph.get_downstream_operations(op))==1:

  down=graph.get_downstream_operations(op)[0]

  if down.type=='Add':

  if down.num_of_parameter!=1:continue

  bias=down.parameters[0]

  if op.type not in{'Gemm'}:

  #check if it is a bias add

  if not bias.value.dim()==op.parameters[0].value.dim():continue

  if not bias.value.squeeze().dim()==1:continue

  if bias.value.shape[channel_dimension]==1:continue

  bias.value=bias.value.squeeze()#conv bias can only be 1d

  else:

  #Gemm bias can be any shape.

  #see github.com/onnx/onnx/b…

  pass

  #ready for fusion

  if op.num_of_input==3:#already has a bias

  pass

  else:

  graph.create_variable(is_parameter=True,value=bias.value,dest_ops=[op])

  graph.remove_operation(removing_op=down,keep_coherence=True**)**