LazyLinear
-
class torch.nn.modules.linear.LazyLinear(out_features, bias=True, device=None, dtype=None)[source] -
A
torch.nn.Linearmodule wherein_featuresis inferred.In this module, the
weightandbiasare oftorch.nn.UninitializedParameterclass. They will be initialized after the first call toforwardis done and the module will become a regulartorch.nn.Linearmodule. Thein_featuresargument of theLinearis inferred from theinput.shape[-1].Check the
torch.nn.modules.lazy.LazyModuleMixinfor further documentation on lazy modules and their limitations.- Parameters
-
- out_features (int) – size of each output sample
-
bias (UninitializedParameter) – If set to
False, the layer will not learn an additive bias. Default:True
- Variables
-
- weight (torch.nn.parameter.UninitializedParameter) – the learnable weights of the module of shape . The values are initialized from , where
-
bias (torch.nn.parameter.UninitializedParameter) – the learnable bias of the module of shape . If
biasisTrue, the values are initialized from where
-
initialize_parameters(input)[source] -
Infers
in_featuresbased oninputand initializes parameters.
-
reset_parameters()[source] -
Resets parameters based on their initialization used in
__init__.