Dala.ML.ONNX (dala v0.0.8)

Copy Markdown View Source

Public API for ONNX operations.

This module provides ONNX functionality. On platforms where the native NIF (Dala.Ml.Onnx) is available, calls are delegated there. Otherwise, safe fallbacks are returned.

Summary

Functions

Check if ONNX is available.

Create a session from model data.

Destroy a session.

Load model from file.

Run a session.

Functions

available?()

@spec available?() :: boolean()

Check if ONNX is available.

create_session(model_data)

@spec create_session(binary()) :: {:ok, integer()} | {:error, term()} | :not_supported

Create a session from model data.

destroy_session(session_id)

@spec destroy_session(integer()) :: :ok | {:error, term()}

Destroy a session.

load_model_from_file(path)

@spec load_model_from_file(String.t()) ::
  {:ok, integer()} | {:error, term()} | :not_supported

Load model from file.

run(session_id, input)

@spec run(integer(), binary()) :: {:ok, map()} | {:error, term()} | :not_supported

Run a session.