Rate this Page

LazyLinear#

classtorch.nn.LazyLinear(out_features,bias=True,device=None,dtype=None)[source]#

Atorch.nn.Linear module wherein_features is inferred.

In this module, theweight andbias are oftorch.nn.UninitializedParameterclass. They will be initialized after the first call toforward is done and themodule will become a regulartorch.nn.Linear module. Thein_features argumentof theLinear is inferred from theinput.shape[-1].

Check thetorch.nn.modules.lazy.LazyModuleMixin for further documentationon lazy modules and their limitations.

Parameters
  • out_features (int) – size of each output sample

  • bias (UninitializedParameter) – If set toFalse, the layer will not learn an additive bias.Default:True

Variables
cls_to_become[source]#

alias ofLinear

initialize_parameters(input)[source]#

Infersin_features based oninput and initializes parameters.

reset_parameters()[source]#

Resets parameters based on their initialization used in__init__.