TypeError: 'list' object is not callable

May I ask where is the error? Why are the objects of the list uncallable? I checked the path is no problem.

B_data_iter = iter(tgt_dataloader)

for epoch in range(opt.epoch, opt.n_epochs):
    for step, (src_image, src_label) in enumerate(src_dataloader):
        # Idefinitely loop over target data loader
            (tgt_image, _) = B_data_iter.next()
        except StopIteration:
            B_data_iter = iter(tgt_dataloader)
            (tgt_image, _) = B_data_iter.next()
src_dataloader = get_data_loader(name=opt.src_datasets, dataset_root=opt.dataroot, batch_size=opt.batchSize, train=True)
def get_data_loader(name, dataset_root, batch_size, train=True):

    if name == "sandy_train":
        return get_train_data(dataset_root, batch_size, 'train', 'sandy')
def get_train_data(dataset_root, batch_size, datatype, category):
    # image pre-processing
    pre_process = [ transforms.Resize(int(256*1.12), Image.BICUBIC), 
                transforms.Normalize((0.5,0.5,0.5), (0.5,0.5,0.5)) ]
    # datasets and data_loader
    train_dataset = datasets.ImageFolder(               
        os.path.join(dataset_root, datatype, category),

    train_dataloader = data.DataLoader(

    return train_dataloader

pre_process is a plain list, while a transformation is expected.
You could pass the list to transforms.Compose to make it callable.

Thank! According to your method I solved the problem. But I still want to ask you a question. The input image size is 256256. During preprocessing, it is resized to 2561.12, and then cropped to 256. What is the purpose of doing this? What is Image.BICUBIC?

The resolution of the image is increased a bit and then randomly cropped back to 256x256.
This will basically crop smaller image parts from the original image and make sure the spatial resolution stays the same.