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

junrushao 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 1c4538947b [BugFix] Fixed Inappropriate Logical Expression (#16272)
1c4538947b is described below

commit 1c4538947bed5b987530730a3a7be5632725c965
Author: Ataf Fazledin Ahamed <[email protected]>
AuthorDate: Wed Dec 27 03:19:17 2023 +0600

    [BugFix] Fixed Inappropriate Logical Expression (#16272)
    
    [BugFix] Fixed a comparison for splitting tensor
    
    In the `tensor_split` method, there's a comparsion
    that checks if the input tensor is zero-dimensional
    or one-dimensional long tensor.
    
    In the comparsion, there's a typo that converts
    the shape of the tensor to a list and compares
    against integer.
    
    This commit fixes the bug by comapring the
    length of the tensor against the integer.
    
    Signed-off-by: fazledyn-or <[email protected]>
---
 python/tvm/relay/frontend/pytorch.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/python/tvm/relay/frontend/pytorch.py 
b/python/tvm/relay/frontend/pytorch.py
index b02e59b265..54004c379d 100644
--- a/python/tvm/relay/frontend/pytorch.py
+++ b/python/tvm/relay/frontend/pytorch.py
@@ -595,9 +595,7 @@ class PyTorchOpConverter:
             )
             raise AssertionError(msg)
 
-        if isinstance(inputs[1], torch.Tensor) and not (
-            list(inputs[1].shape) == [] or list(inputs[1].shape) == 1
-        ):
+        if isinstance(inputs[1], torch.Tensor) and len(inputs[1].shape) not in 
[0, 1]:
             msg = "indices_or_sections must be a zero-dimensional or 
one-dimensional long tensor"
             raise AssertionError(msg)
 

Reply via email to