(self, state_dict, **kwargs)
Translates from pytorch's AlexNet parameter names
        into the custom parameter names.
Translates from pytorch's AlexNet parameter names
        into the custom parameter names.
Translates from pytorch s AlexNet parameter names into the custom parameter names .
def load_state_dict(self, state_dict, **kwargs):
        '''
        Translates from pytorch's AlexNet parameter names
        into the custom parameter names.
        '''
        custom_names = [
            ('features.0.', 'conv1.'),
            ('features.3.', 'conv2.'),
            ('features.6.', 'conv3.'),
            ('features.8.', 'conv4.'),
            ('features.10.', 'conv5.'),
            ('classifier.1.', 'fc6.'),
            ('classifier.4.', 'fc7.'),
            ('classifier.6.', 'fc8.')
        ]
        custom_state_dict = {}
        for k, v in state_dict.items():
            for op, np in custom_names:
                if k.startswith(op):
                    k = np + k[len(op):]
                    break
            custom_state_dict[k] = v
        super(CustomAlexNet, self).load_state_dict(custom_state_dict, **kwargs)
def load_state_dict ( self , state_dict , * * kwargs ) : custom_names = [ ( 'features.0.' , 'conv1.' ) , ( 'features.3.' , 'conv2.' ) , ( 'features.6.' , 'conv3.' ) , ( 'features.8.' , 'conv4.' ) , ( 'features.10.' , 'conv5.' ) , ( 'classifier.1.' , 'fc6.' ) , ( 'classifier.4.' , 'fc7.' ) , ( 'classifier.6.' , 'fc8.' ) ] custom_state_dict = { } for k , v in state_dict . items ( ) : for op , np in custom_names : if k . startswith ( op ) : k = np + k [ len ( op ) : ] break custom_state_dict [ k ] = v super ( CustomAlexNet , self ) . load_state_dict ( custom_state_dict , * * kwargs )