pytorch_mppi icon indicating copy to clipboard operation
pytorch_mppi copied to clipboard

handle_batch_input error

Open Zhong-eng opened this issue 3 years ago • 1 comments

Hi there,

Thank you for your amazing work. I'm trying your code on Hopper env. However, I get an error from the handle_batch_input function:

Traceback (most recent call last):
  File "xxxx, line 62, in <module>
    action = ctrl.command(obs)
  File "xxx/pytorch_mppi/pytorch_mppi/mppi.py", line 194, in command
    cost_total = self._compute_total_cost_batch()
  File "xxx/pytorch_mppi/pytorch_mppi/mppi.py", line 280, in _compute_total_cost_batch
    self.cost_total, self.states, self.actions = self._compute_rollout_costs(self.perturbed_action)
  File "xxx/pytorch_mppi/pytorch_mppi/mppi.py", line 238, in _compute_rollout_costs
    c = self._running_cost(state, u)
  File "xxx/pytorch_mppi/pytorch_mppi/mppi.py", line 47, in wrapper
    ret = ret.view(*batch_dims)
ValueError: Type must be a sub-type of ndarray type

I'm wondering what this function is used for and whether you know where this error comes from.

Thank you so much for your help!

Zhong-eng avatar Jul 27 '22 08:07 Zhong-eng

Hi, what is the input obs that you're feeding into ctrl.command? It should be a torch.tensor or convertible type (such as list, or numpy ndarray) of size nx or K x nx, where nx is the state dimension, and K is some batch dimension.

LemonPi avatar Jul 27 '22 22:07 LemonPi