mert-kurttutan / torchview

torchview: visualize pytorch models
https://torchview.dev
MIT License
822 stars 37 forks source link

Visualize weights and biases in the graph #100

Open miccio-dk opened 1 year ago

miccio-dk commented 1 year ago

Is your feature request related to a problem? Please describe. I'm implementing a quantization scheme that performs some manipulation of a layer's weights using a separate module and that module does not appear in the graph (since it's not directly connected to an input).

Describe the solution you'd like I'd like to be able to specify (using a flag-like argument to draw_graph e.g. hide_model_weights=True) whether I want to visualize the weights, biases, kernels, and other trainable parameters in the graph, ideally as additional connections to a given layer. E.g.: currently, a nn.Linear layer (y = Wx + b) only shows one connection (to its input). I'd like it to feature 3 connections: one for x, one for W, and one for b, each pointing to a "param-tensor" with its dimensions specified (in a different color than "input-trensor")

Describe alternatives you've considered I can't think of any viable alternative to this.