karasinek
karasinek

Reputation: 1

Garage Framework Dİmension or concatenated Error

I am working on the Robosuite framework to simulate a robotic control task with a reinforcement learning (RL) algorithm. I'm implementing the Cross-Entropy Method (CEM) from the garage library. I need to provide an EpisodeBatch object to the cem._train_once method. My challenge is creating an episode_info dictionary that correctly feeds into the EpisodeBatch.

Here’s the problem:

  1. Error when defining episode_info as an integer

episode_info = {'episode_lengths': T}

I get the following error:

Concatenation failed for key 'episode_lengths' with error: zero-dimensional arrays cannot be concatenated ValueError: zero-dimensional arrays cannot be concatenated

  1. Error when defining episode_info as a numpy array

If I change episode_info to:

python

episode_info = {'episode_lengths': np.array([T])}

I get this different error:

raise ValueError(f'last_observations must have the same ' ValueError: last_observations must have the same number of entries as there are episodes (5) but got data with shape {last_observations[0].shape} entries

Here is the debugging output from EpisodeBatch.init for second error:

lengths: [50 50 50 50 50]
n_episodes (calculated from lengths): 5
episode_infos keys: ['episode_lengths']
episode_infos['episode_lengths'].shape: (5, 1), expected shape: (5,)
last_observations.shape: (5, 3)
n_episodes: 5
env_spec.observation_space: Box(-inf, inf, (3,), float32)
env_spec.observation_space.shape: (3,)
last_observations[0].shape: (3,)

I’m not sure how to resolve this issue. If anyone is familiar with the Garage framework or Robosuite simulations or has encountered similar problems, any help would be appreciated!

Thank you for your help!

Upvotes: 0

Views: 21

Answers (0)

Related Questions