1 Star 0 Fork 0

婷婷的小双子/pytorch-classification

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
onnx_validate.py 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
dusty-nv 提交于 2019-07-03 00:09 . updated ONNX
#
# Check that an ONNX model is valid and well-formed.
#
# Before running this script, install the following:
#
# $ sudo apt-get install protobuf-compiler libprotoc-dev
# $ pip install onnx
#
import onnx
import argparse
import sys
parser = argparse.ArgumentParser()
parser.add_argument('model', type=str, default='resnet18.onnx', help='path to ONNX model to validate')
args = parser.parse_args(sys.argv[1:])
# Load the ONNX model
model = onnx.load(args.model)
# Print a human readable representation of the graph
print('Network Graph:')
print(onnx.helper.printable_graph(model.graph))
print('')
# Print model metadata
print('ONNX version: ' + onnx.__version__)
print('IR version: {:d}'.format(model.ir_version))
print('Producer name: ' + model.producer_name)
print('Producer version: ' + model.producer_version)
print('Model version: {:d}'.format(model.model_version))
print('')
# Check that the IR is well formed
print('Checking model IR...')
onnx.checker.check_model(model)
print('The model was checked successfully!')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lift-zpz/pytorch-classification.git
git@gitee.com:lift-zpz/pytorch-classification.git
lift-zpz
pytorch-classification
pytorch-classification
master

搜索帮助