ternaus/TernausNetV2

error from . import _ext

JohnnyRisk opened this issue · 2 comments

Hello, I am trying to use your code and it cannot find _ext. I get the following error

File "/home/johnny/Software/domain-exploration/TernausNetV2/models/init.py", line 1, in
from .wider_resnet import *
File "/home/johnny/Software/domain-exploration/TernausNetV2/models/wider_resnet.py", line 8, in
from modules import IdentityResidualBlock, ABN, GlobalAvgPool2d
File "/home/johnny/Software/domain-exploration/TernausNetV2/modules/init.py", line 1, in
from .bn import ABN, InPlaceABN, InPlaceABNWrapper
File "/home/johnny/Software/domain-exploration/TernausNetV2/modules/bn.py", line 9, in
from .functions import inplace_abn
File "/home/johnny/Software/domain-exploration/TernausNetV2/modules/functions.py", line 5, in
from . import _ext
ImportError: cannot import name '_ext'

See here

Awesome, this worked! Thank you. Unfortunately, now the code is throwing the following error when trying to backpropagate the loss.

File "/home/johnny/Software/domain-exploration/TernausNetV2/main.py", line 186, in
recon_loss.backward()
File "/home/johnny/anaconda3/envs/aae_36/lib/python3.6/site-packages/torch/tensor.py", line 93, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/johnny/anaconda3/envs/aae_36/lib/python3.6/site-packages/torch/autograd/init.py", line 89, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/johnny/anaconda3/envs/aae_36/lib/python3.6/site-packages/torch/autograd/function.py", line 76, in apply
return self._forward_cls.backward(self, *args)
File "/home/johnny/anaconda3/envs/aae_36/lib/python3.6/site-packages/torch/autograd/function.py", line 188, in wrapper
outputs = fn(ctx, *args)
File "/home/johnny/Software/domain-exploration/TernausNetV2/modules/functions.py", line 149, in backward
_check_contiguous(dz, z, ctx.var, weight, bias, edz, eydz, dx, dweight, dbias)
AttributeError: 'InPlaceABNBackward' object has no attribute 'var'

Thank you again for your quick response. It is much appreciated.