Thank you so much Frank. Really appreciate the answer you have shared. I believe this is the only solution ever available on the internet for the above question. And now I see why Pytorch is a nightmare for beginners to use it. May be it’s built for top coders and super experienced folks. But definitely not for weakhearted.