Cif-10 dataset is normalized by dataloader?


I ve found this code: auto-attack/ at master · fra31/auto-attack · GitHub

    transform_list = [transforms.ToTensor()]
    transform_chain = transforms.Compose(transform_list)
    item = datasets.CIFAR10(root=args.data_dir, train=False, transform=transform_chain, download=True)
    test_loader = data.DataLoader(item, batch_size=1000, shuffle=False, num_workers=0)

Is the dataset already normalized by std mean and std var?

No, you need to add it to the transforms_list.

transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])

You can look at the source code for CIFAR10 here: torchvision.datasets.cifar — Torchvision master documentation