MCPcopy
hub / github.com/onnx/onnx / export_e4m3fn

Method export_e4m3fn

onnx/backend/test/case/node/quantizelinear.py:68–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66
67 @staticmethod
68 def export_e4m3fn() -> None:
69 node = onnx.helper.make_node(
70 "QuantizeLinear",
71 inputs=["x", "y_scale", "y_zero_point"],
72 outputs=["y"],
73 )
74
75 x = np.array([0.0, 1.0, 2.0, 100000.0, 200.0]).astype(np.float32)
76 y_scale = np.float32(2)
77 y_zero_point = make_tensor("y_zero_point", TensorProto.FLOAT8E4M3FN, [1], [0])
78 y = make_tensor("y", TensorProto.FLOAT8E4M3FN, [5], [0, 0.5, 1, 448, 96])
79
80 expect(
81 node,
82 inputs=[x, y_scale, y_zero_point],
83 outputs=[y],
84 name="test_quantizelinear_e4m3fn",
85 )
86
87 @staticmethod
88 def export_e5m2() -> None:

Callers

nothing calls this directly

Calls 3

make_tensorFunction · 0.90
expectFunction · 0.90
make_nodeMethod · 0.80

Tested by

no test coverage detected