佛萨奇2.0Polygon马蹄链Matic开发原理丨佛萨奇2.0Polygon马蹄链Matic系统开发(运营版)及案例详细 您所在的位置:网站首页 马蹄链浏览器 佛萨奇2.0Polygon马蹄链Matic开发原理丨佛萨奇2.0Polygon马蹄链Matic系统开发(运营版)及案例详细

佛萨奇2.0Polygon马蹄链Matic开发原理丨佛萨奇2.0Polygon马蹄链Matic系统开发(运营版)及案例详细

2024-07-16 03:39| 来源: 网络整理| 查看: 265

  DAO代表去中心化自治组织(Decentralized Autonomous Organization),是一种在Web3中基于区块链技术的组织形式。DAO是一个智能合约的集合,旨在实现一组规则和程序来自动执行管理和决策的任务,而无需中心化的管理机构。

  import torch.onnx

  #转为ONNX

  def Convert_ONNX(model):

  

  #设置模型为推理模式

  model.eval()

  #设置模型输入的尺寸

  dummy_input=torch.randn(1,input_size,requires_grad=True)

  #导出ONNX模型

  torch.onnx.export(model,#model being run

  dummy_input,#model input(or a tuple for multiple inputs)

  "xxx.onnx",#where to save the model

  export_params=True,#store the trained parameter weights inside the model file

  opset_version=10,#the ONNX version to export the model to

  do_constant_folding=True,#whether to execute constant folding for optimization

  input_names=['modelInput'],#the model's input names

  output_names=['modelOutput'],#the model's output names

  dynamic_axes={'modelInput':{0:'batch_size'},#variable length axes

  'modelOutput':{0:'batch_size'}})

  print("")

  print('Model has been converted to ONNX')

  if __name__=="__main__":

  #构建模型并训练

  #xxxxxxxxxxxx

  #测试模型精度

  #testAccuracy()

  #加载模型结构与权重

  model=Network()

  path="myFirstModel.pth"

  model.load_state_dict(torch.load(path))

  #转换为ONNX

  Convert_ONNX(model)



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有