# `SSCMEx.Engine`

SSCMA-Micro EngineCVI wrapper.

The engine is automatically garbage collected when no longer referenced.

# `resource`

```elixir
@type resource() :: reference()
```

# `t`

```elixir
@type t() :: %SSCMEx.Engine{resource: resource()}
```

# `get_input`

```elixir
@spec get_input(t(), non_neg_integer()) :: {:ok, map()} | {:error, term()}
```

Get input tensor as map with binary data.

Returns a map with keys:
- `:shape` - tensor shape as list of integers
- `:type` - tensor type atom (:u8, :s8, :f32, etc.)
- `:size` - tensor size in bytes
- `:quant_param` - quantization parameters map with `:scale` and `:zero_point`
- `:data` - tensor data as binary
- `:name` - tensor name string
- `:is_physical` - boolean atom (:true or :false)

# `get_input_num`

```elixir
@spec get_input_num(t(), String.t()) :: {:ok, integer()} | {:error, term()}
```

Get input tensor index by name.

Returns the index of the input tensor with the given name.

# `get_input_quant_param`

```elixir
@spec get_input_quant_param(t(), non_neg_integer()) :: {:ok, map()} | {:error, term()}
```

Get input quantization parameters.

Returns a map with `:scale` (float) and `:zero_point` (integer).

# `get_input_shape`

```elixir
@spec get_input_shape(t(), non_neg_integer()) :: {:ok, [integer()]} | {:error, term()}
```

Get input tensor shape as list of integers.

# `get_input_size`

```elixir
@spec get_input_size(t()) :: {:ok, non_neg_integer()} | {:error, term()}
```

Returns the number of input tensors.

# `get_output`

```elixir
@spec get_output(t(), non_neg_integer()) :: {:ok, map()} | {:error, term()}
```

Get output tensor as map with binary data.

See `get_input/2` for return format.

# `get_output_num`

```elixir
@spec get_output_num(t(), String.t()) :: {:ok, integer()} | {:error, term()}
```

Get output tensor index by name.

Returns the index of the output tensor with the given name.

# `get_output_quant_param`

```elixir
@spec get_output_quant_param(t(), non_neg_integer()) ::
  {:ok, map()} | {:error, term()}
```

Get output quantization parameters.

Returns a map with `:scale` (float) and `:zero_point` (integer).

# `get_output_shape`

```elixir
@spec get_output_shape(t(), non_neg_integer()) ::
  {:ok, [integer()]} | {:error, term()}
```

Get output tensor shape as list of integers.

# `get_output_size`

```elixir
@spec get_output_size(t()) :: {:ok, non_neg_integer()} | {:error, term()}
```

Returns the number of output tensors.

# `load`

```elixir
@spec load(t(), String.t()) :: :ok | {:error, term()}
```

Loads a model from file path.

## Examples

    :ok = SSCMEx.Engine.load(engine, "/path/to/model.cvimodel")

# `new`

```elixir
@spec new() :: {:ok, t()} | {:error, term()}
```

Creates and initializes a new CVI engine.

## Examples

    {:ok, engine} = SSCMEx.Engine.new()

# `run`

```elixir
@spec run(t()) :: :ok | {:error, term()}
```

Run inference (blocking, uses dirty CPU scheduler).

After calling this function, output tensors will contain the inference results.

# `set_input`

```elixir
@spec set_input(t(), non_neg_integer(), binary()) :: :ok | {:error, term()}
```

Set input tensor data from binary.

The binary size must match the expected tensor size exactly.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
