If anyone is looking to get the number of data points in the training set from the DataLoader object:
len(trainloader.dataset)

In contrast len(trainloader) which gives the “number of batches”, see however second warning in the docs.