简体   繁体   中英

how do i deal with torchvision datasets

I am using a torchvision dataset called MNIST. I run the code in my python project to download it. Do I need to delete the code I wrote, or could I just continue writing my ai? Would the download code disturb it or redownload the whole dataset?

The code I use to download it:

train = datasets.MNIST("", train=True, download=True,
                       transform = transforms.Compose([transforms.ToTensor()]))

test = datasets.MNIST("", train=False, download=True,
                       transform = transforms.Compose([transforms.ToTensor()]))

The guy from the tutorial is using jupyter notebook, but I am using PyCharm. What do i need to do?

Just leave that in there, you need that to define your datasets: The download=True flag means that the dataset is only downloaded as long as it doesn't already exist in the specified folder:https://pytorch.org/docs/stable/torchvision/datasets.html#mnist

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM