test6.py 356 Bytes
Newer Older
zk's avatar
zk committed
1
2
3
4
5
6
7
8
9
10
11
import onnx
from onnx import numpy_helper

model = onnx.load("weights/ground.onnx")

for init in model.graph.initializer:
    if "Constant" in init.name:
        arr = numpy_helper.to_array(init)
        if arr.dtype in [np.int32, np.int64]:
            if (arr < 0).any() or (arr > 10000).any():
                print("🚨 可疑 index:", init.name, arr)