示例#1
0
文件: cifar.py 项目: Kaushalya/lab
def _data_loader(is_train, batch_size, trans):
    return torch.utils.data.DataLoader(
        datasets.CIFAR10(str(logger.get_data_path()),
                         train=is_train,
                         download=True,
                         transform=trans),
        batch_size=batch_size, shuffle=True)
示例#2
0
def _data_loader(is_train, batch_size):
    return torch.utils.data.DataLoader(
        datasets.MNIST(str(logger.get_data_path()),
                       train=is_train,
                       download=True,
                       transform=transforms.Compose([
                           transforms.ToTensor(),
                           transforms.Normalize(mean=[0.5], std=[0.5])
                       ])),
        batch_size=batch_size, shuffle=True, drop_last=True)
示例#3
0
def _data_loader(is_train, batch_size, dl_args):
    return torch.utils.data.DataLoader(
        datasets.MNIST(str(logger.get_data_path()),
                       train=is_train,
                       download=True,
                       transform=transforms.Compose([
                           transforms.ToTensor(),
                           transforms.Normalize((0.1307,), (0.3081,))
                       ])),
        batch_size=batch_size, shuffle=True, **dl_args)