NotImplementedError when using _backend.SpatialFullConvolution in latest pytorch

Hi,
For my code, I need to access _backend.SpatialFullConvolution_updateOutput, when I use it in an earlier version of PyTorch it works fine but in the newer version (‘1.3.0.dev20190814’) I get the following error:

_backend.SpatialFullConvolution_updateOutput(
File “/conda-envs/pytorch_tensorflow/lib/python3.6/site-packages/torch/_thnn/utils.py”, line 27, in __ getattr __
raise NotImplementedError

Is this behavior expected?

Thanks,
Tahereh

what do you use it for?

Hi,

I am trying to access backward path parameters e.g. weights, like what is used for here:

I was wondering if there is a substitute for this backend in the new version?

Thanks,
Tahereh

I’m not 100% sure what your code is doing, but it looks like you could probably use a backward hook to achieve the same effect. “SpatialConvolutionMM” is the same as “thnn_conv2d” I believe.

Thanks for your reply.
backward hook only gives me the gradients computed in each layer. I want to be able to write my backward function which does not assume backpropagation (symmetric weight). That’s why access to _backend.SpatialConvolutionMM_updateGradInput
is important for my code. I would like to have access to such a function in the new Pytorch if it is possible.

we don’t expose a function that does that anymore to Python. It’s still available in C++ (though not guaranteed to continue to exist), should be thnn_backward.

I’d probably just write your own version for this case, though, if this is the only updateGradInput variant you need.

1 Like

Hi, sorry to bring this up. But may I know how do you access either the torch._thnn.type2backend or SpatialConvolutionMM in pytorch >1.5 nowadays? I am facing the same issue here…
Thank you very much.

Hi! Unfortunately, I don’t have access to torch._thnn.type2backend in the newer pytorch. I had to find other ways.

1 Like