def tf_q_delta(self, q_value, next_q_value, terminal, reward):
        """
        Creates the deltas (or advantage) of the Q values.

        :return: A list of deltas per action
        """
        for _ in range(util.rank(q_value) - 1):
            terminal = tf.expand_dims(input=terminal, axis=1)
            reward = tf.expand_dims(input=reward, axis=1)

        multiples = (1,) + util.shape(q_value)[1:]
        terminal = tf.tile(input=terminal, multiples=multiples)
        reward = tf.tile(input=reward, multiples=multiples)

        zeros = tf.zeros_like(tensor=next_q_value)
        next_q_value = tf.where(condition=terminal, x=zeros, y=(self.discount * next_q_value))

        return reward + next_q_value - q_value
def tf_q_delta(self, q_value, next_q_value, terminal, reward):
        """
        Creates the deltas (or advantage) of the Q values.

        :return: A list of deltas per action
        """
        for _ in range(util.rank(q_value) - 1):
            terminal = tf.expand_dims(input=terminal, axis=1)
            reward = tf.expand_dims(input=reward, axis=1)

        multiples = (1,) + util.shape(q_value)[1:]
        terminal = tf.tile(input=terminal, multiples=multiples)
        reward = tf.tile(input=reward, multiples=multiples)

        zeros = tf.zeros_like(tensor=next_q_value)
        next_q_value = tf.where(condition=terminal, x=zeros, y=(self.discount * next_q_value))

        return reward + next_q_value - q_value
def tf_q_delta ( self , q_value , next_q_value , terminal , reward ) : for _ in range ( util . rank ( q_value ) - 1 ) : terminal = tf . expand_dims ( input = terminal , axis = 1 ) reward = tf . expand_dims ( input = reward , axis = 1 ) multiples = ( 1 , ) + util . shape ( q_value ) [ 1 : ] terminal = tf . tile ( input = terminal , multiples = multiples ) reward = tf . tile ( input = reward , multiples = multiples ) zeros = tf . zeros_like ( tensor = next_q_value ) next_q_value = tf . where ( condition = terminal , x = zeros , y = ( self . discount * next_q_value ) ) return reward + next_q_value - q_value
Creates the deltas (or advantage) of the Q values.

        :return: A list of deltas per action
Creates the deltas ( or advantage ) of the Q values .