arr = arr.astypr(numpy.int16)
tensor = torch.from_numpy(arr)
- TypeError: can't convert np.ndarray of type numpy.uint16. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.
- 解决方法:加个
arr = arr/1.0
arr = arr.astypr(numpy.int16)
arr = arr/1.0
tensor = torch.from_numpy(arr)