torchview supports several advanced visualization modes:
Rolling recursive modules
Use roll=True to visually roll/unroll recursive modules (like RNNs) instead of showing every single recursive call.
Showing hidden tensors and functions
By default, torchview hides inner tensors and module functions to keep graphs clean. To see the full computation details, set hide_inner_tensors=False and hide_module_functions=False.
Expanding nested modules
Use expand_nested=True to show nested modules with dashed borders, which is useful for complex architectures like ResNet.
# Example: Rolling recursive networks
model_graph = draw_graph(SimpleRNN(), input_size=(2, 3), graph_name='RecursiveNet', roll=True)
# Example: Showing all details
model_graph = draw_graph(MLP(), input_size=(2, 128), graph_name='MLP', hide_inner_tensors=False, hide_module_functions=False)
# Example: Expanding nested modules
model_graph = draw_graph(resnet18(), input_size=(1,3,32,32), expand_nested=True)