Skip to content

Commit

Permalink
Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsokol committed May 16, 2024
1 parent 6f4e5be commit 905c90b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,19 @@ def test_to_scalar():
ValueError, match="<class 'int'> can be computed for one-element tensors only."
):
tns.__int__()


def test_numpy_dtype():
import numpy as np

a = np.arange(10)

res1 = a.dtype.type(0.0) # it's a scalar

assert repr(res1) == "0"

b = np.arange(20).reshape(10, 1, 2)

res2 = b.dtype.type(0.0) # it's a 0D array

assert repr(res2) == "0"

0 comments on commit 905c90b

Please sign in to comment.