()
| 214 | |
| 215 | @staticmethod |
| 216 | def export_uint4() -> None: |
| 217 | node = onnx.helper.make_node( |
| 218 | "QuantizeLinear", |
| 219 | inputs=["x", "y_scale", "y_zero_point"], |
| 220 | outputs=["y"], |
| 221 | axis=0, |
| 222 | ) |
| 223 | |
| 224 | x = np.array( |
| 225 | [ |
| 226 | [0.0, 2.5, 4.8, 8.6], |
| 227 | [-30, -20, 6, 9], |
| 228 | [12, 15, 16, 40], |
| 229 | ] |
| 230 | ).astype(np.float32) |
| 231 | |
| 232 | y_scale = np.asarray([2.0, 3.0, 4.0], dtype=np.float32) |
| 233 | y_zero_point = make_tensor( |
| 234 | "y_zero_point", TensorProto.UINT4, y_scale.shape, np.ones_like(y_scale) |
| 235 | ) |
| 236 | y = make_tensor( |
| 237 | "y", TensorProto.UINT4, x.shape, [1, 2, 3, 5, 0, 0, 3, 4, 4, 5, 5, 11] |
| 238 | ) |
| 239 | |
| 240 | expect( |
| 241 | node, |
| 242 | inputs=[x, y_scale, y_zero_point], |
| 243 | outputs=[y], |
| 244 | name="test_quantizelinear_uint4", |
| 245 | ) |
| 246 | |
| 247 | @staticmethod |
| 248 | def export_int4() -> None: |
nothing calls this directly
no test coverage detected