szagoruyko / pytorchviz

A small package to create visualizations of PyTorch execution graphs
MIT License
3.24k stars 279 forks source link

TypeError: unhashable type: 'list' #7

Closed plusczh closed 6 years ago

plusczh commented 6 years ago

File "F:\Anaconda3\lib\site-packages\torchviz\dot.py", line 38, in add_nodes if var not in seen: TypeError: unhashable type: 'list'

DoHoNi commented 2 years ago

I got a similar issue. How did you solve it?

x = torch.randn(1,3,640,640)
model = model.float()
params = dict(model.named_parameters())
make_dot(model(x), params=params).render("graph", format="png")

Traceback (most recent call last): File "test_model.py", line 17, in make_dot(model(x), params=dict(model.named_parameters())).render("graph", format="png") File "/opt/conda/lib/python3.8/site-packages/torchviz/dot.py", line 161, in make_dot add_base_tensor(v) File "/opt/conda/lib/python3.8/site-packages/torchviz/dot.py", line 146, in add_base_tensor if var in seen: TypeError: unhashable type: 'list'