pytorch_pfn_extras.from_ndarray¶
- pytorch_pfn_extras.from_ndarray(ndarray: pytorch_pfn_extras._tensor._NDArray) torch.Tensor ¶
Creates a torch.Tensor from a numpy.ndarray or cupy.ndarray.
Unlike torch.from_numpy, this method may make a copy when needed, e.g. when the given ndarray contains the negative strides which is not supported by PyTorch.