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/06/24 23:58:32 UTC

[GitHub] [tvm] shingjan opened a new pull request, #11896: [Relay][Pytorch] Add aten::new_ones, aten::new_full, aten::fill_, aten::pad, aten::reshape_as and atem::empty_like

shingjan opened a new pull request, #11896:
URL: https://github.com/apache/tvm/pull/11896

   This PR intends to add the following six ops for the pytorch frontend:
   - aten::new_ones
   - aten::new_full
   - aten::fill_
   - aten::pad
   - aten::reshape_as
   - aten::empty_like
   
   Note that arguments to the above ops will be changed by relay at runtime so `verify_model` won't work on them. 
   
   cc: @masahi @junrushao1994 @zxybazh 
   


-- 
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 #11896: [Relay][Pytorch] Add aten::new_ones, aten::new_full, aten::fill_, aten::pad, aten::reshape_as and atem::empty_like

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


-- 
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 pull request #11896: [Relay][Pytorch] Add aten::new_ones, aten::new_full, aten::fill_, aten::pad, aten::reshape_as and atem::empty_like

Posted by GitBox <gi...@apache.org>.
masahi commented on PR #11896:
URL: https://github.com/apache/tvm/pull/11896#issuecomment-1170625492

   Did they ever fail in your local testing?


-- 
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] shingjan commented on pull request #11896: [Relay][Pytorch] Add aten::new_ones, aten::new_full, aten::fill_, aten::pad, aten::reshape_as and atem::empty_like

Posted by GitBox <gi...@apache.org>.
shingjan commented on PR #11896:
URL: https://github.com/apache/tvm/pull/11896#issuecomment-1170369425

   @tvm-bot rerun


-- 
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] shingjan commented on pull request #11896: [Relay][Pytorch] Add aten::new_ones, aten::new_full, aten::fill_, aten::pad, aten::reshape_as and atem::empty_like

Posted by GitBox <gi...@apache.org>.
shingjan commented on PR #11896:
URL: https://github.com/apache/tvm/pull/11896#issuecomment-1170765439

   @masahi Local testing no. But there is one CI failure:
   https://ci.tlcpack.ai/blue/rest/organizations/jenkins/pipelines/tvm/branches/PR-11896/runs/9/nodes/383/steps/1174/log/?start=0
   
   This is the stacktrace:
   ```
   [2022-06-29T08:34:53.751Z] _______________________________ test_empty_like ________________________________
   [2022-06-29T08:34:53.751Z] 
   [2022-06-29T08:34:53.751Z]     def test_empty_like():
   [2022-06-29T08:34:53.751Z]         def test_func(data):
   [2022-06-29T08:34:53.751Z]             return torch.empty_like(data)
   [2022-06-29T08:34:53.751Z]     
   [2022-06-29T08:34:53.751Z] >       verify_model_with_input(test_func, [torch.rand([1, 3, 10, 10]).float()])
   [2022-06-29T08:34:53.751Z] 
   [2022-06-29T08:34:53.751Z] tests/python/frontend/pytorch/test_forward.py:3827: 
   [2022-06-29T08:34:53.751Z] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
   [2022-06-29T08:34:53.751Z] tests/python/frontend/pytorch/test_forward.py:221: in verify_model_with_input
   [2022-06-29T08:34:53.751Z]     tvm.testing.assert_allclose(baseline_outputs, compiled_output, rtol=1e-5, atol=1e-5)
   [2022-06-29T08:34:53.751Z] python/tvm/testing/utils.py:113: in assert_allclose
   [2022-06-29T08:34:53.751Z]     np.testing.assert_allclose(actual, desired, rtol=rtol, atol=atol, verbose=True)
   [2022-06-29T08:34:53.751Z] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
   [2022-06-29T08:34:53.751Z] 
   [2022-06-29T08:34:53.751Z] x = array([[[[ 7.7170313e-17,  0.0000000e+00,  5.3485164e-26,
   [2022-06-29T08:34:53.751Z]            0.0000000e+00,  0.0000000e+00,  0.0000000e+00,
   [2022-06-29T08:34:53.751Z]   ...  0.0000000e+00,
   [2022-06-29T08:34:53.751Z]            0.0000000e+00,  0.0000000e+00,  0.0000000e+00,
   [2022-06-29T08:34:53.751Z]            0.0000000e+00]]]], dtype=float32)
   [2022-06-29T08:34:53.751Z] y = array([[[[0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
   [2022-06-29T08:34:53.751Z]          [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
   [2022-06-29T08:34:53.751Z]          [0., 0....         [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
   [2022-06-29T08:34:53.751Z]          [0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]]]], dtype=float32)
   [2022-06-29T08:34:53.751Z] func = <ufunc 'isnan'>, hasval = 'nan'
   [2022-06-29T08:34:53.751Z] 
   ```
   looks like those two tensors should pass the `allclose` test but they failed on CI anyway


