Why do we need the second parameter for add_graph() when using tensorboard?

As we know, there are two parameters for add_graph(), a first parameter is an object of the model that we want to visualize, and the second parameter is just an input for the model. The input can be quite casual, i.e., we can simply randomly generate an input with the shape we want and feed it to add_graph(). So what’s the point to have the input as a parameter? It seems to me that this parameter only provides the shape information of an input tensor, but we can directly get this information from the model definition, right? And no matter what input we feed to add_graph(), the computation graph printed by tensorboard is always the same. I am really confused about this.

1 Like