Code snippets can be added by wrapping them into three backticks ```, which makes debugging easier.
Are you seeing an error or unexpected results when running the script?
This questions doesn’t seem to be PyTorch-specific, so you might also get a better and faster answer e.g. on StackOverflow.