WeightMixin¶
- class WeightMixin(weight: Tensor, requires_grad: bool = False)[source]¶
Bases:
objectMixin for connections with weights.
- Parameters:
weight (torch.Tensor) – initial connection weights.
requires_grad (bool, optional) – if the parameters created require gradients. Defaults to
False.
Caution
This must be added to a class which inherits from
Module, and the constructor for this mixin must be called after the module constructor.Note
This registers a parameter
weight_.- property weight: Parameter¶
Learnable connection weights.
- Parameters:
value (torch.Tensor | nn.Parameter) – new weights.
- Returns:
present weights.
- Return type: