Skip to content

Commit 7bb114c

Browse files
committed
Fix numpy DeprecationWarning when converting integers to PyTensor Constants
1 parent 0b632bd commit 7bb114c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: pytensor/misc/safe_asarray.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def _asarray(a, dtype, order=None):
3232
if str(dtype) == "floatX":
3333
dtype = config.floatX
3434
dtype = np.dtype(dtype) # Convert into dtype object.
35-
rval = np.asarray(a, dtype=dtype, order=order)
35+
rval = np.asarray(a, order=order).astype(dtype)
3636
# Note that dtype comparison must be done by comparing their `num`
3737
# attribute. One cannot assume that two identical data types are pointers
3838
# towards the same object (e.g. under Windows this appears not to be the

0 commit comments

Comments
 (0)