lodo
lodo

Reputation: 2383

Programmatically inspect Tensorflow SavedModel

Given a large number of untrusted TensorFlow 2 models, in the SavedModel format, is there any way to inspect them in an automated way (ideally with an API, as opposed to manually inspecting them in TensorBoard), in order to check for certain characteristics, such as size of the inputs and output, type and order of the operators, or similar?

I checked the tf.saved_model module, but could not find any indication on how this can be achieved.

Upvotes: 1

Views: 703

Answers (1)

Romeo Kienzler
Romeo Kienzler

Reputation: 3539

If bash can be used instead of python do the following:

  1. git clone [email protected]:tensorflow/tensorflow.git
  2. cd tensorflow
  3. bazel build tensorflow/python/tools:saved_model_cli
  4. python tensorflow/python/tools/saved_model_cli.py show --dir /path/to/model --all

It gives you input and output types and shapes

You can find more information here

Upvotes: 1

Related Questions