View Source TFLiteElixir (tflite_elixir v1.0.0-rc1)
This module contains some helper functions from the tflite
namespace in TensorFlow Lite's codebase.
Summary
Functions
Prints a dump of what tensors and what nodes are in the interpreter.
Resets a variable tensor to the default value.
Which source tree the loaded shared object was built from. Answers :litert.
The TensorFlow release this build pulled in, for example "2.21.0-rc0".
The version of the TfLite sources this was built from, for example "2.2.0".
Functions
@spec print_interpreter_state(reference()) :: nil
Prints a dump of what tensors and what nodes are in the interpreter.
Note that this function directly prints to stdout
@spec reset_variable_tensor( %TFLiteElixir.TFLiteTensor{ index: term(), name: term(), quantization_params: term(), reference: term(), shape: term(), shape_signature: term(), sparsity_params: term(), type: term() } | reference() ) :: :ok | {:error, String.t()}
Resets a variable tensor to the default value.
@spec source_tree() :: :litert
Which source tree the loaded shared object was built from. Answers :litert.
There is no other answer: the C++ behind it names a type only LiteRT's schema defines, so a binary built from anything else does not compile, and a release from before the move has no such function at all. Worth asking in a test rather than trusting the build, because a stale precompiled artifact looks exactly like a fresh one from the outside.
@spec tensorflow_version() :: String.t()
The TensorFlow release this build pulled in, for example "2.21.0-rc0".
TensorFlow is not where the runtime comes from any more: LiteRT reaches into it
for compiler/mlir/lite, TSL and XLA. Worth having when something reads wrong,
not for matching a plugin against.
@spec tflite_version() :: String.t()
The version of the TfLite sources this was built from, for example "2.2.0".
Since the runtime moved to LiteRT's tflite subtree this is LiteRT's version,
not TensorFlow's. The two are separate version lines and the numbers are not
comparable: LiteRT's 2.2.0 is newer than TensorFlow's 2.21.0, not older. For
the TensorFlow release the build borrowed from, see tensorflow_version/0.
This is the number a delegate plugin has to match. A plugin loaded through
TFLiteElixir.Delegate.external/1 must have been built from the same release;
upstream offers no binary stable delegate interface, so a mismatch is undefined
behaviour rather than an error.