Try to search your question here, if you can't find : Ask Any Question Now ?

Plotting subclassed model in tensorflow-2.0 beta

HomeCategory: stackoverflowPlotting subclassed model in tensorflow-2.0 beta
Avatarcraig asked 2 weeks ago

I have a subclassed model that instantiates a few custom layers via subclassing. I tried using keras.utils.plot_model() but all it does is print the model block, none of the layers appeared.

Can a Tensorflow expert comment on this? Will this feature ever be implemented in the future? If not, what is the next best alternative to examine the computation graph? Note that model.summary() only gives a summary of the parameters of the custom layer, within which contains two dense layers. Ideally, I like to see all the computations, if that is not asking too much…

Update: I dug into the source, looks like plot_model() first check for the _is_graph_network attribute. Graph Networks are used in Functional and Sequential APIs. From the source:

Two types of Networks exist: Graph Networks and Subclass Networks. Graph
networks are used in the Keras Functional and Sequential APIs. Subclassed
networks are used when a user subclasses the Model class. In general,
more Keras features are supported with Graph Networks than with Subclassed
Networks, specifically:

  • Model cloning (keras.models.clone)
  • Serialization (model.get_config()/from_config, model.to_json()/to_yaml())
  • Whole-model saving (

Naturally, I like to know if I can build a graph network component, so my subclassed model/layer can work with these features. Does that involve a lot of effort?

(tf.function graph visualization)
Can someone let me know if graph visualization via Tensorboard works with Tensorflow2 tf.functions?

1 Answers
Best Answer
AvatarMatthias answered 2 weeks ago
Your Answer

12 + 5 =

Popular Tags

WP Facebook Auto Publish Powered By :