title: Scale actor network output to the action space bounds in Keras Rl
body: <p>I am trying to implement DDPG from Keras RL and have the following actor network.</p>
  
  <pre><code>actor = Sequential()
  actor.add(Flatten(input_shape=(1,) + env.observation_space.shape))
  actor.add(Dense(16))
  actor.add(Activation('relu'))
  actor.add(Dense(16))
  actor.add(Activation('relu'))
  actor.add(Dense(16))
  actor.add(Activation('relu'))
  actor.add(Dense(nb_actions))
  actor.add(Activation('linear'))
  </code></pre>
  
  <p>However, I would prefer to have the output scaled to a custom gym environment action space bounds for my problem. <code>env.action_space</code>. </p>
  
  <p><a href="https://pemami4911.github.io/blog/2016/08/21/ddpg-rl.html" rel="nofollow noreferrer">https://pemami4911.github.io/blog/2016/08/21/ddpg-rl.html</a> shows this using the tflearn api where they use </p>
  
  <pre><code>def create_actor_network(self):
          inputs = tflearn.input_data(shape=[None, self.s_dim])
          net = tflearn.fully_connected(inputs, 400)
          net = tflearn.layers.normalization.batch_normalization(net)
          net = tflearn.activations.relu(net)
          net = tflearn.fully_connected(net, 300)
          net = tflearn.layers.normalization.batch_normalization(net)
          net = tflearn.activations.relu(net)
          # Final layer weights are init to Uniform[-3e-3, 3e-3]
          w_init = tflearn.initializations.uniform(minval=-0.003, maxval=0.003)
          out = tflearn.fully_connected(
              net, self.a_dim, activation='tanh', weights_init=w_init)
          # Scale output to -action_bound to action_bound
          scaled_out = tf.multiply(out, self.action_bound)
          return inputs, out, scaled_out
  </code></pre>
  
  <p>What is the equivalent command for scaling the output layer according to my requirements?</p>