rl-agents icon indicating copy to clipboard operation
rl-agents copied to clipboard

IndexError: tuple index out of range

Open Pei-w opened this issue 4 years ago • 2 comments

When I try the value of print ("in_width ") I get this result IndexError: tuple index out of range I print ("env. Observation_space ") get the box is (15,7) Can a friend explain to me how to use in_width ?thanks

Pei-w avatar May 14 '20 08:05 Pei-w

Hello @Pei-w, in_width is configuration parameter describing the shape of the inputs of a Convolutional Network. Convolutional Networks are typically used with image-like inputs, which are shaped as (channels, height, width). In your case, since the observation is shaped as (15,7), you are probably using the default KinematicsObservation of highway-env, which does not really have an image structure (it is just a list of coordinates). It does not have the right shape anyway, which is why you get an IndexError.

ConvolutionalNetworks will be more suited for GrayscaleObservations and TimeToCollisionObservation They can be selected by changing the "observation" field in the environment configuration.

eleurent avatar May 14 '20 09:05 eleurent

Hello @Pei-w, in_width is configuration parameter describing the shape of the inputs of a Convolutional Network. Convolutional Networks are typically used with image-like inputs, which are shaped as (channels, height, width). In your case, since the observation is shaped as (15,7), you are probably using the default KinematicsObservation of highway-env, which does not really have an image structure (it is just a list of coordinates). It does not have the right shape anyway, which is why you get an IndexError.

ConvolutionalNetworks will be more suited for GrayscaleObservations and TimeToCollisionObservation They can be selected by changing the "observation" field in the environment configuration.

Thank you for your answer. I've been bothered by this problem for two days now. Thank you again for your prompt answer. I have now solved my problem.

Pei-w avatar May 14 '20 12:05 Pei-w