You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2023/01/11 01:45:12 UTC

[GitHub] [tvm] chengven027-intellif commented on a diff in pull request #13747: [ONNX] QGemm support

chengven027-intellif commented on code in PR #13747:
URL: https://github.com/apache/tvm/pull/13747#discussion_r1066500519


##########
python/tvm/relay/frontend/onnx.py:
##########
@@ -4898,6 +4898,90 @@ def _impl_v10(cls, inputs, attr, params):
         return out
 
 
+class QGemm(OnnxOpConverter):
+    """Operator converter for QGemm."""
+
+    @classmethod
+    def _impl_v1(cls, inputs, attr, params):
+        # http://www.xavierdupre.fr/app/mlprodict/helpsphinx/onnxops/onnx_commicrosoft_QGemm.html
+
+        a = inputs[0]
+        a_scale = get_scalar(inputs[1], params)
+        a_zp = get_scalar(inputs[2], params, "int32")
+
+        b = inputs[3]
+        #  a scalar or 1D tensor of size 1 or N
+        b_scale = get_scalar_or_1d_tensor(inputs[4], params)
+        #  a scalar or 1D tensor of size 1 or N
+        b_zp = get_scalar_or_1d_tensor(inputs[5], params, "int32")
+
+        # note that if optional and not provided then value will be None.
+        C = inputs[6] if len(inputs) > 6 else None
+        # must be null or a scalar or 1D tensor of size 1
+        y_scale = inputs[7] if len(inputs) > 7 else None

Review Comment:
   Done.  



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org