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 2022/02/13 08:48:40 UTC

[GitHub] [tvm] Hzfengsy commented on a change in pull request #10233: [PyTorch] add var_mean support

Hzfengsy commented on a change in pull request #10233:
URL: https://github.com/apache/tvm/pull/10233#discussion_r805301483



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -1597,6 +1597,21 @@ def func(x):
 
         return func(data)
 
+    def var_mean(self, inputs, input_types):
+        data = inputs[0]
+        if len(inputs) == 2:
+            axis = None
+            keepdims = False
+            unbiased = bool(inputs[1])
+        else:
+            axis = inputs[1]
+            keepdims = bool(inputs[3])
+            unbiased = bool(inputs[2])
+
+        return _op.reduce.variance(data, axis=axis, keepdims=keepdims, unbiased=unbiased), _op.mean(
+            data, axis, keepdims
+        )

Review comment:
       Thanks for your advice. Finally, I found an existing API `mean_variance`, and enhance it a bit.
   https://github.com/apache/tvm/blob/6df070aac6d0e26d1e127095a323c61c2287eb9d/python/tvm/relay/op/reduce.py#L395




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