what is the difference between static and dynamic graph?
Graphs between static and dynamic graph
Hey Amit,
The statement below define the difference between static and synamic graphs well:
For the static graphs, you should first draw the graph completely and then inject data to run (define-and-run), while using dynamic graphs the graph structure is defined on-the-fly via the actual forward computation. This is a far more natural style of programming (define-by-run).
This means that in static graphs the structure of the entire graph is well defined and only the data dependent terms get reflected as we progress while in dynamic graph the structure also get defined on the fly.
Having a static graph enables a lot of convenient operations: storing a fixed graph data structure, shipping models that are independent of code, performing graph transformations, but it is a little bit more complex than dynamic graphs (for example when implementing something like recursive neural networks). When you’re working with new architectures, you want the most flexibility possible, and these frameworks allow for that.
I hope this clears your doubt.