# bb_inference v0.1.0 - API Reference

## Modules

- [BB.Inference](BB.Inference.md): Declares machine-learning models on a robot and runs them.
- [BB.Inference.Artefact](BB.Inference.Artefact.md): Where a model's artefact lives.
- [BB.Inference.Artefact.Placement](BB.Inference.Artefact.Placement.md): Fetches model artefacts and places them under a `priv` directory. Used by
`Mix.Tasks.Compile.BbInference`, which supplies the directories.
- [BB.Inference.Description](BB.Inference.Description.md): What a runtime could find out about a loaded model: its inputs and outputs,
in the order the model declares them.
- [BB.Inference.Description.Tensor](BB.Inference.Description.Tensor.md): One input or output of a model.
- [BB.Inference.Dsl.Model](BB.Inference.Dsl.Model.md): A `model` declared in a robot's `inference` section.
- [BB.Inference.LoadedModel](BB.Inference.LoadedModel.md): A model that has loaded and whose codec fits it, as
`BB.Inference.loaded_model/2` returns it.
- [BB.Inference.ModelCodec](BB.Inference.ModelCodec.md): Behaviour for converting to and from one artefact's conventions.
- [BB.Inference.ModelController](BB.Inference.ModelController.md): The controller each `model` is lowered into.
- [BB.Inference.ModelRef](BB.Inference.ModelRef.md): The option type behind `BB.Inference.model_ref/1`.
- [BB.Inference.Quantisation](BB.Inference.Quantisation.md): How a quantised tensor's raw integers map to real values:
`real = (raw - zero_point) * scale`.
- [BB.Inference.Runtime](BB.Inference.Runtime.md): Behaviour for loading and executing a model artefact.
- [BB.Inference.Test.Doubler](BB.Inference.Test.Doubler.md): A component that names a `:doubling` model, and runs it when called with
`{:double, values}`.

- [BB.Inference.Test.FakeCodec](BB.Inference.Test.FakeCodec.md): A `:doubling` codec: encodes a list of numbers as input `"x"`, and decodes
output `"y"` back into a list, offset by `:offset`.

- [BB.Inference.Test.FakeRuntime](BB.Inference.Test.FakeRuntime.md): A runtime that loads nothing and doubles every input it runs.
- [BB.Inference.Test.OtherTaskCodec](BB.Inference.Test.OtherTaskCodec.md): A codec for a task no test component asks for.
- [BB.Inference.Test.Reader](BB.Inference.Test.Reader.md): An estimator that names a `:doubling` model.
- [BB.Inference.Transformers.AddModelControllers](BB.Inference.Transformers.AddModelControllers.md): Checks each `model` and lowers it into a `controller` of the same name
running `BB.Inference.ModelController`.
- [BB.Inference.Transformers.ValidateModelReferences](BB.Inference.Transformers.ValidateModelReferences.md): Checks that every component option typed with `BB.Inference.model_ref/1`
names a model this robot declares, and that the model's codec performs the
task the option asks for.

- Exceptions
  - [BB.Error.Invalid.Inference.ArtefactMissing](BB.Error.Invalid.Inference.ArtefactMissing.md): A model's artefact isn't where the build should have put it.
  - [BB.Error.Invalid.Inference.CodecMismatch](BB.Error.Invalid.Inference.CodecMismatch.md): A model's codec doesn't fit the artefact the runtime loaded: it expects
inputs or outputs the model doesn't have.
  - [BB.Error.Invalid.Inference.LoadFailed](BB.Error.Invalid.Inference.LoadFailed.md): A model's runtime could not load its artefact.
  - [BB.Error.State.Inference.ModelNotRunning](BB.Error.State.Inference.ModelNotRunning.md): A component asked for a model that no process is running.
  - [BB.Error.State.Inference.ModelUnavailable](BB.Error.State.Inference.ModelUnavailable.md): A call to a model's process didn't return: it stopped while the call was
waiting - usually because it failed to load - or it didn't answer within
the call's timeout.

## Mix Tasks

- [mix bb_inference.install](Mix.Tasks.BbInference.Install.md): Installs BB.Inference into a robot
- [mix compile.bb_inference](Mix.Tasks.Compile.BbInference.md): Places every model artefact declared by a robot in this project under
`priv/bb_inference`, so it is part of the build and of any release.

