0

I have created this neural network:

obs_shape = (288, 512, 3)
num_actions = 2

input = layers.Input(shape=obs_shape)
x = layers.Conv2D(16, (3, 3), activation='relu')(input)
x = layers.MaxPool2D((2, 2))(x)
x = layers.Conv2D(32, (3, 3), activation='relu')(x)
x = layers.MaxPool2D((2, 2))(x)
x = layers.Conv2D(64, (3, 3), activation='relu')(x)
x = layers.MaxPool2D((2, 2))(x)
x = layers.Flatten()(x)
x = layers.Dense(64, activation='relu')(x)
x = layers.Dense(32, activation='relu')(x)
actions = layers.Dense(num_actions, activation='softmax')(x)
actor = keras.Model(input, actions, name="actor")

My input is a rescaled image which has values between 0 and 1. In my program I use this network for an implementation of an Actor-Critic Reinforcement Learning method and after two episodes when I use:

# actor is the aforementioned network
# observation is the aforementioned kind of image
actor.predict(observation)

I get an array containing NaN values. How can I fix this problem? What affects this? The learning rate of my optimizer (I use RMSprop)? The custom computation of the gradients?

Giuseppe Boezio
  • 101
  • 1
  • 11

0 Answers0