How often is transformations done (internally) when loading a dataset?

Say for example I have

transform = transforms.Compose([
        mean = [0.485, 0.456, 0.406],
        std = [0.229, 0.224, 0.225]

and I use it to augment a dataset CustomDataset(transform=transform). Is transform being run for every batch, for every epoch, or is it run only one? I’m curious to know because what if I were to use albumentationsA.OneOf, how often would it have to randomly select among provided transformations?

transform is run each time you retrieve a sample from the Dataset object.
So for batch size N, it will run N times every iteration (every sample has a different transformation). (not every batch, every epoch, but every sample)