Skip to content

Commit 5cef8fb

Browse files
committed
Remove np.obj2sctype
1 parent 4b83f94 commit 5cef8fb

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pytensor/tensor/type.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def __init__(
102102
if str(dtype) == "floatX":
103103
self.dtype = config.floatX
104104
else:
105-
if np.obj2sctype(dtype) is None:
105+
if np.dtype(dtype).type is None:
106106
raise TypeError(f"Invalid dtype: {dtype}")
107107

108108
self.dtype = np.dtype(dtype).name
@@ -785,8 +785,7 @@ def tensor(
785785
if name is not None:
786786
# Help catching errors with the new tensor API
787787
# Many single letter strings are valid sctypes
788-
if str(name) == "floatX" or (len(str(name)) > 1 and np.obj2sctype(name)):
789-
np.obj2sctype(name)
788+
if str(name) == "floatX" or (len(str(name)) > 1 and np.dtype(name).type):
790789
raise ValueError(
791790
f"The first and only positional argument of tensor is now `name`. Got {name}.\n"
792791
"This name looks like a dtype, which you should pass as a keyword argument only."

0 commit comments

Comments
 (0)