Comments (5)
@chesharma
vis_graph = make_dot((y[0], y[1], y[2]), params=dict(list(self.model.named_parameters()) ))
Genius bro! ๐ ๐ ๐ How did you notice this problem and figure it out ?
# the output of my model is a list, and its length is 40, i used this and it worked out!
vis_graph = make_dot(tuple((y[i] for i in range(40))),)
thanks @chesharma
from pytorchviz.
does your model output a list?
from pytorchviz.
@caffelearn @szagoruyko
I also encountered this problem, did you solve it๏ผ
from pytorchviz.
does your model output a list?
i also meet this problem and yes, my model output a list
could you help me? @szagoruyko
class Backbone(Module):
def __init__(self, num_layers, drop_ratio, mode='ir'):
super(Backbone, self).__init__()
assert num_layers in [50, 100, 152], 'num_layers should be 50,100, or 152'
assert mode in ['ir', 'ir_se'], 'mode should be ir or ir_se'
blocks = get_blocks(num_layers)
if mode == 'ir':
unit_module = bottleneck_IR
elif mode == 'ir_se':
unit_module = bottleneck_IR_SE
self.input_layer = Sequential(Conv2d(3, 64, (3, 3), 1, 1 ,bias=False),
BatchNorm2d(64),
PReLU(64))
self.output_layer = Sequential(BatchNorm2d(512),
Dropout(drop_ratio),
Flatten(),
Linear(512 * 7 * 7, 512),
BatchNorm1d(512))
modules = []
for block in blocks:
for bottleneck in block:
modules.append(
unit_module(bottleneck.in_channel,
bottleneck.depth,
bottleneck.stride))
self.body = Sequential(*modules)
# for MTL
self.tower = nn.Sequential(
nn.Dropout(),
nn.Linear(512, 32),
nn.ReLU(),
nn.Linear(32, 2),
)
self.towers = nn.ModuleList([self.tower for _ in range(40)])
for m in self.modules():
if isinstance(m, nn.Conv2d):
nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu')
elif isinstance(m, nn.BatchNorm2d):
nn.init.constant_(m.weight, 1)
nn.init.constant_(m.bias, 0)
def forward(self,x):
x = self.input_layer(x)
x = self.body(x)
h_shared = self.output_layer(x)
# for MTL
out = [tower(h_shared) for tower in self.towers]
return out
how do you solve this? @caffelearn @H-YunHui
from pytorchviz.
@Light-- I was able to resolve this by passing a tuple containing the output list's elements.
For example if your model has 3 outputs which you output as elements of a list called 'y', then the make_dot function would look like this:
vis_graph = make_dot((y[0], y[1], y[2]), params=dict(list(self.model.named_parameters()) ))
from pytorchviz.
Related Issues (20)
- RecursionError: maximum recursion depth exceeded in comparison HOT 6
- No text label displayed on Google Colab (Pytorch 1.8.1) HOT 1
- Add variable names to nodes HOT 5
- Incorrect graph for saved variable using custom autograd function HOT 5
- Inconsistent arrow directions for saved variables HOT 2
- Graph terminates in small horizontal bar HOT 1
- RecursionError when used on subclass of Tensor HOT 5
- Page beyond pdf interface
- Lisibility of saved tensor HOT 1
- 'NotImplementedError:' when passing multiple input to model()
- Failing on large digraph HOT 3
- torchviz module not found HOT 2
- PNG Generation HOT 7
- Plotting model HOT 1
- AttributeError in make_dot with GNN from dgl.ai HOT 1
- Supress a model/nn.module
- How to plot transformer model? (BERT Model) HOT 3
- Pytorchviz with detectron2
- My data must be some integer data๏ผhow to do
- Depends on distutils, which has been removed from python3.12 HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorchviz.