def make_val_loader(img_dim, resize_dim, batch_size=FLAGS.test_set_batch_size):
    num_dataset_instances = (xm.xrt_world_size() * FLAGS.num_workers)
    epoch_test_size = (testsize // num_dataset_instances)
    val_transform = transforms.Compose([transforms.Resize(resize_dim), transforms.CenterCrop(img_dim), transforms.ToTensor(), normalize])
    val_dataset = wds.WebDataset('pipe:cat /mnt/disks/dataset/webdataset/shards/imagenet-val-{000000..000049}.tar', splitter=my_worker_splitter, nodesplitter=my_node_splitter, shardshuffle=False, length=epoch_test_size).decode('pil').to_tuple('ppm;jpg;jpeg;png', 'cls').map_tuple(val_transform, identity).batched(batch_size, partial=True)
    val_loader = torch.utils.data.DataLoader(val_dataset, batch_size=None, shuffle=False, num_workers=FLAGS.num_workers)
    return val_loader
def make_val_loader(img_dim, resize_dim, batch_size=FLAGS.test_set_batch_size):
    num_dataset_instances = (xm.xrt_world_size() * FLAGS.num_workers)
    epoch_test_size = (testsize // num_dataset_instances)
    val_transform = transforms.Compose([transforms.Resize(resize_dim), transforms.CenterCrop(img_dim), transforms.ToTensor(), normalize])
    val_dataset = wds.WebDataset('pipe:cat /mnt/disks/dataset/webdataset/shards/imagenet-val-{000000..000049}.tar', splitter=my_worker_splitter, nodesplitter=my_node_splitter, shardshuffle=False, length=epoch_test_size).decode('pil').to_tuple('ppm;jpg;jpeg;png', 'cls').map_tuple(val_transform, identity).batched(batch_size, partial=True)
    val_loader = torch.utils.data.DataLoader(val_dataset, batch_size=None, shuffle=False, num_workers=FLAGS.num_workers)
    return val_loader