numpy object to torch tensor code example Example: tensor.numpy() pytorch gpu tensor_array.cpu().detach().numpy()