Could you point to the examples where you have the feeling the code is not clean?
Usually random rotations, distortions etc. are used per-sample, so that the batch size stays the same.
There are a few exceptions, e.g. FiveCrop 6 which return five crops for a single image.
You can just use the torchvision.transforms 30 on a single image and return it.
I’m not sure, what the Keras generator does differently, so could you explain your use case a bit, e.g. what kind of transformation you want to use and which give you problems using them?