szagoruyko / pytorchviz

A small package to create visualizations of PyTorch execution graphs
MIT License
3.24k stars 279 forks source link

TypeError: unhashable type: 'list' #56

Closed ccl-private closed 3 years ago

ccl-private commented 3 years ago

import torch import torchvision from torchviz import make_dot

model = torchvision.models.detection.retinanet_resnet50_fpn(pretrained=True) model = model model.eval() x = [torch.rand(3, 300, 400)] predictions = model(x) print(predictions)

g = make_dot(predictions) g.render('espnet_model', view=False)

ccl-private commented 3 years ago

the official example of PyTorch failed.

ccl-private commented 3 years ago

https://pytorch.org/vision/stable/models.html#retinanet

albanD commented 3 years ago

Hi,

The make_dot function expects either a Tensor or a tuple of Tensors as input. You're giving it a list of dictionaries right now.

ccl-private commented 3 years ago

thank you~

lsdrfrx commented 8 months ago

I'm sorry for necrobump. My problem is relevant I'm training SSD model for object detection, which outputs dictionary like:

{
    "boxes": [],
    "scores": [],
    "labels": [],
}

How I can visualize this model? The problem is same:

TypeError: unhashable type: 'list'