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
Networksexist: 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
Modelclass. In general,
more Keras features are supported with Graph Networks than with Subclassed
- Model cloning (
- Serialization (
- 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?