(self, step, x, output, state, all_outputs, all_summaries)
return [step + 1, x, output, state, all_outputs, new_summaries]
Replacement for the .step() method which is only usable in the tf.while_loop.
        Processes one time step of DNC and keeps track of all needed variables (including ones for visualization in tb)
        
        :param step: integer representing current time step
        :param output: tensor of shape [batch_size, out_vector_size]. Represents output for *just one* time step
        :param state: list containing [controller_state, memory_state]
        :param all_outputs: tensorarray containing all the outputs. Used for computing gradients
        :param all_summaries: all summaries that will be forwarded to the notify() method
        :return: the updated arguments of this method
Replacement for the .step() method which is only usable in the tf.while_loop.
        Processes one time step of DNC and keeps track of all needed variables (including ones for visualization in tb)
        
        :param step: integer representing current time step
        :param output: tensor of shape [batch_size, out_vector_size]. Represents output for *just one* time step
        :param state: list containing [controller_state, memory_state]
        :param all_outputs: tensorarray containing all the outputs. Used for computing gradients
        :param all_summaries: all summaries that will be forwarded to the notify() method
        :return: the updated arguments of this method
Replacement for the . step () method which is only usable in the tf . while_loop . Processes one time step of DNC and keeps track of all needed variables ( including ones for visualization in tb ) : param step : integer representing current time step : param output : tensor of shape [ batch_size out_vector_size ] . Represents output for * just one * time step : param state : list containing [ controller_state memory_state ] : param all_outputs : tensorarray containing all the outputs . Used for computing gradients : param all_summaries : all summaries that will be forwarded to the notify () method : return : the updated arguments of this method
def while_loop_step(self, step, x, output, state, all_outputs, all_summaries):
        """
        Replacement for the .step() method which is only usable in the tf.while_loop.
        Processes one time step of DNC and keeps track of all needed variables (including ones for visualization in tb)
        
        :param step: integer representing current time step
        :param output: tensor of shape [batch_size, out_vector_size]. Represents output for *just one* time step
        :param state: list containing [controller_state, memory_state]
        :param all_outputs: tensorarray containing all the outputs. Used for computing gradients
        :param all_summaries: all summaries that will be forwarded to the notify() method
        :return: the updated arguments of this method
        """
        batch_size = tf.shape(x)[0]
        x_step = x[:, step, :]
        # concatenating and flattening previous time step' read vectors with x to obtain the input vector
        read_vectors_flat = tf.reshape(state[1][6],
                                       [batch_size, self.memory.num_read_heads * self.memory.word_size])
        controller_input = tf.concat([x_step, read_vectors_flat], axis=1)
        controller_state, memory_state = state

        controller_output, controller_state = self.controller.step(controller_input, controller_state, step)
        memory_output, memory_state, extra_images = self.memory.step(controller_output, memory_state)

        # making sure the dimensions for everything align, using simple matmul for that
        output_vector = controller_output @ self.output_weights
        output = output_vector + memory_output

        state = [controller_state, memory_state]
        all_outputs = all_outputs.write(step, output)
        new_summaries = [all_summaries[i].write(step, state) for i, state in enumerate(memory_state)]
        new_summaries.extend(
            [all_summaries[len(memory_state) + i].write(step, summ_img) for i, summ_img in enumerate(extra_images)])
        new_summaries.extend([all_summaries[-2].write(step, memory_output)])
        new_summaries.extend([all_summaries[-1].write(step, controller_state)])
        return [step + 1, x, output, state, all_outputs, new_summaries]
def while_loop_step ( self , step , x , output , state , all_outputs , all_summaries ) : batch_size = tf . shape ( x ) [ 0 ] x_step = x [ : , step , : ] # concatenating and flattening previous time step' read vectors with x to obtain the input vector read_vectors_flat = tf . reshape ( state [ 1 ] [ 6 ] , [ batch_size , self . memory . num_read_heads * self . memory . word_size ] ) controller_input = tf . concat ( [ x_step , read_vectors_flat ] , axis = 1 ) controller_state , memory_state = state controller_output , controller_state = self . controller . step ( controller_input , controller_state , step ) memory_output , memory_state , extra_images = self . memory . step ( controller_output , memory_state ) # making sure the dimensions for everything align, using simple matmul for that output_vector = controller_output @ self . output_weights output = output_vector + memory_output state = [ controller_state , memory_state ] all_outputs = all_outputs . write ( step , output ) new_summaries = [ all_summaries [ i ] . write ( step , state ) for i , state in enumerate ( memory_state ) ] new_summaries . extend ( [ all_summaries [ len ( memory_state ) + i ] . write ( step , summ_img ) for i , summ_img in enumerate ( extra_images ) ] ) new_summaries . extend ( [ all_summaries [ - 2 ] . write ( step , memory_output ) ] ) new_summaries . extend ( [ all_summaries [ - 1 ] . write ( step , controller_state ) ] ) return [ step + 1 , x , output , state , all_outputs , new_summaries ]