question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

demo_graph.py error on pytorch 0.4.0

See original GitHub issue

I tried running the demo_graph.py and got the following error.

python demo_graph.py 
Traceback (most recent call last):
  File "demo_graph.py", line 56, in <module>
    w.add_graph(model, (dummy_input, ))
  File "/home/dana/Desktop/tensorboard-pytorch/tensorboardX/writer.py", line 400, in add_graph
    self.file_writer.add_graph(graph(model, input_to_model, verbose))
  File "/home/dana/Desktop/tensorboard-pytorch/tensorboardX/graph.py", line 52, in graph
    trace, _ = torch.jit.trace(model, args)
TypeError: 'function' object is not iterable

The return of torch.jit.trace is this wrapper, from this commit

I’m using the Python 3.6 on Ubuntu 16.04

  • torch==0.4.0 built from source
  • tensorboardX==1.1
  • tensorboard==1.6.0

Edit: Updated my pytorch version

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:25 (8 by maintainers)

github_iconTop GitHub Comments

9reactions
danakianfarcommented, Mar 17, 2018

Why is this issue closed? Was anyone able to reproduce the issue with pytorch 0.4?

5reactions
WenmuZhoucommented, May 9, 2018

@lanpa I have fixed my error, the code write network to tensorboard must before model.to(device)

model = torchvision.models.AlexNet(num_classes=10)
# 准备写tensorboard, 必须放在'.to(device)'之前,不然会报错
writer = SummaryWriter()
dummy_input = torch.autograd.Variable(torch.rand(1, 3, 227, 227))
writer.add_graph(model=model, input_to_model=(dummy_input, ))

model = model.to(device)
Read more comments on GitHub >

github_iconTop Results From Across the Web

[pytorch 0.4.0] Cuda runtime error (30) after upgrading from 0.3.1
Issue description I am using python 3.6.5 on Ubuntu 14.04. I upgraded pytorch 0.4.0 via 'pip uninstall torch torchvision; pip install torch ...
Read more >
PyTorch 0.4.0 Migration Guide
Welcome to the migration guide for PyTorch 0.4.0. In this release we introduced many exciting new features and critical bug fixes, with the ......
Read more >
Failed to install(update?) pytorch 0.4.0 from 0.2.0_3
python import torch torch.version. But they always returned 0.2.0_3. So I decided to install pytorch from the source. But I got another error,...
Read more >
Previous PyTorch Versions
CUDA 10.2 # NOTE: PyTorch LTS version 1.8.2 is only supported for Python <= 3.8. ... CUDA 10.0 pip install torch==1.2.0 torchvision==0.4.0 #...
Read more >
ERROR: torch-0.4.0-cp35-cp35m-win_amd64.whl is not a ...
Trying to install pytorch package using below command but its failing to install with an error command: pip3 install ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found