title: TensorFlow - InvalidArgumentError: you must feed a value for placeholder
body: <p><strong>Edit:</strong> I've identified the following line in particular as the source of the error,</p>
  
  <pre><code>unstacked_observation_outputs = tf.nn.relu(tf.nn.xw_plus_b(unstacked_observation_outputs[
              tf.reduce_max(length(observation_history)).eval(session = self.sess) - 1], 
                  weights['second_observation'], biases['second_observation']))
  </code></pre>
  
  <p>In particular, applying <code>.eval()</code> in <code>tf.reduce_max(length(observation_history)).eval(session = self.sess) - 1</code> is the problem.</p>
  
  <p>I have two very similar classes. One called Actor() and the other Critic(). When I instantiate an actor object as follows:</p>
  
  <pre><code>class Actor(object):
  
  def __init__(self, sess, observation_dimension, action_dimension, learning_rate, tau):
  
      self.sess = sess
      self.observation_dimension = observation_dimension
      self.action_dimension = action_dimension
      self.learning_rate = learning_rate
      self.tau = tau
      self.lstm_cell = rnn.BasicLSTMCell(lstm_hidden_units)
  
      with tf.variable_scope('lstm') as scope:
          self.observation_history, self.action_history = self.depthless_lstm()
          self.network_parameters = tf.trainable_variables()
          scope.reuse_variables()
          self.target_observation_history, self.target_action_history = self.depthless_lstm()
          self.target_network_parameters = tf.trainable_variables()[len(self.network_parameters):]
  
      def depthless_lstm(self):
          state = tf.placeholder(tf.float32, [None, 3600, self.observation_dimension])
  
          weights = {
          '0': tf.get_variable('weights_0', [lstm_hidden_units, hidden_units_01], initializer = tf.random_normal_initializer()),
          '1': tf.get_variable('weights_1', [hidden_units_01, 1], initializer = tf.random_normal_initializer())
          }
          biases = {
          '0': tf.get_variable('biases_0', [hidden_units_01], initializer = tf.random_normal_initializer()),
          '1': tf.get_variable('biases_1', [1], initializer = tf.random_normal_initializer())
          }
  
          lstm_outputs, learned_state = tf.nn.dynamic_rnn(self.lstm_cell, state, dtype = tf.float32)
  
          unstacked_lstm_outputs = tf.unstack(lstm_outputs, axis = 1)
  
          list_of_hidden_01_outputs = [tf.nn.relu(tf.nn.xw_plus_b(matrix, weights['0'], biases['0'])) 
          for matrix in unstacked_lstm_outputs]
  
          actions = [tf.nn.softmax(tf.nn.xw_plus_b(matrix, weights['1'], biases['1'])) 
          for matrix in list_of_hidden_01_outputs]
  
          actions = [actions[n] for n in range(len(actions)) if (n % frequency) == 1]
  
          return state, actions
  
  actor = Actor(sess, observation_dimension, action_dimension, learning_rate, tau)
  </code></pre>
  
  <p>I don't receive any error. However, when I instantiate a critic object as follows:</p>
  
  <pre><code>class Critic(object):
  
  def __init__(self, sess, observation_dimension, action_dimension, learning_rate, tau, 
      model, number_actor_variables):
  
      self.sess = sess
      self.observation_dimension = observation_dimension
      self.action_dimension = action_dimension
      self.learning_rate = learning_rate
      self.tau = tau
  
      self.lstm_observation_cell = rnn.BasicLSTMCell(lstm_observation_units)
  
      with tf.variable_scope('next_lstm') as scope:
          self.observation_history, self.action, self.critique = self.depthless_lstm_critic()
          self.network_parameters = tf.trainable_variables()[number_actor_variables:]
          scope.reuse_variables()
          self.target_observation_history, self.target_action, self.target_critique = self.depthless_lstm_critic()
          self.target_network_parameters = tf.trainable_variables()[(len(self.network_parameters) 
              + number_actor_variables):]
  
      def depthless_lstm_critic(self):
          observation_history = tf.placeholder(tf.float32, [None, 3600, self.observation_dimension])
          action = tf.placeholder(tf.float32, [None, self.action_dimension])
  
          weights = {
          'first_observation': tf.get_variable('first_observation', [self.observation_dimension, observation_hidden_units01], 
          initializer = tf.random_normal_initializer()),
          'first_action': tf.get_variable('first_action', [self.action_dimension, action_hidden_units01], 
          initializer = tf.random_normal_initializer()),
          'second_observation': tf.get_variable('second_observation', [lstm_observation_units, observation_hidden_units02], 
          initializer = tf.random_normal_initializer()),
          'second_action': tf.get_variable('second_action', [action_hidden_units01, action_hidden_units02], 
          initializer = tf.random_normal_initializer()),
          'combined_observation': tf.get_variable('combined_observation', [observation_hidden_units02, combined_units], 
          initializer = tf.random_normal_initializer()),
          'combined_action': tf.get_variable('combined_action', [action_hidden_units02, combined_units], 
          initializer = tf.random_normal_initializer()),
          'final': tf.get_variable('final', [combined_units, 1], 
          initializer = tf.random_normal_initializer())
          }
          biases = {
          'first_observation': tf.get_variable('_first_observation', [observation_hidden_units01], 
          initializer = tf.random_normal_initializer()),
          'first_action': tf.get_variable('_first_action', [action_hidden_units01], 
          initializer = tf.random_normal_initializer()),
          'second_observation': tf.get_variable('_second_observation', [observation_hidden_units02], 
          initializer = tf.random_normal_initializer()),
          'second_action': tf.get_variable('_second_action', [action_hidden_units01], 
          initializer = tf.random_normal_initializer()),
          'combined': tf.get_variable('_combined', [combined_units], 
          initializer = tf.random_normal_initializer()),
          'final': tf.get_variable('_final', [1], 
          initializer = tf.random_normal_initializer())
          }
  
          unstacked_observation_history = tf.unstack(observation_history, axis = 1)
  
          unstacked_observation_history = [tf.nn.relu(tf.nn.xw_plus_b(vector, 
          weights['first_observation'], biases['first_observation'])) 
              for vector in unstacked_observation_history]
  
          learned_action = tf.nn.relu(tf.nn.xw_plus_b(action, weights['first_action'], biases['first_action']))
  
          stacked_observation_history = tf.stack(unstacked_observation_history, axis = 1)
  
          lstm_observation_outputs, observation_states = tf.nn.dynamic_rnn(self.lstm_observation_cell, 
          stacked_observation_history, dtype = tf.float32, 
              sequence_length = length(stacked_observation_history))
  
          unstacked_observation_outputs = tf.unstack(lstm_observation_outputs, axis = 1)
  
          unstacked_observation_outputs = tf.nn.relu(tf.nn.xw_plus_b(unstacked_observation_outputs[
              tf.reduce_max(length(observation_history)).eval(session = self.sess) - 1], 
                  weights['second_observation'], biases['second_observation']))
  
          learned_action = tf.nn.relu(tf.nn.xw_plus_b(learned_action, weights['second_action'], 
          biases['second_action']))
  
          combined_results = tf.nn.relu(tf.matmul(weights['combined_observation'], 
          unstacked_observation_outputs) + tf.nn.xw_plus_b(learned_action, weights['combined_action'], 
              biases['combined']))
  
          critique = tf.nn.xw_plus_b(combined_results, weights['final'], biases['final'])
  
          return observation_history, action, critique
  
  critic = Critic(sess, observation_dimension, action_dimension, learning_rate, tau, 
      model, number_actor_variables)
  </code></pre>
  
  <p>I get the following error message:</p>
  
  <pre><code>InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'next_lstm/Placeholder' with dtype float
  [[Node: next_lstm/Placeholder = Placeholder[dtype=DT_FLOAT, shape=[], _device="/job:localhost/replica:0/task:0/cpu:0"]()]]
  </code></pre>
  
  <p>and traceback</p>
  
  <pre><code>Caused by op 'next_lstm/Placeholder', defined at:
  File "test_critic.py", line 89, in &lt;module&gt;
  model, number_actor_variables)
  File "test_critic.py", line 15, in __init__
  self.observation_history, self.action, self.critique = 
  self.depthless_lstm_critic()
  File "test_critic.py", line 23, in depthless_lstm_critic
  observation_history = tf.placeholder(tf.float32, [None, 3600, 
  self.observation_dimension])
  </code></pre>
  
  <p>The traceback indicates the issue is with the placeholder <code>observation_history</code>. But that part of the code seems to be identical to what I wrote for the Actor() class which produces no error message. </p>