View Source tflite_beam_flatbuffer_model (tflite_beam v0.3.8)
An RAII object that represents a read-only tflite model, copied from disk, or mmapped.
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.
Functions
-spec build_from_buffer(binary()) -> #tflite_beam_flatbuffer_model{initialized :: boolean(), minimum_runtime :: binary(), ref :: reference()} | {error, binary()}.
Build model from caller owned memory buffer
-spec build_from_buffer(binary(), list()) -> #tflite_beam_flatbuffer_model{initialized :: boolean(), minimum_runtime :: binary(), ref :: reference()} | {error, binary()}.
Build model from caller owned memory buffer
-spec build_from_file(list() | binary()) -> #tflite_beam_flatbuffer_model{initialized :: boolean(), minimum_runtime :: binary(), ref :: reference()} | {error, binary()}.
Build model from a given .tflite file
Positional Parameters
-spec build_from_file(list() | binary(), list()) -> #tflite_beam_flatbuffer_model{initialized :: boolean(), minimum_runtime :: binary(), ref :: reference()} | {error, binary()}.
Build model from a given .tflite file
Positional Parameters
-spec error_reporter(#tflite_beam_flatbuffer_model{initialized :: boolean(), minimum_runtime :: binary(), ref :: reference()} | reference()) -> #tflite_beam_error_reporter{ref :: reference()} | {error, binary()}.
Get the error report of the current FlatBuffer model.
Get associated file(s) from a FlatBuffer model
-spec get_minimum_runtime(#tflite_beam_flatbuffer_model{initialized :: boolean(), minimum_runtime :: binary(), ref :: reference()} | 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.
-spec initialized(#tflite_beam_flatbuffer_model{initialized :: boolean(), minimum_runtime :: binary(), ref :: reference()} | reference()) -> boolean() | {error, binary()}.
Check whether current model has been initialized
Get a list of all associated file(s) in a TFLite model file
-spec read_all_metadata(#tflite_beam_flatbuffer_model{initialized :: boolean(), minimum_runtime :: binary(), ref :: reference()} | reference()) -> map() | {error, binary()}.
Return model metadata as a mapping of name and buffer strings.
See Metadata table in TFLite schema.
-spec verify_and_build_from_file(list() | binary()) -> #tflite_beam_flatbuffer_model{initialized :: boolean(), minimum_runtime :: binary(), ref :: reference()} | {error, binary()}.
Verifies whether the content of the file is legit, then builds a model based on the file.