Skip to content

Commit 4b4f6d7

Browse files
committed
Fix AI slop in migration guide "Inference After Training"
1 parent 06036f2 commit 4b4f6d7

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

docs/migration_guide.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -429,20 +429,23 @@ def inference(model, test_input):
429429

430430
**OCANNL:**
431431
```ocaml
432-
let inference ctx model test_input =
432+
let inference ctx model =
433433
(* Define inference computation - use %cd to avoid initialization *)
434434
let%cd output = model { test_input } in
435435
Train.set_on_host output.value;
436436
437437
(* Compile inference routine *)
438-
let infer_routine = Train.to_routine ctx IDX.empty output in
438+
let ctx, routine = Context.compile ctx output IDX.empty in
439439
440-
(* Run inference *)
441-
Tn.set_values test_input.value input_data;
442-
Train.run ctx infer_routine;
440+
fun input_data ->
441+
(* Run inference *)
442+
Tn.set_values test_input.value input_data;
443+
Train.run ctx infer_routine;
443444
444-
(* Extract predictions *)
445-
output.@{[| (* indices *) |]}
445+
(* Before OCANNL v0.7, to get all cells flattened: *)
446+
Tn.get_values output.value
447+
(* Or starting with the future OCANNL v0.7 to get a bigarray: *)
448+
Context.get ctx output.value
446449
```
447450

448451
### Key API Functions

0 commit comments

Comments
 (0)