The types an inference backend shares, so calling code names a backend once rather than at every call site. `API.Onnx` runs a model in-process; `API.Inference` sends it to a server. They answer the same question and neither is right for every deployment: ONNX needs a model file and a runtime for the architecture, a server is the only GPU path today, and a model that will not convert to ONNX reaches Objeck no other way (docs/INFERENCE_ENGINES_PLAN.md). This bundle exists because both previously defined their own `Tensor`. That was deliberate and temporary -- the generic ONNX run shipped before a shared library existed -- and two near-identical classes drift. They are one class now. Compile with -lib models.
Engine
A model that can be run, however it is reached. Swapping that for `HttpEngine->New("http://gpu-box:8000", "model")` changes nothing else. That is the point: the backend is a deployment decision, not an API -- and it is why dropping one costs this design nothing, as dropping TF Lite did. Preprocessing and decoding belong ABOVE this interface, written once in Objeck. Letterboxing is a property of YOLO, not of a runtime, and the eight per-family native entry points in `API.Onnx` are why a single defect in that pattern had to be fixed eight times, twice in one release. Calling code names a backend once:
Example
engine := OnnxEngine->New("model.onnx");
if(<>engine->IsOpen()) {
EndPoint->GetLastError()->PrintLine();
return;
};
outputs := engine->Run(inputs);
engine->Close();Operations
Close # virtual
Releases the model. Safe to call more than once.
method : public : virtual : Close() ~ NilIsOpen # virtual
Whether the model is loaded and a run can proceed. A backend that failed to open is not an error at construction: the constructor returns an object either way. Test this before running, or a refusal is indistinguishable from a model that produced nothing.
method : public : virtual : IsOpen() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true when a run can proceed |