I’m trying to determine if I should refactor the way may dataset __getitem__ method pre-processes.
Are there any heuristics beyond the obvious time complexity and code readability I should consider?
For a given audio file that I load I want to:

Pad the length to match a given interval size.
Cut the audio into equal pre-determined interval lengths
Create several types of spectrograms of each piece of this new sequence.

It’s a lot. Is there any reason that I shouldn’t do all of these things right inside of __getitem__?