Closed
Description
Hi,
I am following the 'Introduction to PyTorch' tutorial. During Datasets & DataLoaders I copied the following:
from torch.utils.data import Dataset
from torchvision import datasets
from torchvision.transforms import ToTensor
import matplotlib.pyplot as plt
training_data = datasets.FashionMNIST(
root="data",
train=True,
download=True,
transform=ToTensor()
)
test_data = datasets.FashionMNIST(
root="data",
train=False,
download=True,
transform=ToTensor()
)
Which led me to the following warning:
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means
you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the
array to protect its data or make it writeable before converting it to a tensor. This type of warning will be
suppressed for the rest of this program. (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:180.)
return torch.from_numpy(parsed.astype(m[2], copy=False)).view(*s)
It seems this issue has been solved before?
47160
I am using
- Python 3.9
- torch 1.9.1
- torchvision 0.10.1
- numpy 1.21.2
- Pycharm 2021.2
- Ubuntu 21.4
I installed using a virtual environment and the guide on https://pytorch.org/get-started/locally/
pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
This warning was also given during the 'quickstart' tutorial. The warning seems to have no further effect on the tutorial.
Why is the warning not mentioned in the tutorial?
cc @suraj813