Can't add graph with pytorch v0.2
See original GitHub issueI tried to run this snippet:
import torch
import torch.nn as nn
from torch.autograd import Variable
from datetime import datetime
from tensorboard import SummaryWriter
x = Variable(torch.rand(10, 10), requires_grad=True)
model = nn.Linear(10, 10)
h = model(x)
writer = SummaryWriter('runs/'+datetime.now().strftime('%B%d %H:%M:%S'))
writer.add_graph(model, h)
writer.close()
but I get this error message:
Traceback (most recent call last):
File "/Users/Miguel/Documents/Unbabel/pytorch-tools/tests/test_tensorboard.py", line 16, in <module>
writer.add_graph(model, h)
File "/Users/Miguel/anaconda/envs/venv/lib/python2.7/site-packages/tensorboard/writer.py", line 259, in add_graph
self.file_writer.add_graph(graph(model, lastVar))
File "/Users/Miguel/anaconda/envs/venv/lib/python2.7/site-packages/tensorboard/graph.py", line 39, in graph
make_list_of_nodes(lastVar.grad_fn)
File "/Users/Miguel/anaconda/envs/venv/lib/python2.7/site-packages/tensorboard/graph.py", line 23, in make_list_of_nodes
inputs.append(make_name(next_fn))
File "/Users/Miguel/anaconda/envs/venv/lib/python2.7/site-packages/tensorboard/graph.py", line 12, in make_name
return id2name[id(obj.variable)]+'_'+str(id(obj.variable))
KeyError: 4654832816
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
PyTorch 2.0
PyTorch 2.x: faster, more pythonic and as dynamic as ever ... Dynamo will insert graph breaks at the boundary of each FSDP instance,...
Read more >torch.utils.tensorboard — PyTorch 1.13 documentation
Create special chart by collecting charts tags in 'scalars'. Note that this function can only be called once for each SummaryWriter() object. Because...
Read more >Transfer Learning: Adding graph to tensorboard, with the input
I cannot add this model to tensorboard to view the graph, even when I add the summary writer in the training loop. 2...
Read more >torch.fx — PyTorch 1.13 documentation
This is done so if in case the operations in graph are n-ary (e.g. add is a binary operator) the call to Proxy...
Read more >How to add graphs to hparams in tensorboard?
I'm trying to use tensorboard with pytorch and cannot find any clear documentation as to how to add graphs to the hparams dashboard....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
your solution works, but that shouldn’t make any difference lol
Since v0.2 is legacy, closing this.