mirror of
https://github.com/luxfi/onnx-source-snapshot.git
synced 2026-10-30 15:23:38 +00:00
3.0 KiB
3.0 KiB
In [1]:
# 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!")The model is:
ir_version: 3
producer_name: "backend-test"
graph {
node {
input: "x"
output: "y"
name: "test"
op_type: "Relu"
}
name: "SingleRelu"
input {
name: "x"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
output {
name: "y"
type {
tensor_type {
elem_type: 1
shape {
dim {
dim_value: 1
}
dim {
dim_value: 2
}
}
}
}
}
}
opset_import {
version: 6
}
The model is valid!
In [ ]: