Getting all tensor names from .tflite files

538 views
Skip to first unread message

Vishal Menon

unread,
Aug 27, 2021, 3:21:50 AM8/27/21
to TensorFlow Lite
model_design.jpg
This was the model that I had designed and converted to .tflite file.

When I tried to view the name of the tensors using the get_tensor_details() function, I was not able to find the tensor "sequential/dense_4/Sigmoid".
I know that the Identity tensor is exactly the same as "sequential/dense_4/Sigmoid", but is there some to get the activation function of the last layer?
Tensor names.jpg
Thanks in advance.
Vishal

Vishal Menon

unread,
Aug 27, 2021, 3:23:57 AM8/27/21
to TensorFlow Lite, Vishal Menon
I just want to get the architecture information(what layers are used, which activations were used in each layer etc) from the .tflite file.
How could it be possible?

Tei (Taehee) Jeong

unread,
Aug 27, 2021, 4:45:40 AM8/27/21
to Vishal Menon, TensorFlow Lite
Hi Vishal,

Please refer here for visualization and inspection options: https://www.tensorflow.org/lite/guide/faq#how_do_i_inspect_a_tflite_file

-Tei

--
You received this message because you are subscribed to the Google Groups "TensorFlow Lite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tflite+un...@tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tflite/9bcf2fc7-3b7a-41a2-975c-f7383c53aca1n%40tensorflow.org.

Vishal Menon

unread,
Aug 27, 2021, 5:32:39 AM8/27/21
to TensorFlow Lite, tae...@google.com, TensorFlow Lite, Vishal Menon
Both the netron and visualization.py provides the graphical representation, right?
But I would like to get layer information printed. Are there some functions that I could call?

Tei (Taehee) Jeong

unread,
Aug 27, 2021, 6:33:22 AM8/27/21
to Vishal Menon, TensorFlow Lite
I think you can call Interpreter._get_ops_details() and print corresponding tensors with their in/out indices. Not sure if there's easier way to do this.

-Tei

Vishal Menon

unread,
Aug 27, 2021, 7:02:42 AM8/27/21
to TensorFlow Lite, tae...@google.com, TensorFlow Lite, Vishal Menon
Thanks a lot!
Reply all
Reply to author
Forward
0 new messages