nngeometry/layercollection.py
def add_layer_from_model(self, model, module):
        """
        Add a layer by specifying the module corresponding
        to this layer (e.g. torch.nn.Linear or torch.nn.BatchNorm1d)

        :param model: The model defining the neural network
        :param module: The layer to be added
        """
        if module.__class__.__name__ not in \
                ['Linear', 'Conv2d', 'BatchNorm1d',
                 'BatchNorm2d', 'GroupNorm']:
            raise NotImplementedError
        for layer, mod in model.named_modules():
            if mod is module:
                self.add_layer('%s.%s' % (layer, str(mod)),
                               LayerCollection._module_to_layer(mod))

        Add a layer by specifying the module corresponding
        to this layer (e.g. torch.nn.Linear or torch.nn.BatchNorm1d)

        :param model: The model defining the neural network
        :param module: The layer to be added
        
Add a layer by specifying the module corresponding
to this layer
Add a layer by specifying the module corresponding to this layer
def add_layer_from_model(self, model, module):
        if module.__class__.__name__ not in \
                ['Linear', 'Conv2d', 'BatchNorm1d',
                 'BatchNorm2d', 'GroupNorm']:
            raise NotImplementedError
        for layer, mod in model.named_modules():
            if mod is module:
                self.add_layer('%s.%s' % (layer, str(mod)),
                               LayerCollection._module_to_layer(mod))
def add_layer_from_model ( self , model , module ) : if module . __class__ . __name__ not in [ 'Linear' , 'Conv2d' , 'BatchNorm1d' , 'BatchNorm2d' , 'GroupNorm' ] : raise NotImplementedError for layer , mod in model . named_modules ( ) : if mod is module : self . add_layer ( '%s.%s' % ( layer , str ( mod ) ) , LayerCollection . _module_to_layer ( mod ) )
Add a layer by specifying the module corresponding
to this layer (e.g.
Add a layer by specifying the module corresponding to this layer ( e . g .
"""
        Add a layer by specifying the module corresponding
        to this layer (e.g. torch.nn.Linear or torch.nn.BatchNorm1d)

        :param model: The model defining the neural network
        :param module: The layer to be added
        """
self
model
The model defining the neural network
The model defining the neural network
module
The layer to be added
The layer to be added