Skip to content

Instantly share code, notes, and snippets.

@aurotripathy
Created March 10, 2026 04:09
Show Gist options
  • Select an option

  • Save aurotripathy/b81a737add9a1879036cfc633f443ca2 to your computer and use it in GitHub Desktop.

Select an option

Save aurotripathy/b81a737add9a1879036cfc633f443ca2 to your computer and use it in GitHub Desktop.
import onnx
import onnx_tool
# Load the ONNX model from a file
# model_path = "resnet34_1_3_416_640.onnx"
# model_path = "pointpillar_custom.onnx"
model_path = "detr_1_3_512_512.onnx"
print(f"Model: {model_path}")
# Use onnx.load to get the model proto object
onnx_model = onnx.load(model_path)
ops = {node.op_type for node in onnx_model.graph.node}
print(f"Unique operators: {ops}")
# Get a high-level breakdown of operators statistics
print("\n--- Operator Statistics ---")
# A simple way to get operator counts and basic stats
op_counts = {}
for node in onnx_model.graph.node:
op_type = node.op_type
if op_type in op_counts:
op_counts[op_type] += 1
else:
op_counts[op_type] = 1
print("Operator counts:")
for op_type, count in op_counts.items():
print(f"* {op_type}: {count}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment