Why random erasing should be applied as Post transfromation

Hello everyone.I really appreciate this community bcz everyone replies so fast.So my doubt is i am applying data augumentation where i found about random erasing .In actual documentation

> transform = transforms.Compose([
>>> transforms.RandomHorizontalFlip(),
>>> transforms.ToTensor(),
>>> transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)),
>>> transforms.RandomErasing(),
>>> ])

Here why random erasing is applied after ToTensor() and ToNormalize() functions.
When i applied random erasing before ToTensor() and ToNormalize() it is giving me an error like image object has no attribute size.Help will be greately appreciated

The implementation of F.erase is quite simple as seen here and doesn’t need PIL or any other image library as the backend, which is most likely why it was implemented for tensors directly.