Well that error is kind of self explanatory, the code you are running is dealing with a python integer, followed by some pytorch operation on it, which needs its .requires_grad attribute.
Since python integer don’t have this attribute it’s showing you that attribution error.
Could you provide some code? So that we can provide you with actual solutions.