Mukesh1729:

but do you think the inference approach I used in the above code is the right way to go?


It looks alright by just skimming through the code. You are not using any transformations during the inference run, but it also seems that no transformations (e.g. normalization) are used during training.