111398:

I have built the following program in python and I want to translate it to PyTorch so I can compare the result but I still haven’t found how to do it. I’m currently attenting a course for PyTorch but it’s really slow and I need some help. Can anyone tell me how to write this code using PyTorch?


I think the best approach would be if you could explain what you have done so far, what is not working, and where you are stuck.
Once we know this information we might be able to guide you through it. Especially if you are taking a course I would recommend to try to debug it yourself first and avoid looking at perfect solutions.