## models.OnnxModel


A network trained elsewhere (PyTorch, Keras), loaded from an ONNX file


Usage

``` python
models.OnnxModel()
```


and run in `float64`.

Supports the operators a tabular network exports: `Gemm`, `Linear`, `MatMul`, broadcasting arithmetic, the common activations, `Softmax`, `Concat`, `Gather` embeddings, reshapes and reductions. Anything else is refused at load, with the operators the file uses.


## Parameters


`path: str`  


## Raises


`ValueError`  
If the file cannot be read or parsed, or uses an unsupported operator.


## Attributes

| Name | Description |
|----|----|
| [inputs](#inputs) | The graph's inputs as dicts with [name](aggregate.Ledger.md#prospicio.aggregate.Ledger.name), `rank`, [shape](reserving.Triangle.md#prospicio.reserving.Triangle.shape) (sizes |
| [ops](#ops) | The operators the graph uses. |
| [outputs](#outputs) | The graph's output names. |

------------------------------------------------------------------------


#### inputs


The graph's inputs as dicts with [name](aggregate.Ledger.md#prospicio.aggregate.Ledger.name), `rank`, [shape](reserving.Triangle.md#prospicio.reserving.Triangle.shape) (sizes


`inputs: list[dict]`


the file fixes, `None` where it leaves one free) and `integer` (category codes for an embedding).


------------------------------------------------------------------------


#### ops


The operators the graph uses.


`ops: list[str]`


------------------------------------------------------------------------


#### outputs


The graph's output names.


`outputs: list[str]`


## Methods

| Name | Description |
|----|----|
| [from_bytes()](#from_bytes) | Loads a model from the bytes of an ONNX file. |
| [run()](#run) | Runs the graph. |

------------------------------------------------------------------------


#### from_bytes()


Loads a model from the bytes of an ONNX file.


Usage

``` python
from_bytes(data)
```


##### Parameters


`data: bytes`  


##### Returns


`OnnxModel`  


------------------------------------------------------------------------


#### run()


Runs the graph.


Usage

``` python
run(inputs)
```


##### Parameters


`inputs: list of (list of int, list of float)`  
One `(shape, values)` per graph input, in input order, values row-major.


##### Returns


`list of (list of int, list of float)`  
One `(shape, values)` per output.
