MCPcopy
hub / github.com/onnx/onnx / export_uint2

Method export_uint2

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

Source from the content-addressed store, hash-verified

278
279 @staticmethod
280 def export_uint2() -> None:
281 node = onnx.helper.make_node(
282 "QuantizeLinear",
283 inputs=["x", "y_scale", "y_zero_point"],
284 outputs=["y"],
285 axis=0,
286 )
287
288 x = np.array(
289 [
290 [0.0, 2.5, 4.8, 8.6],
291 [-2.0, -1.0, 1.0, 3.0],
292 [4.0, 5.0, 6.0, 7.0],
293 ],
294 dtype=np.float32,
295 )
296 y_scale = np.asarray([2.0, 3.0, 4.0], dtype=np.float32)
297 y_zero_point = make_tensor(
298 "y_zero_point", TensorProto.UINT2, y_scale.shape, np.zeros_like(y_scale)
299 )
300 y = make_tensor(
301 "y", TensorProto.UINT2, x.shape, [0, 1, 2, 3, 0, 0, 0, 1, 1, 1, 2, 2]
302 )
303 expect(
304 node,
305 inputs=[x, y_scale, y_zero_point],
306 outputs=[y],
307 name="test_quantizelinear_uint2",
308 )
309
310 @staticmethod
311 def export_int2() -> 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