UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. code example
Example: 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))