models/dense_net.py
def process_filter(self, filter, block_num, filter_num, epoch):
        """
        Process a given convolution filter's kernel weights, in some cases
        save a representation of the filter and its weights as a PNG image.
        Returns a list with the connection strengths (CS) for connections
        between any given layer l and each past layer s.

        Args:
            filter: tensor, the filter whose kernel weights are processed;
            block_num: `int`, identifier number for the filter's block;
            filter_num: `int`, identifier for the filter within the block;
            epoch: `int`, current training epoch (or batch).
        """
        # get an array representation of the filter, then get its dimensions
        f_image = self.sess.run(filter)
        f_d = filter.get_shape().as_list()
        f_image = f_image.transpose()
        f_image = np.moveaxis(f_image, [0, 1], [1, 0])

        # calculate connection strength for all connections
        cs_list = self.get_cs_list(f_image, filter_num)

        if self.should_save_images:
            # properly place the kernels to save the filter as an image
            f_image = np.moveaxis(f_image, [1, 2], [0, 1])
            f_image = np.resize(f_image, (f_d[1]*f_d[3], f_d[0]*f_d[2]))

            # save the image in the proper file
            im_filepath = './%s/block_%d_filter_%d' % (
                self.images_path, block_num, filter_num)
            os.makedirs(im_filepath, exist_ok=True)
            im_filepath += '/epoch_%d.png' % epoch
            scipy.misc.imsave(im_filepath, f_image)

        return cs_list

        Process a given convolution filter's kernel weights, in some cases
        save a representation of the filter and its weights as a PNG image.
        Returns a list with the connection strengths (CS) for connections
        between any given layer l and each past layer s.

        Args:
            filter: tensor, the filter whose kernel weights are processed;
            block_num: `int`, identifier number for the filter's block;
            filter_num: `int`, identifier for the filter within the block;
            epoch: `int`, current training epoch (or batch).
        
Process a given convolution filter's kernel weights, in some cases
save a representation of the filter and its weights as a PNG image.
Returns a list with the connection strengths (CS) for connections
between any given layer l and each past layer s.
Process a given convolution filter ' s kernel weights in some cases save a representation of the filter and its weights as a PNG image . Returns a list with the connection strengths ( CS ) for connections between any given layer l and each past layer s .
def process_filter(self, filter, block_num, filter_num, epoch):
        f_image = self.sess.run(filter)
        f_d = filter.get_shape().as_list()
        f_image = f_image.transpose()
        f_image = np.moveaxis(f_image, [0, 1], [1, 0])
        cs_list = self.get_cs_list(f_image, filter_num)
        if self.should_save_images:
            f_image = np.moveaxis(f_image, [1, 2], [0, 1])
            f_image = np.resize(f_image, (f_d[1]*f_d[3], f_d[0]*f_d[2]))
            im_filepath = './%s/block_%d_filter_%d' % (
                self.images_path, block_num, filter_num)
            os.makedirs(im_filepath, exist_ok=True)
            im_filepath += '/epoch_%d.png' % epoch
            scipy.misc.imsave(im_filepath, f_image)
        return cs_list
def process_filter ( self , filter , block_num , filter_num , epoch ) : f_image = self . sess . run ( filter ) f_d = filter . get_shape ( ) . as_list ( ) f_image = f_image . transpose ( ) f_image = np . moveaxis ( f_image , [ 0 , 1 ] , [ 1 , 0 ] ) cs_list = self . get_cs_list ( f_image , filter_num ) if self . should_save_images : f_image = np . moveaxis ( f_image , [ 1 , 2 ] , [ 0 , 1 ] ) f_image = np . resize ( f_image , ( f_d [ 1 ] * f_d [ 3 ] , f_d [ 0 ] * f_d [ 2 ] ) ) im_filepath = './%s/block_%d_filter_%d' % ( self . images_path , block_num , filter_num ) os . makedirs ( im_filepath , exist_ok = True ) im_filepath += '/epoch_%d.png' % epoch scipy . misc . imsave ( im_filepath , f_image ) return cs_list
Process a given convolution filter's kernel weights, in some cases
save a representation of the filter and its weights as a PNG image.
Process a given convolution filter ' s kernel weights in some cases save a representation of the filter and its weights as a PNG image .
"""
        Process a given convolution filter's kernel weights, in some cases
        save a representation of the filter and its weights as a PNG image.
        Returns a list with the connection strengths (CS) for connections
        between any given layer l and each past layer s.

        Args:
            filter: tensor, the filter whose kernel weights are processed;
            block_num: `int`, identifier number for the filter's block;
            filter_num: `int`, identifier for the filter within the block;
            epoch: `int`, current training epoch (or batch).
        """ # get an array representation of the filter, then get its dimensions # calculate connection strength for all connections # properly place the kernels to save the filter as an image # save the image in the proper file
self
filter
tensor, the filter whose kernel weights are processed.
tensor the filter whose kernel weights are processed .
block_num
`int`, identifier number for the filter's block.
` int ` identifier number for the filter ' s block .
filter_num
`int`, identifier for the filter within the block.
` int ` identifier for the filter within the block .
epoch
`int`, current training epoch (or batch).
` int ` current training epoch ( or batch ) .