gemini-code-assist[bot] commented on code in PR #607:
URL: https://github.com/apache/tvm-ffi/pull/607#discussion_r3364155976


##########
tests/python/test_tensor.py:
##########
@@ -52,19 +52,6 @@ def test_tensor_attributes() -> None:
     np.testing.assert_equal(x2, data)
 
 
-def test_empty_tensor_attributes() -> None:
-    data: npt.NDArray[Any] = np.zeros((4, 0, 4), dtype="int16")
-    if not hasattr(data, "__dlpack__"):
-        return
-    x = tvm_ffi.from_dlpack(data)
-    assert isinstance(x, tvm_ffi.Tensor)
-    assert x.shape == (4, 0, 4)
-    assert x.ndim == 3
-    assert x.strides == (0, 4, 1)
-    assert x.numel() == 0
-    assert x.is_contiguous()
-
-
 def test_non_contiguous_tensor_attributes() -> None:

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Instead of completely removing `test_empty_tensor_attributes`, we should 
keep it to maintain test coverage for empty tensors (which is an important edge 
case). We can relax the stride assertion to accept both the old and new NumPy 
stride conventions (`(0, 4, 1)` and `(0, 0, 0)`).
   
   ```suggestion
   def test_empty_tensor_attributes() -> None:
       data: npt.NDArray[Any] = np.zeros((4, 0, 4), dtype="int16")
       if not hasattr(data, "__dlpack__"):
           return
       x = tvm_ffi.from_dlpack(data)
       assert isinstance(x, tvm_ffi.Tensor)
       assert x.shape == (4, 0, 4)
       assert x.ndim == 3
       assert x.strides in ((0, 4, 1), (0, 0, 0))
       assert x.numel() == 0
       assert x.is_contiguous()
   
   
   def test_non_contiguous_tensor_attributes() -> None:
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to