You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2024/01/12 19:22:24 UTC

(tvm) branch main updated: [Relay][Frontend][Torch] fix a typo mistake in nonzero_numpy (#16390)

This is an automated email from the ASF dual-hosted git repository.

masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 196b413813 [Relay][Frontend][Torch] fix a typo mistake in nonzero_numpy (#16390)
196b413813 is described below

commit 196b413813ea6b5e85720118c9aea1fe043a81fb
Author: TaoMiao <ta...@pku.edu.cn>
AuthorDate: Sat Jan 13 03:22:18 2024 +0800

    [Relay][Frontend][Torch] fix a typo mistake in nonzero_numpy (#16390)
    
    fix a typo mistake in pytorch frontend nonzero_numpy
---
 python/tvm/relay/frontend/pytorch.py          | 2 +-
 tests/python/frontend/pytorch/test_forward.py | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/python/tvm/relay/frontend/pytorch.py b/python/tvm/relay/frontend/pytorch.py
index 0213dcc488..b9650e6e9a 100644
--- a/python/tvm/relay/frontend/pytorch.py
+++ b/python/tvm/relay/frontend/pytorch.py
@@ -2680,7 +2680,7 @@ class PyTorchOpConverter:
         return ret
 
     def nonzero_numpy(self, inputs, input_types):
-        return self.nonzero(inputs, input_types, is_numpy_style=False)
+        return self.nonzero(inputs, input_types, is_numpy_style=True)
 
     def scatter(self, inputs, input_types):
         assert len(inputs) == 4 or len(inputs) == 5, (
diff --git a/tests/python/frontend/pytorch/test_forward.py b/tests/python/frontend/pytorch/test_forward.py
index 6178a58b6d..9bf40cfcdd 100644
--- a/tests/python/frontend/pytorch/test_forward.py
+++ b/tests/python/frontend/pytorch/test_forward.py
@@ -4445,6 +4445,7 @@ def test_forward_nonzero():
 
     inp = torch.Tensor(np.array([[0, 1, 0], [2, 0, 9], [-1, -1, 0]]).astype("float32"))
     verify_trace_model(Nonzero(), [inp], ["llvm"])
+    verify_trace_model(Nonzero(as_tuple=True), [inp], ["llvm"])
 
 
 def test_forward_scatter():