Back to Onnx

NBVAL_SKIP

examples/check_model.ipynb

1.21.0493 B
Original Source
python
# NBVAL_SKIP
# Protobuf 4 and Protobuf 3 might output different order of protobuf fields

import onnx
import os


# Preprocessing: load the ONNX model
model_path = os.path.join("resources", "single_relu.onnx")
onnx_model = onnx.load(model_path)

print("The model is:\n{}".format(onnx_model))

# Check the model
try:
    onnx.checker.check_model(onnx_model)
except onnx.checker.ValidationError as e:
    print("The model is invalid: %s" % e)
else:
    print("The model is valid!")