Add some documentation and test to the linear layer. (#151)

* Add some documentation and test to the linear layer.

* Layer norm doc.

* Minor tweaks.
This commit is contained in:
Laurent Mazare
2023-07-12 20:24:23 +01:00
committed by GitHub
parent f09d7e5653
commit 465fc8c0c5
5 changed files with 54 additions and 1 deletions

View File

@ -31,7 +31,9 @@ Cheatsheet:
| | Using PyTorch | Using Candle |
|------------|------------------------------------------|------------------------------------------------------------------|
| Creation | `torch.Tensor([[1, 2], [3, 4]])` | `Tensor::new(&[[1f32, 2.]], [3., 4.]], &Device::Cpu)?` |
| Creation | `torch.Tensor([[1, 2], [3, 4]])` | `Tensor::new(` |
| | | ` &[[1f32, 2.]], [3., 4.]],` |
| | | ` &Device::Cpu)?` |
| Indexing | `tensor[:, :4]` | `tensor.i((.., ..4))?` |
| Operations | `tensor.view((2, 2))` | `tensor.reshape((2, 2))?` |
| Operations | `a.matmul(b)` | `a.matmul(&b)?` |