View Source tflite_beam_flatbuffer_model (tflite_beam v0.3.5)

An RAII object that represents a read-only tflite model, copied from disk, or mmapped.

Link to this section Summary

Functions

Build model from caller owned memory buffer
Build model from caller owned memory buffer

Build model from a given .tflite file

Build model from a given .tflite file

Get the error report of the current FlatBuffer model.
Get associated file(s) from a FlatBuffer model

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.

Check whether current model has been initialized
Get a list of all associated file(s) in a TFLite model file

Return model metadata as a mapping of name and buffer strings.

Verifies whether the content of the file is legit, then builds a model based on the file.

Link to this section Functions

Link to this function

build_from_buffer(Buffer)

View Source
-spec build_from_buffer(binary()) -> #tflite_beam_flatbuffer_model{} | {error, binary()}.
Build model from caller owned memory buffer
Link to this function

build_from_buffer(Buffer, Opts)

View Source
-spec build_from_buffer(binary(), list()) -> #tflite_beam_flatbuffer_model{} | {error, binary()}.
Build model from caller owned memory buffer
Link to this function

build_from_file(Filename)

View Source
-spec build_from_file(list() | binary()) -> #tflite_beam_flatbuffer_model{} | {error, binary()}.

Build model from a given .tflite file

Positional Parameters
Link to this function

build_from_file(Filename, Opts)

View Source
-spec build_from_file(list() | binary(), list()) -> #tflite_beam_flatbuffer_model{} | {error, binary()}.

Build model from a given .tflite file

Positional Parameters
Link to this function

error_reporter(Tflite_beam_flatbuffer_model)

View Source
-spec error_reporter(#tflite_beam_flatbuffer_model{} | reference()) ->
                  #tflite_beam_error_reporter{} | {error, binary()}.
Get the error report of the current FlatBuffer model.
Link to this function

get_associated_file(Buffer, Filename)

View Source
-spec get_associated_file(binary(), [binary()] | binary()) -> map() | binary() | {error, binary()}.
Get associated file(s) from a FlatBuffer model
Link to this function

get_minimum_runtime(Tflite_beam_flatbuffer_model)

View Source
-spec get_minimum_runtime(#tflite_beam_flatbuffer_model{} | reference()) -> binary() | {error, binary()}.

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.
Link to this function

initialized(Tflite_beam_flatbuffer_model)

View Source
-spec initialized(#tflite_beam_flatbuffer_model{} | reference()) -> boolean() | {error, binary()}.
Check whether current model has been initialized
Link to this function

list_associated_files(Buffer)

View Source
-spec list_associated_files(binary()) -> [binary()] | {error, binary()}.
Get a list of all associated file(s) in a TFLite model file
Link to this function

read_all_metadata(Tflite_beam_flatbuffer_model)

View Source
-spec read_all_metadata(#tflite_beam_flatbuffer_model{} | reference()) -> map() | {error, binary()}.

Return model metadata as a mapping of name and buffer strings.

See Metadata table in TFLite schema.
Link to this function

verify_and_build_from_file(Filename)

View Source
-spec verify_and_build_from_file(list() | binary()) ->
                              #tflite_beam_flatbuffer_model{} | {error, binary()}.

Verifies whether the content of the file is legit, then builds a model based on the file.

Positional Parameters
Link to this function

verify_and_build_from_file(Filename, Opts)

View Source
-spec verify_and_build_from_file(list() | binary(), list()) ->
                              #tflite_beam_flatbuffer_model{} | invalid | {error, binary()}.