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()