yrlu / irl-imitation

Implementation of Inverse Reinforcement Learning (IRL) algorithms in Python/Tensorflow. Deep MaxEnt, MaxEnt, LPIRL
570 stars 146 forks source link

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices #6

Open zzlking opened 4 years ago

zzlking commented 4 years ago

\irl-imitation\mdp\gridworld.py", line 151, in get_transition_states_and_probs nei_s[1] < 0 or nei_s[1] >= self.width or self.grid[nei_s[0]][nei_s[1]] == 'x': IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Matrixsun commented 4 years ago

check your python version, it should be use python2

Jo-wang commented 3 years ago

check your python version, it should be use python2

Is there any difference in this case? I solved this problem but is show another problem which is sj will bigger than 25..

mlshehab commented 2 years ago

I solved by updating the function below in gridworld.py (I'm using python 3):

def idx2pos(self, idx): """ input: 1d idx returns: 2d column-major position """ return (idx % self.height, int(idx / self.height))