RuntimeError with ResNetUNet
prarobinson opened this issue · 3 comments
Hello!
When I get to the line
model = ResNetUNet(6)
I receive the following error message:
Traceback (most recent call last):
File "", line 1, in
File "", line 4, in init
File "/home/paulr/Programming/anaconda3/lib/python3.7/site-packages/torchvision/models/resnet.py", line 237, in resnet18
**kwargs)
File "/home/paulr/Programming/anaconda3/lib/python3.7/site-packages/torchvision/models/resnet.py", line 220, in resnet
model = ResNet(block, layers, **kwargs)
File "/home/paulr/Programming/anaconda3/lib/python3.7/site-packages/torchvision/models/resnet.py", line 142, in init
bias=False)
File "/home/paulr/Programming/anaconda3/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 332, in init
False, pair(0), groups, bias, padding_mode)
File "/home/paulr/Programming/anaconda3/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 46, in init
self.reset_parameters()
File "/home/paulr/Programming/anaconda3/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 49, in reset_parameters
init.kaiming_uniform(self.weight, a=math.sqrt(5))
File "/home/paulr/Programming/anaconda3/lib/python3.7/site-packages/torch/nn/init.py", line 315, in kaiming_uniform
return tensor.uniform_(-bound, bound)
RuntimeError: a leaf Variable that requires grad has been used in an in-place operation.
This looks likeit might be a bug in pytorch (or maybe just how I'm using it), but if you have any pointers I'd be greatful.
Thanks,
P
Hi @prarobinson thanks for trying this repo.
Which version of PyTorch are you using? I created this repo with PyTorch 0.4.1 so there might be some breaking changes with new versions.
Hmm that's interesting. Can you try to repro on an online notebook and share? e.g. https://colab.research.google.com/