Where is the len function used in PyTorch Dataset?
I am looking to use the code from here .
However, I am looking at box 5, where there is the following function;

def __len__(self):
    # Default epoch size is 10 000 samples
    return 10000


I do not see  anywhere throughout this script where this function is being used.
Clarification on this would be appreciated.

Also, I want to determine the number of image patches used for training  this convolutional neural network. Is this len function linked to the number of patches?

This is a function of the Dataset class. The __len__() function specifies the size of the dataset. In your referenced code, in box 10, a dataset is initialized and passed to a DataLoader object:

train_set = ISPRS_dataset(train_ids, cache=CACHE)
train_loader = torch.utils.data.DataLoader(train_set,batch_size=BATCH_SIZE)


You see that in the DataLoader the dataset object is passed as well as the batch size. The DataLoader object then uses the __len__ function of the Dataset to create the batches. This happens in box 13, where it is iterated over the DataLoader.
