waleedka / hiddenlayer

Neural network graphs and training metrics for PyTorch, Tensorflow, and Keras.
MIT License
1.79k stars 266 forks source link

Horizontal view ? #24

Closed theevann closed 5 years ago

theevann commented 5 years ago

Is it possible to get a horizontal view of the network graph ?

waleedka commented 5 years ago

Yes. Find the build_dot() method in graph.py. There it creates the dot object and sets its attributes for the graph level, node level, and edge level. Add rankdir="LR" to the attributes at the graph level. That should do it.

andraspalffy commented 5 years ago

Just to make it easy for anyone who finds this later:

graph = hl.build_graph(model, torch.zeros([1, 1, 64, 64, 64]))
dot=graph.build_dot()
dot.attr("graph", rankdir="TD") #Topdown
dot.attr("graph", rankdir="LR") #Left-Right
waleedka commented 5 years ago

Thanks, @paland3 . That's a better solution than the one I suggested.