Changes for numpy 2.0 deprecations
- Replace np.cast with np.asarray: in numpy 2.0,
`np.cast[new_dtype](arr)` is deprecated.
The literal replacement is `np.asarray(arr, dtype=new_dtype)`.
- Replace np.sctype2char and np.obj2sctype.
Added try/except to handle change in behavior
of `np.dtype`
- Replace np.find_common_type with np.result_type
Further changes to `TensorType`:
TensorType.dtype must be a string, so the code
has been changed from `self.dtype = np.dtype(dtype).type`,
where the right-hand side is of type `np.generic`, to
`self.dtype = str(np.dtype(dtype))`, where the right-hand
side is a string that satisfies:
`self.dtype == str(np.dtype(self.dtype))`
This doesn't change the behavior of `np.array(..., dtype=self.dtype)`
etc.
正在显示
请
注册
或者
登录
后发表评论