Dataloader from numpy array without labels?

I have 100 images read as numpy array of shape (100,100,100,3). I want to create a dataloader from this array but without labels( For GAN). Please help me to create a dataloader for pytorch

# Dataset with labels
def __getitem__(self, item):
    x, y = get_image(item), get_label(item)
    return x, y

# Dataset without labels
def __getitem__(self, item):
    x = get_image(item)
    return x

What is this get_image function?

It depends on you.
If you do not know how to build a Dataset and DataLoader, here’s the tutorial.

1 Like