pytorch_pfn_extras.as_ndarray

pytorch_pfn_extras.as_ndarray(tensor)

Creates a numpy.ndarray or cupy.ndarray from torch.Tensor.

This method returns a tensor as a NumPy or CuPy ndarray depending on where the given tensor resides in. The tensor and the returned ndarray share the same underlying storage. Changes to the tensor will be reflected in the ndarray and vice versa. Note that changes made to ndarray cannot be tracked in the computational graph.

Parameters

tensor (torch.Tensor) –

Return type

Any