tf.lite.experimental.Analyzer
Stay organized with collections
Save and categorize content based on your preferences.
Provides a collection of TFLite model analyzer tools.
Example:
model = tf . keras . applications . MobileNetV3Large ()
fb_model = tf . lite . TFLiteConverterV2 . from_keras_model ( model ) . convert ()
tf . lite . experimental . Analyzer . analyze ( model_content = fb_model )
# === TFLite ModelAnalyzer ===
#
# Your TFLite model has ‘1’ subgraph(s). In the subgraph description below,
# T# represents the Tensor numbers. For example, in Subgraph#0, the MUL op
# takes tensor #0 and tensor #19 as input and produces tensor #136 as output.
#
# Subgraph#0 main(T#0) -> [T#263]
# Op#0 MUL(T#0, T#19) -> [T#136]
# Op#1 ADD(T#136, T#18) -> [T#137]
# Op#2 CONV_2D(T#137, T#44, T#93) -> [T#138]
# Op#3 HARD_SWISH(T#138) -> [T#139]
# Op#4 DEPTHWISE_CONV_2D(T#139, T#94, T#24) -> [T#140]
# ...
Warning: Experimental interface, subject to change.
Methods
analyze
View source
@staticmethod
analyze (
model_path = None , model_content = None , gpu_compatibility = False , ** kwargs
)
Analyzes the given tflite_model with dumping model structure.
This tool provides a way to understand users' TFLite flatbuffer model by
dumping internal graph structure. It also provides additional features
like checking GPU delegate compatibility.
Warning: Experimental interface, subject to change.
The output format is not guaranteed to stay stable, so don't
write scripts to this.
Args
model_path
TFLite flatbuffer model path.
model_content
TFLite flatbuffer model object.
gpu_compatibility
Whether to check GPU delegate compatibility.
**kwargs
Experimental keyword arguments to analyze API.
Returns
Print analyzed report via console output.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license .
Last updated 2023-03-17 UTC.
[null,null,["Last updated 2023-03-17 UTC."],[],[],null,["# tf.lite.experimental.Analyzer\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.9.3/tensorflow/lite/python/analyzer.py#L35-L105) |\n\nProvides a collection of TFLite model analyzer tools.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.lite.experimental.Analyzer`](https://www.tensorflow.org/api_docs/python/tf/lite/experimental/Analyzer)\n\n\u003cbr /\u003e\n\n#### Example:\n\n model = tf.keras.applications.MobileNetV3Large()\n fb_model = tf.lite.TFLiteConverterV2.from_keras_model(model).convert()\n tf.lite.experimental.Analyzer.analyze(model_content=fb_model)\n # === TFLite ModelAnalyzer ===\n #\n # Your TFLite model has '1' subgraph(s). In the subgraph description below,\n # T# represents the Tensor numbers. For example, in Subgraph#0, the MUL op\n # takes tensor #0 and tensor #19 as input and produces tensor #136 as output.\n #\n # Subgraph#0 main(T#0) -\u003e [T#263]\n # Op#0 MUL(T#0, T#19) -\u003e [T#136]\n # Op#1 ADD(T#136, T#18) -\u003e [T#137]\n # Op#2 CONV_2D(T#137, T#44, T#93) -\u003e [T#138]\n # Op#3 HARD_SWISH(T#138) -\u003e [T#139]\n # Op#4 DEPTHWISE_CONV_2D(T#139, T#94, T#24) -\u003e [T#140]\n # ...\n\n| **Warning:** Experimental interface, subject to change.\n\nMethods\n-------\n\n### `analyze`\n\n[View source](https://github.com/tensorflow/tensorflow/blob/v2.9.3/tensorflow/lite/python/analyzer.py#L63-L105) \n\n @staticmethod\n analyze(\n model_path=None, model_content=None, gpu_compatibility=False, **kwargs\n )\n\nAnalyzes the given tflite_model with dumping model structure.\n\nThis tool provides a way to understand users' TFLite flatbuffer model by\ndumping internal graph structure. It also provides additional features\nlike checking GPU delegate compatibility.\n| **Warning:** Experimental interface, subject to change. The output format is not guaranteed to stay stable, so don't write scripts to this.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|---------------------|------------------------------------------------|\n| `model_path` | TFLite flatbuffer model path. |\n| `model_content` | TFLite flatbuffer model object. |\n| `gpu_compatibility` | Whether to check GPU delegate compatibility. |\n| `**kwargs` | Experimental keyword arguments to analyze API. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| Print analyzed report via console output. ||\n\n\u003cbr /\u003e"]]