title: Issue with AdamOptimizer
body: <p>I'm using a simple network and i'm trying to use <strong>AdamOptimizer</strong> to <strong>minimize the loss in a Q learning contexte</strong>.</p>
  
  <p>Here the code :</p>
  
  <pre><code>### DATASET IMPORT
  from DataSet import *
  
  ### NETWORK
  state_size      = STATE_SIZE
  stack_size      = STACK_SIZE
  action_size     = ACTION_SIZE
  learning_rate   = LEARNING_RATE
  hidden_tensors  = HIDDEN_TENSORS
  gamma           = GAMMA
  
  import tensorflow as tf
  import numpy as np
  
  class NNetwork:       
      def __init__(self, name='NNetwork'):
  
          # Initialisations
          self.state_size     = state_size
          self.action_size    = action_size
          self.model          = tf.keras.models.Sequential()
          self.optimizer      = tf.keras.optimizers.Adam(learning_rate)
  
          # Network shaping
          self.model.add(tf.keras.layers.Dense(self.state_size,   activation='relu',      kernel_initializer='glorot_uniform'))
          self.model.add(tf.keras.layers.Dense(hidden_tensors,    activation='relu',      kernel_initializer='glorot_uniform'))
          self.model.add(tf.keras.layers.Dense(action_size,       activation='linear',    kernel_initializer='glorot_uniform'))
  
      # Prediction function (return Q_values)
      def get_outputs(self, inputs):
          inputs = tf.convert_to_tensor(inputs, dtype=tf.float32)
          return self.model.predict(inputs)
  
      # Optimization of the network
      def optimize(self, state, action, reward, next_state):
          next_Q_values   = self.get_outputs(next_state)
          target_Q        = reward + gamma * np.max(next_Q_values)
          curent_Q        = tf.reduce_sum(tf.multiply(self.get_outputs(state), action))
          loss           = tf.square(target_Q - curent_Q)
          self.optimizer.minimize(tf.convert_to_tensor(loss), self.model.trainable_variables)
  
  
  
  B = NNetwork('b')
  print(B.get_outputs([[0.12, 0.59]]))
  
  B.optimize([[0.12, 0.59]], [1, 0, 0, 0, 0, 0, 0], 100000000, [[0.13, 0.58]])
  print(B.get_outputs([[0.12, 0.59]]))
  </code></pre>
  
  <p><strong>So my problem is :</strong></p>
  
  <p>When i execute this code i got this :</p>
  
  <blockquote>
    <p>[[-0.00105272  0.02356465 -0.01908724 -0.03868931  0.01585<br>
    0.02427034
       0.00203115]] Traceback (most recent call last):   File ".\DQNet.py", line 69, in 
        B.optimize([[0.12, 0.59]], [1, 0, 0, 0, 0, 0, 0], 100000000, [[0.13, 0.58]])   File ".\DQNet.py", line 62, in optimize
        tf.keras.optimizers.Adam(learning_rate).minimize(tf.convert_to_tensor(10),
    self.model.trainable_variables)   File "C:\Users\Odeven poste
    1\Documents[Python-3.6.8\python-3.6.8.amd64\lib\site-packages\tensorflow\python\keras\optimizer_v2\optimizer_v2.py",
    line 296, in minimize
        loss, var_list=var_list, grad_loss=grad_loss)   File "C:\Users\Odeven poste
    1\Documents[Python-3.6.8\python-3.6.8.amd64\lib\site-packages\tensorflow\python\keras\optimizer_v2\optimizer_v2.py",
    line 328, in _compute_gradients
        loss_value = loss() TypeError: 'tensorflow.python.framework.ops.EagerTensor' object is not callable </p>
  </blockquote>
  
  <p>That mean that my network is functional because i got Q values but when i try to call my 'optimize' function i got an error on the line :</p>
  
  <pre><code>self.optimizer.minimize(tf.convert_to_tensor(loss), self.model.trainable_variables)
  </code></pre>
  
  <p>And i really don't understand why i got this error :</p>
  
  <blockquote>
    <p>'tensorflow.python.framework.ops.EagerTensor' object is not callable</p>
  </blockquote>
  
  <p>Because i'm pretty sure that the 'loss' parameter i have to give to the minimize function should be a Tensor...</p>