View Source TFLiteElixir.FlatBufferModel (tflite_elixir v0.1.2)
Link to this section Summary
Functions
Build model from caller owned memory buffer
Raising version of buildFromBuffer/1
.
Build model from a given tflite file
Raising version of buildFromFile/1
.
Returns the minimum runtime version from the flatbuffer. This runtime version encodes the minimum required interpreter version to run the flatbuffer model. If the minimum version can't be determined, an empty string will be returned.
Raising version of getMinimumRuntime/1
.
Raising version of initialized/1
.
Return model metadata as a mapping of name & buffer strings.
Raising version of readAllMetadata/1
.
Link to this section Types
@type nif_error() :: {:error, String.t()}
Link to this section Functions
Build model from caller owned memory buffer
Note that buffer
will NOT be copied. Caller has the ensure that
the buffer lives longer than the returned reference
of TFLite.FlatBufferModel
Discussion:
We can copy the data in the NIF, but FlatBufferModel::BuildFromBuffer
always
assumes that the buffer is owner by the caller, (in this case, the binding code)
However, we would have no way to release the copied memory because we couldn't
identify if the allocation_
borrows or owns that memory.
Raising version of buildFromBuffer/1
.
Build model from a given tflite file
Note that if the tensorflow-lite library was compiled with TFLITE_MCU
,
then this function will always have return type nif_error()
Raising version of buildFromFile/1
.
Returns the minimum runtime version from the flatbuffer. This runtime version encodes the minimum required interpreter version to run the flatbuffer model. If the minimum version can't be determined, an empty string will be returned.
Note that the returned minimum version is a lower-bound but not a strict lower-bound; ops in the graph may not have an associated runtime version, in which case the actual required runtime might be greater than the reported minimum.
Raising version of getMinimumRuntime/1
.
Raising version of initialized/1
.
@spec readAllMetadata(%TFLiteElixir.FlatBufferModel{model: term()}) :: %{required(String.t()) => String.t()} | nif_error()
Return model metadata as a mapping of name & buffer strings.
See Metadata table in TFLite schema.
Raising version of readAllMetadata/1
.