Skip to content

Commit

Permalink
Update content src/site/notes/AI/torch/nn/linear.md
Browse files Browse the repository at this point in the history
  • Loading branch information
1024daniel committed Sep 12, 2024
1 parent 024dee5 commit fa07ebe
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/site/notes/AI/torch/nn/linear.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#linear

https://pytorch.org/docs/stable/generated/torch.nn.Linear.html
Linear的操作实际是针对输入的最后一维进行一个长度转换,转换操作由内部的weight和bias和输入的tensor进行矩阵乘操作来实现

Applies an affine linear transformation to the incoming data:
$$
Expand Down Expand Up @@ -32,7 +33,7 @@ output2 = torch.matmul(input, m.weight.t()) + m.bias
print("output1:\n", output1)
print("output2:\n", output2)

assert output1 == output2
assert torch.equal(output1, output2)


```

0 comments on commit fa07ebe

Please sign in to comment.