Answers for "UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors."

0

UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors.

# Instead of using 
# img = transforms.ToTensor()(img)

# Use this:
img = transforms.ToTensor()(np.array(img))
Posted by: Guest on March-12-2021

Code answers related to "UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors."

Browse Popular Code Answers by Language