(self, summaries)
Processes all the tensors for display in tensorboard
        
        :param summaries: 
        :return:
Processes all the tensors for display in tensorboard
        
        :param summaries: 
        :return:
Processes all the tensors for display in tensorboard : param summaries : : return :
def notify(self, summaries):
        """
        Processes all the tensors for display in tensorboard
        
        :param summaries: 
        :return: 
        """
        if self.controller is not None:
            self.controller.notify(summaries[-1])

        def summary_convert(summary, title):
            tf.summary.image(title, tf.expand_dims(tf.transpose(summary, [1, 2, 0]), axis=3),
                             max_outputs=Controller.max_outputs)

        # TODO please tell me there's a smarter way to this whole method
        n = self.mem_hp.mem_size
        r = self.mem_hp.num_read_heads
        summaries[0] = tf.reshape(tf.transpose(summaries[0], [0, 1, 3, 2]), [-1, self.batch_size, n * r])
        summaries[6] = tf.reshape(summaries[6],
                                  [-1, self.batch_size, self.mem_hp.num_read_heads * self.mem_hp.word_size])
        summaries[7] = tf.reshape(summaries[7], [-1, self.batch_size, self.mem_hp.num_read_heads * 3])
        summaries[14] = tf.reshape(tf.transpose(summaries[14], [0, 1, 3, 2]), [-1, self.batch_size, n * r])
        summaries[15] = tf.reshape(tf.transpose(summaries[15], [0, 1, 3, 2]), [-1, self.batch_size, n * r])
        summaries[17] = tf.reshape(summaries[17],
                                   [-1, self.batch_size, self.mem_hp.num_read_heads * self.mem_hp.word_size])

        summary_names = ["Read_weightings",
                         "Write_weighting",
                         "Usage_vector",
                         "Precedence_weighting",
                         "Memory_matrix",
                         "Link_matrix",
                         "R_read_vectors",
                         "R_read_modes",
                         "Write_gate",
                         "Allocation_gate",
                         "Write_strength",
                         "R_read_strengths",
                         "Erase_vector",
                         "Write_vector",
                         "Forward_weighting",
                         "Backward_weighting",
                         "R_free_gates",
                         "R_read_keys",
                         "Memory_output"
                         ]
        for i, summ_name in enumerate(summary_names):
            # don't want to visualise memory and link matrices since they're too big and impractical to analyze
            # would do it if perhaps there was a way to have a 2d matrix for each time step in tensorboard... hmm image?
            if i not in [4, 5, 19]:
                summary_convert(summaries[i], summ_name)
def notify ( self , summaries ) : if self . controller is not None : self . controller . notify ( summaries [ - 1 ] ) def summary_convert ( summary , title ) : tf . summary . image ( title , tf . expand_dims ( tf . transpose ( summary , [ 1 , 2 , 0 ] ) , axis = 3 ) , max_outputs = Controller . max_outputs ) # TODO please tell me there's a smarter way to this whole method n = self . mem_hp . mem_size r = self . mem_hp . num_read_heads summaries [ 0 ] = tf . reshape ( tf . transpose ( summaries [ 0 ] , [ 0 , 1 , 3 , 2 ] ) , [ - 1 , self . batch_size , n * r ] ) summaries [ 6 ] = tf . reshape ( summaries [ 6 ] , [ - 1 , self . batch_size , self . mem_hp . num_read_heads * self . mem_hp . word_size ] ) summaries [ 7 ] = tf . reshape ( summaries [ 7 ] , [ - 1 , self . batch_size , self . mem_hp . num_read_heads * 3 ] ) summaries [ 14 ] = tf . reshape ( tf . transpose ( summaries [ 14 ] , [ 0 , 1 , 3 , 2 ] ) , [ - 1 , self . batch_size , n * r ] ) summaries [ 15 ] = tf . reshape ( tf . transpose ( summaries [ 15 ] , [ 0 , 1 , 3 , 2 ] ) , [ - 1 , self . batch_size , n * r ] ) summaries [ 17 ] = tf . reshape ( summaries [ 17 ] , [ - 1 , self . batch_size , self . mem_hp . num_read_heads * self . mem_hp . word_size ] ) summary_names = [ "Read_weightings" , "Write_weighting" , "Usage_vector" , "Precedence_weighting" , "Memory_matrix" , "Link_matrix" , "R_read_vectors" , "R_read_modes" , "Write_gate" , "Allocation_gate" , "Write_strength" , "R_read_strengths" , "Erase_vector" , "Write_vector" , "Forward_weighting" , "Backward_weighting" , "R_free_gates" , "R_read_keys" , "Memory_output" ] for i , summ_name in enumerate ( summary_names ) : # don't want to visualise memory and link matrices since they're too big and impractical to analyze # would do it if perhaps there was a way to have a 2d matrix for each time step in tensorboard... hmm image? if i not in [ 4 , 5 , 19 ] : summary_convert ( summaries [ i ] , summ_name )