<> View source code

Linear Initialization part of :
class Linear(Module): ... __constants__ = ['bias'] def __init__(self,
in_features, out_features, bias=True): super(Linear, self).__init__() self.
in_features= in_features self.out_features = out_features self.weight =
Parameter(torch.Tensor(out_features, in_features)) if bias: self.bias =
Parameter(torch.Tensor(out_features)) else: self.register_parameter('bias', None
) self.reset_parameters() ...
What needs to be achieved :
y=xAT+by = xA^T+by=xAT+b
computational procedure :
@weak_script_method def forward(self, input): return F.linear(input, self.
weight, self.bias)
What's coming back is :input * weight + bias

about weight
weight: the learnable weights of the module of shape :math:`(\text{
out\_features}, \text{in\_features})`. The values are initialized from :math:
`\mathcal{U}(-\sqrt{k}, \sqrt{k})`, where :math:`k = \frac{1}{\text{in\_features
about bias
bias: the learnable bias of the module of shape :math:`(\text{out\_features})`.
If:attr:`bias` is ``True``, the values are initialized from :math:`\mathcal{U}(
-\sqrt{k}, \sqrt{k})` where :math:`k = \frac{1}{\text{in\_features}}`
<> Case study

for instance :
>>> import torch >>> nn1 = torch.nn.Linear(100, 50) >>> input1 = torch.randn(
140, 100) >>> output1 = nn1(input1) >>> output1.size() torch.Size([140, 50])
The magnitude of the tensor is determined by 140 x 100 Become 140 x 50

The action performed is :

©2019-2020 Toolsou All rights reserved,
Digital rolling lottery program Keras Save and load model (JSON+HDF5) Remember once EventBus Project issues caused by memory leaks I've been drinking soft water for three years ? What is the use of soft water and water softener msf Generate Trojan horse attack android mobile phone Time conversion front desk will 2020-07-17T03:07:02.000+0000 Into 2020-07-17 11:07:02 Chuan Shen 1190 Reverses the substring between each pair of parentheses leetcodehive Summary of processing methods for a large number of small files SparkSQL Achieve partition overlay write Image format conversion