Loads an ONNX model (.onnx file) and provides a jax-js function that
evaluates it.
The returned function takes input tensors and returns output tensors.
Input tensors are consumed (their reference count decremented).
Initializers (model weights, data) are cached and reused across calls.
Run a forward pass on the model. This function is bound to this, so you
don't need to create a separate closure to pass it to transformations such
as jit() and grad().
Methods
dispose
dispose():void
Dispose of this model and free model weights.
After disposing, run() should not be called anymore, it will not be able
to find the missing variables.
Loads an ONNX model (
.onnxfile) and provides a jax-js function that evaluates it.The returned function takes input tensors and returns output tensors. Input tensors are consumed (their reference count decremented). Initializers (model weights, data) are cached and reused across calls.
Example