Policy.compute_single_action() returns "'list' object has no attribute 'float'" error

**How severe does this issue affect your experience of using Ray?

  • High: It blocks me to complete my task.

Hi, I’m trying to use the compute_single_action() function to test my trained algorithm on a multi-agent PettingZoo environment however I am receiving the following error:
‘list’ object has no attribute ‘float’ for obs = input_dict[“obs_flat”].float() in ray\rllib\models\torch\fcnet.py

I am using the following code:
action = DQN_algo.get_policy(agent).compute_single_action(observation)

I am getting the observation directly from the environment using the .last() function and my observation is as follows:
observation = {‘observation’: [0, 0, 0, 2, 1, 0, 0, 1, 0, 0, 0, 1, 3, 2, 0, 1], ‘action_mask’: array([0, 1, 0, …, 0, 0, 0], dtype=int8)}

Passing in your observation[‘observation’] as a numpy array, not as a list, should fix the issue.