cconvey commented on a change in pull request #9186:
URL: https://github.com/apache/tvm/pull/9186#discussion_r721337230



##########
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

Review comment:
       I'm not sure this particular comment is necessary, because the code it 
describes is already very readable.




-- 
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]


Reply via email to