Toni-SM / skrl

Modular reinforcement learning library (on PyTorch and JAX) with support for NVIDIA Isaac Gym, Omniverse Isaac Gym and Isaac Lab
https://skrl.readthedocs.io/
MIT License
574 stars 60 forks source link

A wrong report in base.py #2

Closed cwjwudi closed 2 years ago

cwjwudi commented 2 years ago

There seems to be a bug when I try to run the program in the example.

Traceback (most recent call last):
  File "/home/cwj/my_project/RoboticLab/my_imply/skrl_test/test.py", line 97, in <module>
    device=device)
  File "/home/cwj/my_project/RoboticLab/skrl/skrl/agents/torch/ppo/ppo.py", line 128, in __init__
    self.memory.create_tensor(name="states", size=self.observation_space, dtype=torch.float32)
  File "/home/cwj/my_project/RoboticLab/skrl/skrl/memories/torch/base.py", line 105, in create_tensor
    tensor.fill_(torch.nan)
AttributeError: module 'torch' has no attribute 'nan'

In pytorch 1.9 or lower, there seems no torch.nan, replace it as math.nan can solve the problem.

In skrl/memories/torch/base.py line 105.

tensor.fill_(math.nan)
Toni-SM commented 2 years ago

Many thanks for your feedback... The changes have been made

It seems that there are other things that I am writing in the development branch that will need revision to support torch>=1.8.0 and torch<1.10.0 👀