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 2021/09/16 22:57:44 UTC

[GitHub] [tvm] mbrookhart commented on a change in pull request #9017: [ONNX] QLinearAveragePool and QLinearGlobalAveragePool contrib op

mbrookhart commented on a change in pull request #9017:
URL: https://github.com/apache/tvm/pull/9017#discussion_r710553130



##########
File path: python/tvm/relay/frontend/onnx.py
##########
@@ -654,6 +676,40 @@ def _impl_v1(cls, inputs, attr, params):
         )
 
 
+class QLinearGlobalAveragePool(OnnxOpConverter):
+    "Operator converter for QLinearGlobalAveragePool from Microsoft onnxruntime contrib opset."
+
+    @classmethod
+    def _impl_v1(cls, inputs, attr, params):
+        rank = len(infer_shape(inputs[0]))
+
+        x_scale = get_scalar(inputs[1], params)
+        x_zero_point = get_scalar(inputs[2], params, dtype="int32")
+        y_scale = fold_constant(get_scalar(inputs[3], params))
+        y_zero_point = get_scalar(inputs[4], params, dtype="int32")
+
+        input_dtype = infer_type(inputs[0]).checked_type.dtype
+
+        # Onnxruntime documentation does not mention that this global avg_pool should follow the

Review comment:
       I have AvgPool in FakeQuantizationToInteger already, we can use that to convert to integer if needed. I haven't done GlobalAvgPool yet.




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