import tensorflow as tf

            # with tf.variable_scope('q_target'):
                
            with tf.variable_scope('loss'):
                self.loss = tf.reduce_mean(tf.squared_difference(self.q_target, tf.squeeze(self.Q_tot), name='TD_error'))
                # self.loss = tf.reduce_mean(tf.squared_difference(self.q_target, self.Q_tot, name='TD_error'))

            with tf.variable_scope('train'):
                self._train_op = tf.train.RMSPropOptimizer(self.lr).minimize(self.loss)

    def act(self, state):
        if np.random.uniform() > self.epsilon :# pick the argmax action
            s = np.array(state)
