Hello, everyone! How can I define a function that takes a dataset and an index list as input and returns a tensor?
For example, given a dataset defined as below
import torch
import torch.utils.data
import torchvision.datasets as dset
import torchvision.transforms as transforms
import torchvision.utils as vutils
dataroot = "datasets/celebA/"
image_size = 64
dataset = dset.ImageFolder(root=dataroot,
                           transform=transforms.Compose([
                               transforms.Resize(image_size),
                               transforms.CenterCrop(image_size),
                               transforms.ToTensor(),
                               transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5)),
                           ]))

I want to define a function
def minibatch(dataset,indices):
    """

    :param dataset:
    :param indices: an index list
    :return: a N*C*H*W tensor that contains feature vectors corresponding to samples with these indices
    """