torch_to_numpy#

muse.utils.torch_to_numpy(torch_tensor)#

Convert a torch.Tensor to a numpy.ndarray.

The tensor is detached from the autograd graph and moved to the CPU first so tensors on CUDA devices convert cleanly.

Parameters:

torch_tensor (torch.Tensor) – Torch tensor to convert.

Returns:

The converted NumPy array.

Return type:

numpy.ndarray