LazyLinear¶
-
class
torch.nn.
LazyLinear
(out_features, bias=True, device=None, dtype=None)[source]¶ A
torch.nn.Linear
module where in_features is inferred.In this module, the weight and bias are of
torch.nn.UninitializedParameter
class. They will be initialized after the first call toforward
is done and the module will become a regulartorch.nn.Linear
module. Thein_features
argument of theLinear
is inferred from theinput.shape[-1]
.Check the
torch.nn.modules.lazy.LazyModuleMixin
for further documentation on lazy modules and their limitations.- Parameters
out_features – size of each output sample
bias – If set to
False
, the layer will not learn an additive bias. Default:True
- Variables
~LazyLinear.weight (torch.nn.parameter.UninitializedParameter) – the learnable weights of the module of shape . The values are initialized from , where
~LazyLinear.bias (torch.nn.parameter.UninitializedParameter) – the learnable bias of the module of shape . If
bias
isTrue
, the values are initialized from where
-
cls_to_become
¶ alias of
torch.nn.modules.linear.Linear