So basically this error is appearing only when I train my model in the editor (vscode, with anaconda environment) but when i run the same script in a jupyter notebook (in vscode) it works fine no error. I think might be import error or something else. i have three files, my pytorch model, my physics model and the main train file where I do the imports.
The error is: typeError: only integer tensors of a single element can be converted to an index.
this is the line of code where the error is popping up.
noise = (torch.randn_like(action) * self.policy_noise).clamp(-self.noise_clip, self.noise_clip)
which is in the pytorch model.
here is the complete error message:
Traceback (most recent call last):
File “c:/Users/ACER/Desktop/ACER/jupyter notebook/python_scripts/drone/train.py”, line 113, in
File “c:\Users\ACER\Desktop\ACER\jupyter notebook\python_scripts\drone\agent.py”, line 144, in train
torch.randn_like(action) * self.policy_noise
TypeError: only integer tensors of a single element can be converted to an index