When I try to use Ray RLlib for training, line 228 in the complex input network in raylib displays an error:
**SampleBatch.OBS: torch.reshape(
^^^^^^^^^^^^^^
TypeError: reshape(): argument ‘input’ (position 1) must be Tensor, not numpy.ndarray. **
I understand that this is an input error belonging to ‘input_dict’(component in the function). I checked the format of input_dict and found that it is defined in gym .space ‘box’ object, not a tensor format that can be recognized by torch, so I want to know how to solve this problem
I tried to let the ‘box’ space sample by itself (box. sample()), but this did not meet the requirements in the follow-up obviously.
**component = [torch.tensor(box.sample(), dtype=torch.float32) for box in component]
component = torch.stack(component)
**
At the same time, I found that after the code ran for some time, the component format automatically changed to the tensor format that torch can recognize. I wan to figure out which part of the code is causing this.
ZLY is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.