tensorboardX: add_graph() show error 'torch._C.Value' object has no attribute 'uniqueName' with torch 1.2.0
Describe the bug add_graph() with torch 1.2.0 will show error ‘torch._C.Value’ object has no attribute ‘uniqueName’ but work well with torch 1.1.0
Minimal runnable code to reproduce the behavior
from tensorboardX import SummaryWriter
class LeNet(nn.Module):
def __init__(self):
super(LeNet, self).__init__()
self.conv1 = nn.Sequential( #input_size=(1*28*28)
nn.Conv2d(1, 6, 5, 1, 2),
nn.ReLU(), #(6*28*28)
nn.MaxPool2d(kernel_size=2, stride=2), #output_size=(6*14*14)
)
self.conv2 = nn.Sequential(
nn.Conv2d(6, 16, 5),
nn.ReLU(), #(16*10*10)
nn.MaxPool2d(2, 2) #output_size=(16*5*5)
)
self.fc1 = nn.Sequential(
nn.Linear(16 * 5 * 5, 120),
nn.ReLU()
)
self.fc2 = nn.Sequential(
nn.Linear(120, 84),
nn.ReLU()
)
self.fc3 = nn.Linear(84, 10)
def forward(self, x):
x = self.conv1(x)
x = self.conv2(x)
x = x.view(x.size()[0], -1)
x = self.fc1(x)
x = self.fc2(x)
x = self.fc3(x)
return x
dummy_input = torch.rand(13, 1, 28, 28)
model = LeNet()
with SummaryWriter(comment='Net', log_dir='/output') as w:
w.add_graph(model, (dummy_input, ))
Expected behavior
Screenshots
Environment
Python environment Python 3.6
Additional context Add any other context about the problem here.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 5
- Comments: 18 (4 by maintainers)
Commits related to this issue
- fix #483 — committed to lanpa/tensorboardX by lanpa 5 years ago
- pytorch 1.3 and torchvision 0.4: initial adaptations 1. change requirements.txt (new version numbers for pytorch and torchvision) 2. Change onnx op.uniqueName to op.debugName See: https://github.com/... — committed to IntelLabs/distiller by nzmora 5 years ago
- Merge pytorch 1.3 commits pytorch 1.3 and torchvision 0.4: initial adaptations 1. change requirements.txt (new version numbers for pytorch and torchvision) 2. Change onnx op.uniqueName to op.debugNa... — committed to soumendukrg/distiller by nzmora 5 years ago
same with python=3.7.4, torch=1.2.0
try to build from source with :
I assume this commit break this https://github.com/pytorch/pytorch/commit/f7b2778cb1db148f1c901ea08abcbfa0e0a78f44#diff-284de3c993add230888834d04a67d666
Now is
debugNameinstead ofuniqueNamehttps://github.com/pytorch/pytorch/blob/master/torch/utils/tensorboard/_pytorch_graph.py#L19@lanpa tensorboardX will not show any error if I follow your fix.
Since pytorch 1.3 is officially released and works with tensorboardX 1.9, closing this.
I am encountering the same issue when calling hiddenlayer.build_graph method: In order to fix it in hiddenlayer\pytorch_builder.py, change get_shape method to:
Packages information: torch 1.2.0+cu10 matplotlib 3.1.1 tensorflow 1.14.0 graphviz 0.12 hiddenlayer 0.2 python 3.7.4