Skip to content

Commit c007bde

Browse files
committed
Documentation fixes
1 parent e1a8c30 commit c007bde

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,23 +36,25 @@ OCANNL is sponsored by [Ahrefs](https://ocaml.org/success-stories/peta-byte-scal
3636

3737
## Usage
3838

39-
Starting from OCANNL 0.5.2, the CUDA backend requires at least CUDA version 12.8. The Metal backend requires at least MSL version 3.1.
39+
The CUDA backend requires at least CUDA version 12.8. The Metal backend requires at least MSL version 3.1.
4040

4141
[API documentation entry point](https://ahrefs.github.io/ocannl/dev/).
4242

4343
A possible route to learning OCANNL:
4444

4545
1. Read [the introductory slides](https://ahrefs.github.io/ocannl/docs/basics_backprop_training_codegen.html).
46-
2. Get some basic grasp of the aims and design of the project by reading or skimming files in [test/](test/).
47-
3. Read the syntax extensions documentation [docs/syntax_extensions.md](docs/syntax_extensions.md).
48-
4. Read the introductory part of the shape inference documentation [docs/shape_inference.md](docs/shape_inference.md).
49-
5. Read the configuration documentation [ocannl_config.example](ocannl_config.example).
50-
6. Improve your understanding by reading or skimming: [lib/shape.mli](lib/shape.mli), [lib/tensor.mli](lib/tensor.mli), [lib/operation.ml](lib/operation.ml), [arrayjit/lib/backend_intf.ml](arrayjit/lib/backend_intf.ml), [lib/train.ml](lib/train.ml), and [lib/nn_blocks.ml](lib/nn_blocks.ml).
51-
7. Read [docs/anatomy_of_a_backend.md](arrayjit/lib/anatomy_of_a_backend.md).
52-
8. Read the implementation overview:
53-
1. Shape inference details [docs/shape_inference.md](docs/shape_inference.md).
54-
2. Backend-independent optimizations [docs/lowering_and_inlining.md](arrayjit/lib/lowering_and_inlining.md) -- _lowering_ means translating (compiling) from the high-level representation (as assignments) to the low-level representation.
55-
3. More documentation to come.
46+
2. Read [the migration guide](docs/migration_guide.md).
47+
3. Soon: [shapes and the generalized einsum beginner-to-advanced slides](https://ahrefs.github.io/ocannl/docs/shapes_and_einsum.html).
48+
4. Read the syntax extensions documentation [docs/syntax_extensions.md](docs/syntax_extensions.md).
49+
5. Read the introductory part of the shape inference documentation [docs/shape_inference.md](docs/shape_inference.md).
50+
6. Read the NN building blocks file [lib/nn_blocks.ml](lib/nn_blocks.ml).
51+
7. Skim the configuration documentation [ocannl_config.example](ocannl_config.example).
52+
8. Improve your understanding by reading or skimming: [lib/shape.mli](lib/shape.mli), [lib/tensor.mli](lib/tensor.mli), [lib/operation.ml](lib/operation.ml), [arrayjit/lib/backend_intf.ml](arrayjit/lib/backend_intf.ml), [lib/train.ml](lib/train.ml).
53+
9. Read [docs/anatomy_of_a_backend.md](arrayjit/lib/anatomy_of_a_backend.md).
54+
10. Read the implementation overview:
55+
1. The various tests.
56+
2. Shape inference details [docs/shape_inference.md](docs/shape_inference.md).
57+
3. Backend-independent optimizations [docs/lowering_and_inlining.md](arrayjit/lib/lowering_and_inlining.md) -- _lowering_ means translating (compiling) from the high-level representation (as assignments) to the low-level representation.
5658

5759
### Using the tracing debugger with CUDA computations
5860

arrayjit.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ authors: ["Lukasz Stafiniak"]
1010
license: "BSD-2-Clause"
1111
tags: ["deeplearning" "array" "jit" "CUDA" "Metal"]
1212
homepage: "https://github.com/lukstafi/ocannl"
13-
doc: "https://github.com/lukstafi/ocannl/blob/master/README.md"
13+
doc: "https://ahrefs.github.io/ocannl/docs/"
1414
bug-reports: "https://github.com/lukstafi/ocannl/issues"
1515
depends: [
1616
"ocaml" {>= "5.3.0"}

docs/migration_guide.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ This is why pooling needs a dummy constant kernel - to carry shape info between
3232
| `F.dropout(x, p=0.5)` | `dropout ~rate:0.5 () ~train_step x` | Needs train_step for PRNG |
3333
| `F.relu(x)` | `relu x` | Direct function application |
3434
| `F.softmax(x, dim=-1)` | `softmax ~spec:"... | ... -> ... d" () x` | Specify axes explicitly |
35-
| `torch.matmul(a, b)` | `a * b` or `a +* "...; ... => ..." b` | Einsum for complex cases |
35+
| `torch.matmul(a, b)` | `a * b` or `a +* "..b.. -> ..a..; ..b.. => ..a.." b` | Einsum for complex cases |
3636
| `x.mean(dim=[1,2])` | `x ++ "... | h, w, c => ... | 0, 0, c" ["h"; "w"] /. (dim h *. dim w)` | Sum then divide |
37-
| `x.sum(dim=-1)` | `x ++ "... | ... d => ... | 0"` | Reduce by summing |
37+
| `x.sum(dim=-1, keepdim=True)` | `x ++ "... | ... d => ... | ... 0"` | Reduce by summing |
38+
| `x.sum(dim=-1, keepdim=False)` | `x ++ "... | ... d => ... | ..."` | Reduce by summing |
3839

3940
## Tensor Creation Patterns
4041

@@ -138,7 +139,7 @@ OCANNL's einsum has two syntax modes:
138139

139140
2. **Multi-character mode**:
140141
- Triggered by ANY comma in the spec
141-
- Trailing commas ignored
142+
- Trailing commas ignored (can be used to trigger multi-char mode)
142143
- Identifiers can be multi-character (e.g., `height`, `width`)
143144
- Must be separated by non-alphanumeric: `,` `|` `->` `;` `=>`
144145
- Makes convolution syntax less confusing: `stride*out+kernel`
@@ -152,9 +153,8 @@ OCANNL's einsum has two syntax modes:
152153

153154
### Row Variables
154155
- `...` context-dependent ellipsis: expands to `..batch..` in batch position, `..input..` before `->`, `..output..` after `->`
155-
- `..b..` for batch axes (arbitrary number)
156-
- `..ic..`, `..oc..` for input/output channels (can be multi-dimensional)
157-
- `..spatial..` for spatial dimensions
156+
- Single-char mode example: `..b..|` for batch axes (arbitrary number)
157+
- Multi-char mode examples: `h, w, ..ic..`, `h, w, ..oc..` for input/output channels (can be multi-dimensional), `..spatial.., channel` for spatial dimensions
158158

159159
## Common Gotchas and Solutions
160160

dune-project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
(license "BSD-2-Clause")
2525

26-
(documentation https://github.com/lukstafi/ocannl/blob/master/README.md)
26+
(documentation https://ahrefs.github.io/ocannl/docs/)
2727

2828
; We give up on npy / ocannl_npy for now.
2929

neural_nets_lib.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ authors: ["Lukasz Stafiniak"]
1010
license: "BSD-2-Clause"
1111
tags: ["deeplearning" "tensor" "backprop" "jit" "CUDA" "Metal"]
1212
homepage: "https://github.com/lukstafi/ocannl"
13-
doc: "https://github.com/lukstafi/ocannl/blob/master/README.md"
13+
doc: "https://ahrefs.github.io/ocannl/docs/"
1414
bug-reports: "https://github.com/lukstafi/ocannl/issues"
1515
depends: [
1616
"ocaml" {>= "5.3.0"}

0 commit comments

Comments
 (0)