-- 
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] driazati commented on pull request #11896: [Relay][Pytorch] Add aten::new_ones, aten::new_full, aten::fill_, aten::pad, aten::reshape_as and atem::empty_like

Posted by GitBox <gi...@apache.org>.
driazati commented on PR #11896:
URL: https://github.com/apache/tvm/pull/11896#issuecomment-1171357705

   it's since failed a few times on `main`, I filed #11968 to disable it until there is a fix


-- 
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 diff in pull request #11896: [Relay][Pytorch] Add aten::new_ones, aten::new_full, aten::fill_, aten::pad, aten::reshape_as and atem::empty_like

Posted by GitBox <gi...@apache.org>.
masahi commented on code in PR #11896:
URL: https://github.com/apache/tvm/pull/11896#discussion_r907725027


##########
python/tvm/relay/frontend/pytorch.py:
##########
@@ -701,6 +701,41 @@ def ones_like(self, inputs, input_types):
 
         return out
 
+    def new_ones(self, inputs, input_types):
+        """
+        Returns a Tensor of size size filled with 1. By default, the
+        returned Tensor has the same torch.dtype and torch.device
+        as this tensor.
+
+        Parameters
+        size (int...)
+            a list, tuple, or torch.Size of integers defining the shape of
+            the output tensor.
+        dtype (torch.dtype, optional)
+            the desired type of returned tensor.
+            Default: if None, same torch.dtype as this tensor.
+        device (torch.device, optional)
+            the desired device of returned tensor.
+            Default: if None, same torch.device as this tensor.
+        requires_grad (bool, optional)
+            If autograd should record operations on the returned tensor.
+            Default: False.

Review Comment:
   Remove this doc



##########
python/tvm/relay/frontend/pytorch.py:
##########
@@ -765,6 +800,49 @@ def full_like(self, inputs, input_types):
 
         return out
 
+    def new_full(self, inputs, input_types):
+        """
+        Returns a Tensor of size size filled with fill_value.
+        By default, the returned Tensor has the same dtype
+        and device as this tensor.
+
+        Parameters
+        ----------
+        fill_value (scalar)
+            The number to fill the output tensor with.
+        dtype (torch.dtype, optional)
+            The desired type of returned tensor.
+            Default: if None, same torch.dtype as this tensor.
+        device (torch.device, optional)
+            The desired device of returned tensor.
+            Default: if None, same torch.device as this tensor.
+        requires_grad (bool, optional)
+            If autograd should record operations on the returned
+            tensor. Default: False.
+        """

Review Comment:
   Remove this doc



##########
python/tvm/relay/frontend/pytorch.py:
##########
@@ -2336,6 +2419,15 @@ def empty(self, inputs, input_types):
         shape = inputs[0]
         return _op.zeros(shape, _convert_dtype_value(inputs[1]))
 
+    def empty_like(self, inputs, input_types):
+        """
+        Returns an uninitialized tensor with the same size as input.
+        torch.empty_like(input) is equivalent to torch.empty(input.size(),
+        dtype=input.dtype, layout=input.layout, device=input.device).
+        """

Review Comment:
   Remove this doc



-- 
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] shingjan commented on pull request #11896: [Relay][Pytorch] Add aten::new_ones, aten::new_full, aten::fill_, aten::pad, aten::reshape_as and atem::empty_like

Posted by GitBox <gi...@apache.org>.
shingjan commented on PR #11896:
URL: https://github.com/apache/tvm/pull/11896#issuecomment-1170606785

   @masahi It is possible that tests for `empty` and `empty_like` are flaky. It failed on CI once but by reading the outputs it shouldn't fail. Just to give a heads-up.


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