Convert tensorflow code snippet to pytorch

Hi All, I want to convert this tensorflow code snippet to pytorch. Especially the part is pretty confusion.

PyTorch doesn’t use a session and executes the code in “eager mode” by default, i.e. similar to numpy.
You could thus just feed your data to your model and would get the output without creating sessions etc.
Take a look at e.g. these tutorials to see how PyTorch is used.