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 19:56:41 UTC

[GitHub] [tvm] driazati opened a new pull request #9893: Add support for aten::dot

driazati opened a new pull request #9893:
URL: https://github.com/apache/tvm/pull/9893


   This implements dot product as a composite of of multiply + sum
   
   Thanks for contributing to TVM!   Please refer to guideline https://tvm.apache.org/docs/contribute/ for useful information and tips. After the pull request is submitted, please request code reviews from [Reviewers](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @ them in the pull request thread.
   


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



[GitHub] [tvm] masahi commented on a change in pull request #9893: Add support for aten::dot

Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #9893:
URL: https://github.com/apache/tvm/pull/9893#discussion_r781510485



##########
File path: tests/python/frontend/pytorch/test_forward.py
##########
@@ -4086,6 +4086,14 @@ def test_fn(equation):
     verify_model(test_fn("ij,jk"), [x, y])
     verify_model(test_fn("ij,jk,km->im"), [x, y, z])
 
+@tvm.testing.uses_gpu
+def test_dot():
+    def test_fn(x):
+        return x.dot(x)
+
+    x = torch.ones([2])

Review comment:
       please test on more realistic input.




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



[GitHub] [tvm] masahi merged pull request #9893: Add support for aten::dot

Posted by GitBox <gi...@apache.org>.
masahi merged pull request #9893:
URL: https://github.com/apache/tvm/pull/9893


   


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



[GitHub] [tvm] masahi commented on a change in pull request #9893: Add support for aten::dot

Posted by GitBox <gi...@apache.org>.
masahi commented on a change in pull request #9893:
URL: https://github.com/apache/tvm/pull/9893#discussion_r781511298



##########
File path: python/tvm/relay/op/tensor.py
##########
@@ -1136,6 +1136,25 @@ def einsum(data, equation):
     return _make.einsum(Tuple(data), equation)
 
 
+def dot(lhs, rhs):
+    """Compute the dot product of two 1D tensors
+
+    Parameters
+    ----------
+    lhs : relay.Expr input tensor
+    rhs : relay.Expr input tensor
+
+    Returns
+    -------
+    result : relay.Expr
+        The output tensor from the dot op.
+    """
+    mul_result = _make.multiply(lhs, rhs)
+    axis = None
+    keepdims = False
+    exclude = False
+    return _make.sum(mul_result, axis, keepdims, exclude)

Review comment:
       LGTM but please move your conversion to `pytorch.py` or `frontend/common.py`
   
   You add a new op here when you introduce a full-brown relay op (which involves a lot of boilerplate).




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