PytorchBackend.to_backend_array#

PytorchBackend.to_backend_array(arr, dtype=None, check_device=True)[source]#

Convert a numpy array instance to backend array type.

Parameters:
arrNDArray

The numpy array instance to be converted.

dtypetype, optional

If provided, the returned array is cast to this dtype. The cast is fused with conversion where the underlying library supports it. If the input is already a backend array with a different dtype, it is cast.

Returns:
BackendArray

An array of the specified backend.