7

I'm following this Pytorch's Tensorboard documentation.

I have the following code:

model = torchvision.models.resnet50(False)
writer.add_graph(model)

It throws the following error:

_ = model(*args) # don't catch, just print the error message

TypeError: ResNet object argument after * must be an iterable, not NoneType

I don't know what I'm doing wrong here!

Community
  • 1
  • 1
paul-shuvo
  • 1,874
  • 4
  • 33
  • 37

1 Answers1

8

I had this problem too..

Passing an input_to_model parameter different from None solved the problem. However, I though it should be optional

dataiter = iter(trainloader)
images, labels = dataiter.next()
writer.add_graph(model, images)
Bernardo Peters
  • 163
  • 2
  • 9
  • 2
    I can't be optional as tb tends to give output shapes at the end of each node. This means, it is necessary that a sample input be given – Yesh Apr 28 '20 at 14:57