Block.collect_params¶
-
Block.collect_params(self, select=None)¶ Returns a
ParameterDictcontaining thisBlockand all of its children’s Parameters(default), also can returns the selectParameterDictwhich match some given regular expressions.For example, collect the specified parameters in [‘conv1_weight’, ‘conv1_bias’, ‘fc_weight’, ‘fc_bias’]:
model.collect_params('conv1_weight|conv1_bias|fc_weight|fc_bias')
or collect all parameters whose names end with ‘weight’ or ‘bias’, this can be done using regular expressions:
model.collect_params('.*weight|.*bias')
Parameters: - select : str
regular expressions
Returns: - The selected
ParameterDict