abhikran-quic commented on a change in pull request #9186:
URL: https://github.com/apache/tvm/pull/9186#discussion_r721402272
##########
File path: python/tvm/relay/frontend/onnx.py
##########
@@ -873,6 +873,89 @@ def flatten_to_nd(x, x_shape, nd=3):
return _op.nn.dense(inputs[0], input_1_t)
+class MatMulInteger16(OnnxOpConverter):
+ """Operator converter for MatMulInteger16 from Microsoft onnxruntime
contrib opset."""
+
+ @classmethod
+ def _impl_v10(cls, inputs, attr, params):
+ assert len(inputs) == 2, "MatMul op take 2 inputs, {}
given".format(len(inputs))
+ a_shape = shape_of(inputs[0])
+ a_rank = infer_shape(a_shape)[0]
+ b_shape = shape_of(inputs[1])
+ b_rank = infer_shape(b_shape)[0]
+ a_dtype = infer_type(inputs[0]).checked_type.dtype
+ b_dtype = infer_type(inputs[1]).checked_type.dtype
+ # Check input data types
+ assert a_dtype in ("int16", "uint16"), "MatMulInteger16: invalid dtype
for first input"
+ assert b_dtype in ("int16", "uint16"), "MatMulInteger16: invalid dtype
for second input"
+ out_dtype = "int32"
+ # Set output data type as uint32 when both inputs are uint16
+ if a_dtype == "uint16" and b_dtype == "uint16":
+ out_dtype = "uint32"
+ if a_rank > 2 or b_rank > 2:
+
+ def flatten_to_nd(x, x_shape, nd=3):
Review comment:
Yes. Agree with you. I will fix it in the next commit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]