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/01/10 21:23:15 UTC

[GitHub] [tvm] masahi commented on a change in pull request #9894: Add aten::mv support

masahi commented on a change in pull request #9894:
URL: https://github.com/apache/tvm/pull/9894#discussion_r781558092



##########
File path: python/tvm/relay/frontend/pytorch.py
##########
@@ -2852,6 +2852,28 @@ def einsum(self, inputs, input_types):
         equation, data = inputs
         return _op.einsum(data, equation)
 
+    def dot(self, inputs, _):
+        lhs, rhs = inputs
+        return _op.sum(_op.multiply(lhs, rhs))
+
+    def mv(self, inputs, _):
+        lhs, rhs = inputs
+
+        # Convert the 1D matrix (vector) into a 2D matrix with the extra
+        # dimension=1
+        vector_size = self.infer_shape(rhs)[0]
+        rhs_matrix = _op.transform.reshape(rhs, (vector_size, 1))
+
+        # Transpose for use in nn.dense
+        rhs_t = _op.transform.transpose(rhs_matrix, None)
+

Review comment:
       I think you can use `expand_dims(rhs, 0)` to replace `reshape` and `transpose`




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