(self, sequential, share_weights=False)
Creates a subsequence of a pytorch Sequential model, copying over
        modules together with parameters for the subsequence.  Only
        modules from first_layer to last_layer (inclusive) are included.

        If share_weights is True, then references the original modules
        and their parameters without copying them.  Otherwise, by default,
        makes a separate brand-new copy.
Creates a subsequence of a pytorch Sequential model, copying over
        modules together with parameters for the subsequence.  Only
        modules from first_layer to last_layer (inclusive) are included.
Creates a subsequence of a pytorch Sequential model copying over modules together with parameters for the subsequence . Only modules from first_layer to last_layer ( inclusive ) are included .
def __init__(self, sequential, share_weights=False):
        '''
        Creates a subsequence of a pytorch Sequential model, copying over
        modules together with parameters for the subsequence.  Only
        modules from first_layer to last_layer (inclusive) are included.

        If share_weights is True, then references the original modules
        and their parameters without copying them.  Otherwise, by default,
        makes a separate brand-new copy.
        '''
        included_children = OrderedDict()
        for name, layer in sequential._modules.items():
            included_children[name] = layer if share_weights else (
                        copy.deepcopy(layer))
        if not len(included_children):
            raise ValueError('Empty subsequence')
        super().__init__(OrderedDict(included_children))
def __init__ ( self , sequential , share_weights = False ) : included_children = OrderedDict ( ) for name , layer in sequential . _modules . items ( ) : included_children [ name ] = layer if share_weights else ( copy . deepcopy ( layer ) ) if not len ( included_children ) : raise ValueError ( 'Empty subsequence' ) super ( ) . __init__ ( OrderedDict ( included_children ) )