torch tensor to numpy ndarray code example Example 1: convert pytorch tensor to numpy na = a.to('cpu').numpy() Example 2: convert torch to numpy your_tensor.numpy()