如何获取onnx神经网络输出层的维度?
我可以得到 onnx 图,但没有输出维度:
~/onnx-tensorrt/third_party/onnx/onnx/tools/net_drawer.py --input ./weights/tiny_3l_v5_11_608.onnx --output ./weights/tiny_3l_v5_11_608.dot --embed_docstring
马库斯·特尔维辛
你可以简单地使用
from onnx import shape_inference
inferred_model = shape_inference.infer_shapes(original_model)
并找到形状信息inferred_model.graph.value_info
.
有关完整文档,请参阅https://github.com/onnx/onnx/blob/master/docs/ShapeInference.md https://github.com/onnx/onnx/blob/master/docs/ShapeInference.md
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)