models/dense_net.py
def _prune_kernels_in_last_layer(self, kernels_to_prune):
        """
        Prune some convolution kernels in the current last (composite) layer.
        The specific kernels to be pruned are given as a list (the
        kernels_to_prune parameter).

        Args:
            kernels_to_prune: `list` of `int`, gives the specific kernels (i.e.
                convolutions) to prune in the last layer.
        """
        # Safely access the current block's variable scope.
        with tf.variable_scope(self.current_block,
                               auxiliary_name_scope=False) as cblock_scope:
            with tf.name_scope(cblock_scope.original_name_scope):
                # Remove the kernels, save the new relevant inputs and outputs.
                self.output = self.remove_kernels_from_layer(
                    self.input_lt_lay, self.input_lt_cnv,
                    self.layer_num_list[-1]-1, kernels_to_prune)

        # Delete the last cross-entropy from the list, we will recreate it.
        del self.cross_entropy[-1]

        print("PRUNED KERNELS (%s) IN LAYER #%d (BLOCK #%d)! "
              "It now has got %d kernels." %
              (', '.join(map(str, kernels_to_prune)),
               self.layer_num_list[-1]-1, self.total_blocks-1,
               len(self.kernels_ref_list[-1][-1])))

        # Register which kernels were pruned in the ft-logs.
        if self.should_save_ft_logs:
            self.feature_writer.write(
                '\"Pruned: {}\"\n'.format(kernels_to_prune))

        self._define_end_graph_operations(preserve_transition=True,
                                          kernels_to_prune=kernels_to_prune)
        self._initialize_uninitialized_variables()
        self._count_trainable_params_in_use()

        Prune some convolution kernels in the current last (composite) layer.
        The specific kernels to be pruned are given as a list (the
        kernels_to_prune parameter).

        Args:
            kernels_to_prune: `list` of `int`, gives the specific kernels (i.e.
                convolutions) to prune in the last layer.
        
Prune some convolution kernels in the current last (composite) layer.
The specific kernels to be pruned are given as a list (the
kernels_to_prune parameter).
Prune some convolution kernels in the current last ( composite ) layer . The specific kernels to be pruned are given as a list ( the kernels_to_prune parameter ) .
def _prune_kernels_in_last_layer(self, kernels_to_prune):
        with tf.variable_scope(self.current_block,
                               auxiliary_name_scope=False) as cblock_scope:
            with tf.name_scope(cblock_scope.original_name_scope):
                self.output = self.remove_kernels_from_layer(
                    self.input_lt_lay, self.input_lt_cnv,
                    self.layer_num_list[-1]-1, kernels_to_prune)
        del self.cross_entropy[-1]
        print("PRUNED KERNELS (%s) IN LAYER #%d (BLOCK #%d)! "
              "It now has got %d kernels." %
              (', '.join(map(str, kernels_to_prune)),
               self.layer_num_list[-1]-1, self.total_blocks-1,
               len(self.kernels_ref_list[-1][-1])))
        if self.should_save_ft_logs:
            self.feature_writer.write(
                '\"Pruned: {}\"\n'.format(kernels_to_prune))
        self._define_end_graph_operations(preserve_transition=True,
                                          kernels_to_prune=kernels_to_prune)
        self._initialize_uninitialized_variables()
        self._count_trainable_params_in_use()
def _prune_kernels_in_last_layer ( self , kernels_to_prune ) : with tf . variable_scope ( self . current_block , auxiliary_name_scope = False ) as cblock_scope : with tf . name_scope ( cblock_scope . original_name_scope ) : self . output = self . remove_kernels_from_layer ( self . input_lt_lay , self . input_lt_cnv , self . layer_num_list [ - 1 ] - 1 , kernels_to_prune ) del self . cross_entropy [ - 1 ] print ( "PRUNED KERNELS (%s) IN LAYER #%d (BLOCK #%d)! " "It now has got %d kernels." % ( ', ' . join ( map ( str , kernels_to_prune ) ) , self . layer_num_list [ - 1 ] - 1 , self . total_blocks - 1 , len ( self . kernels_ref_list [ - 1 ] [ - 1 ] ) ) ) if self . should_save_ft_logs : self . feature_writer . write ( '\"Pruned: {}\"\n' . format ( kernels_to_prune ) ) self . _define_end_graph_operations ( preserve_transition = True , kernels_to_prune = kernels_to_prune ) self . _initialize_uninitialized_variables ( ) self . _count_trainable_params_in_use ( )
Prune some convolution kernels in the current last (composite) layer.
Prune some convolution kernels in the current last ( composite ) layer .
"""
        Prune some convolution kernels in the current last (composite) layer.
        The specific kernels to be pruned are given as a list (the
        kernels_to_prune parameter).

        Args:
            kernels_to_prune: `list` of `int`, gives the specific kernels (i.e.
                convolutions) to prune in the last layer.
        """ # Safely access the current block's variable scope. # Remove the kernels, save the new relevant inputs and outputs. # Delete the last cross-entropy from the list, we will recreate it. # Register which kernels were pruned in the ft-logs.
self
kernels_to_prune
`list` of `int`, gives the specific kernels  to prune in the last layer.
` list ` of ` int ` gives the specific kernels to prune in the last layer .