Error in Tensorboard's(PyTorch) add_graph

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!

you need to pass a tensor , the graph gets built by passing data thru it

import torchvision
import torch
from torch.utils.tensorboard import SummaryWriter
model = torchvision.models.resnet50(False)
writer = SummaryWriter(log_dir='graph')
writer.add_graph(model, torch.randn([1,3,224,224]))
writer.close()