File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments