nvlabs / pacnet Goto Github PK
View Code? Open in Web Editor NEWPixel-Adaptive Convolutional Neural Networks (CVPR '19)
Home Page: https://suhangpro.github.io/pac/
License: Other
Pixel-Adaptive Convolutional Neural Networks (CVPR '19)
Home Page: https://suhangpro.github.io/pac/
License: Other
Hi Suhang! Thanks for your sharing the code! I just wonder why there is a native implemention to control the computational flow. Is there any theoretical or performance differences between the native implemantion and non-native implemention?
.../home/danish/Documents/Repositories/pacnet/pac.py:447: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
output = output / (norm + torch.tensor(empty_mask, dtype=input.dtype, device=input.device))
............E.....
======================================================================
ERROR: test_kernel_two_impl_match (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/danish/Documents/Repositories/pacnet/test_pac.py", line 309, in test_kernel_two_impl_match
out.sum().backward()
File "/home/danish/Documents/Repositories/pacnet/env/lib/python3.7/site-packages/torch/tensor.py", line 107, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/danish/Documents/Repositories/pacnet/env/lib/python3.7/site-packages/torch/autograd/__init__.py", line 93, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/danish/Documents/Repositories/pacnet/env/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/danish/Documents/Repositories/pacnet/env/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/danish/Documents/Repositories/pacnet/pac.py", line 126, in backward
grad_diff = grad.expand_as(cols) * (2 * diff)
RuntimeError: CUDA out of memory. Tried to allocate 576.00 MiB (GPU 0; 3.95 GiB total capacity; 2.02 GiB already allocated; 453.06 MiB free; 586.00 MiB cached)
----------------------------------------------------------------------
Ran 21 tests in 32.108s
FAILED (errors=1)
Hello, i want to apply your PacConvTransposed2d to my model. But when do training,
Traceback (most recent call last):
File "C:\Users\Qyun\anaconda3\envs\pix_net\lib\site-packages\torch\autograd\function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "C:\projects\pacnet-master\pac.py", line 286, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "C:\Users\Qyun\anaconda3\envs\pix_net\lib\site-packages\torch_thnn\utils.py", line 27, in getattr
raise NotImplementedError
NotImplementedError
this error occurred.
and the same error is occurred when i do training task_jointUpsampling. How can I solve this problem?
Hi,
I am trying to use pacnet in my model like in this example: https://github.com/NVlabs/pacnet/blob/12d52b6ebdd8e8afa0d2e54486ba77fbb3697a53/task_semanticSegmentation/fcn8s.py
However, when I try to implement Mixed-Precision training with torch.cuda.amp (with torch 1.11), I have an error in the backward method.
File "<path>/model/pac.py", line 179, in backward
grad_in_mul_k = torch.einsum('iomn,ojkl->ijklmn', (grad_output, weight))
File "/opt/conda/lib/python3.8/site-packages/torch/functional.py", line 325, in einsum
return einsum(equation, *_operands)
File "/opt/conda/lib/python3.8/site-packages/torch/functional.py", line 327, in einsum
return _VF.einsum(equation, operands) # type: ignore[attr-defined]
RuntimeError: expected scalar type Half but found Float
I am using the th14
branch. Is there a fix or a work-around for this?
You may please delete this issue as this is a duplicate. Unfortunately, I cannot delete once posted.
Thanks!
HI, first of all thank you for this amazing work,
I am working on a semantic segmentation problem, and using CRF as a post processing step, currently I am using pydensecrf, which is a CPU implementation, it would really speed things up if I can replace it with your version of CRF, the only problem is that I can't find all the parameters corresponding to this kernel defined in the fully connected CRF paper:
The kernel above is the one used in dense CRF, and for seeing the provided example, when calling create_YXRGB
I've seen that we only provide theta_alpha and theta_beta for the appearance kernel, but I can seem to find the parameters for the smoothness kernel and the weighting factors between the two kernels, I think i am missing something, I wonder how can I specify them.
Thanks.
Is there any intuition behind having no ReLU layers after the last conv layers and all of the pac_t layers?
Hi ,Iām really interested in this work.But as a newcomer in this field ,I got some basic questions after I read the code.
1:Why the channels of the guidance should be half of the input in the examples of the PacConv2d?
2:Are there any rules or the relations of the shape of feature(guide),K(Gussain kernel in this papre), weight(convolution kernel)?
Iām sorry to bother you,I would appreciate it if you can answer me these questions or just help me get a better understanding of this great work. Thank you so much.
I want to use PacConv2d, but I got an error when I ran the code. It seems that it was an inplace operation problem, and I don't know why.
Traceback (most recent call last):
File "main.py", line 167, in
train()
File "main.py", line 147, in train
loss.backward()
File "/usr/local/lib/python2.7/dist-packages/torch/tensor.py", line 93, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/usr/local/lib/python2.7/dist-packages/torch/autograd/init.py", line 89, in backward
allow_unreachable=True) # allow_unreachable flag
File "/usr/local/lib/python2.7/dist-packages/torch/autograd/function.py", line 76, in apply
return self._forward_cls.backward(self, *args)
File "/usr/local/lib/python2.7/dist-packages/torch/autograd/function.py", line 188, in wrapper
outputs = fn(ctx, *args)
File "/home/xq/contrast_convlstm/pac.py", line 182, in backward
input, kernel, weight = ctx.saved_tensors
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation
The error located at class PacConv2dFn(Function) backward function.
I hope your advice.
Thanks.
Can we expect any Keras implementation for the same functions?
Hello, I am currently running Pytorch 1.2.0 with Cuda 9.2 and Python 3.7, but it seems I ran into "NotImplementedError" for all unittest results. Can anyone provide any solutions?
I ran python test_pac.py
and here is the results.
E.E/home/pc3387/Desktop/Reference/pacnet/pac.py:447: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
output = output / (norm + torch.tensor(empty_mask, dtype=input.dtype, device=input.device))
.EE.EEEEEEEEE.EEEE
======================================================================
ERROR: test_conv_all_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 28, in call_wrapped
f(self, *args, native_impl=True)
File "test_pac.py", line 145, in test_conv_all_grad
(im, im_k, conv_w, conv_b)))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_input_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "test_pac.py", line 114, in test_conv_input_grad
self.assertTrue(_gradcheck(conv, (im, im_k)))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 196, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_sum_all_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 28, in call_wrapped
f(self, *args, native_impl=True)
File "test_pac.py", line 334, in test_conv_sum_all_grad
(im, im_k, conv_w, conv_b), rtol=0.01))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_transpose_all_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 28, in call_wrapped
f(self, *args, native_impl=True)
File "test_pac.py", line 179, in test_conv_transpose_all_grad
(im, im_k, conv_w, conv_b)))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_transpose_input_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "test_pac.py", line 157, in test_conv_transpose_input_grad
self.assertTrue(_gradcheck(conv, (im, im_k)))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 286, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_transpose_sum_all_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 28, in call_wrapped
f(self, *args, native_impl=True)
File "test_pac.py", line 356, in test_conv_transpose_sum_all_grad
(im, im_k, conv_w, conv_b), rtol=0.01))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_transpose_two_impl_match (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 271, in test_conv_transpose_two_impl_match
out.sum().backward()
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/tensor.py", line 118, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 93, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 286, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_transpose_with_kernel_input_sum_all_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "test_pac.py", line 406, in test_conv_transpose_with_kernel_input_sum_all_grad
(im, im_k, conv_w, conv_b), rtol=0.01))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 286, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_two_impl_match (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 211, in test_conv_two_impl_match
out.sum().backward()
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/tensor.py", line 118, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 93, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 196, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_with_kernel_input_sum_all_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "test_pac.py", line 390, in test_conv_with_kernel_input_sum_all_grad
(im, im_k, conv_w, conv_b), rtol=0.01))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 196, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_with_kernel_input_two_impl_match (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 241, in test_conv_with_kernel_input_two_impl_match
out.sum().backward()
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/tensor.py", line 118, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 93, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 196, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_kernel_sum_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "test_pac.py", line 375, in test_kernel_sum_grad
(im,), rtol=0.01))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_kernel_two_impl_match (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 309, in test_kernel_two_impl_match
out.sum().backward()
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/tensor.py", line 118, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 93, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_pool_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "test_pac.py", line 189, in test_pool_grad
self.assertTrue(_gradcheck(pool, (im, im_k)))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 343, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_pool_sum_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "test_pac.py", line 366, in test_pool_sum_grad
self.assertTrue(_gradcheck(lambda x, y: pool(x, y).sum(), (im, im_k), rtol=0.01))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 343, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_pool_two_impl_match (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 293, in test_pool_two_impl_match
out.sum().backward()
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/tensor.py", line 118, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 93, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 343, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_pool_with_kernel_input_sum_grad (__main__.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "test_pac.py", line 419, in test_pool_with_kernel_input_sum_grad
(im, im_k), rtol=0.01))
File "test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 343, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
----------------------------------------------------------------------
Ran 21 tests in 10.272s
FAILED (errors=17)
(Pytorch) pc3387@pc3387:~/Desktop/Reference/pacnet$ python -m unittest
E.E/home/pc3387/Desktop/Reference/pacnet/pac.py:447: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
output = output / (norm + torch.tensor(empty_mask, dtype=input.dtype, device=input.device))
.EE.EEEEEEEEE.EEEE
======================================================================
ERROR: test_conv_all_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 28, in call_wrapped
f(self, *args, native_impl=True)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 145, in test_conv_all_grad
(im, im_k, conv_w, conv_b)))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_input_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 114, in test_conv_input_grad
self.assertTrue(_gradcheck(conv, (im, im_k)))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 196, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_sum_all_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 28, in call_wrapped
f(self, *args, native_impl=True)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 334, in test_conv_sum_all_grad
(im, im_k, conv_w, conv_b), rtol=0.01))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_transpose_all_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 28, in call_wrapped
f(self, *args, native_impl=True)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 179, in test_conv_transpose_all_grad
(im, im_k, conv_w, conv_b)))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_transpose_input_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 157, in test_conv_transpose_input_grad
self.assertTrue(_gradcheck(conv, (im, im_k)))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 286, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_transpose_sum_all_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 28, in call_wrapped
f(self, *args, native_impl=True)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 356, in test_conv_transpose_sum_all_grad
(im, im_k, conv_w, conv_b), rtol=0.01))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_transpose_two_impl_match (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 271, in test_conv_transpose_two_impl_match
out.sum().backward()
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/tensor.py", line 118, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 93, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 286, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_transpose_with_kernel_input_sum_all_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 406, in test_conv_transpose_with_kernel_input_sum_all_grad
(im, im_k, conv_w, conv_b), rtol=0.01))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 286, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_two_impl_match (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 211, in test_conv_two_impl_match
out.sum().backward()
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/tensor.py", line 118, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 93, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 196, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_with_kernel_input_sum_all_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 390, in test_conv_with_kernel_input_sum_all_grad
(im, im_k, conv_w, conv_b), rtol=0.01))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 196, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_conv_with_kernel_input_two_impl_match (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 241, in test_conv_with_kernel_input_two_impl_match
out.sum().backward()
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/tensor.py", line 118, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 93, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 196, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_kernel_sum_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 375, in test_kernel_sum_grad
(im,), rtol=0.01))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_kernel_two_impl_match (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 309, in test_kernel_two_impl_match
out.sum().backward()
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/tensor.py", line 118, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 93, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 130, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_pool_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 189, in test_pool_grad
self.assertTrue(_gradcheck(pool, (im, im_k)))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 343, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_pool_sum_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 366, in test_pool_sum_grad
self.assertTrue(_gradcheck(lambda x, y: pool(x, y).sum(), (im, im_k), rtol=0.01))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 343, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_pool_two_impl_match (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 293, in test_pool_two_impl_match
out.sum().backward()
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/tensor.py", line 118, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 93, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 343, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
======================================================================
ERROR: test_pool_with_kernel_input_sum_grad (test_pac.PacConvTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 29, in call_wrapped
f(self, *args, native_impl=False)
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 419, in test_pool_with_kernel_input_sum_grad
(im, im_k), rtol=0.01))
File "/home/pc3387/Desktop/Reference/pacnet/test_pac.py", line 21, in _gradcheck
return gradcheck(f, x0, rtol=rtol, atol=atol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 279, in gradcheck
analytical, reentrant, correct_grad_sizes = get_analytical_jacobian(tupled_inputs, o, nondet_tol=nondet_tol)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/gradcheck.py", line 155, in get_analytical_jacobian
retain_graph=True, allow_unused=True)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/__init__.py", line 149, in grad
inputs, allow_unused)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 77, in apply
return self._forward_cls.backward(self, *args)
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/autograd/function.py", line 189, in wrapper
outputs = fn(ctx, *args)
File "/home/pc3387/Desktop/Reference/pacnet/pac.py", line 343, in backward
ctx._backend.Im2Col_updateGradInput(ctx._backend.library_state,
File "/home/pc3387/anaconda3/envs/Pytorch/lib/python3.7/site-packages/torch/_thnn/utils.py", line 27, in __getattr__
raise NotImplementedError
NotImplementedError
----------------------------------------------------------------------
Ran 21 tests in 9.632s
FAILED (errors=17)
when I use the pacconvtranspose2d, there is a bug.
expected object of backed CUDA but got backend CPU for argument #2 'mat2'
How to deal with it?
Thank you.
Is there any chance for a quick implementation of 3D convolutions with PAC? Thanks!
Hi, I'm a bit confused how to deal with this error. Can you help?
/home/joseph/pacnet-master/task_jointUpsampling/main.py:122: UserWarning: genfromtxt: Empty input file: "exp/sintel/train.log"
log = np.genfromtxt(log_path, delimiter=',', skip_header=1, usecols=(0,))
/home/joseph/pacnet-master/task_jointUpsampling/main.py:122: UserWarning: genfromtxt: Empty input file: "exp/sintel/test.log"
log = np.genfromtxt(log_path, delimiter=',', skip_header=1, usecols=(0,))
Traceback (most recent call last):
File "/home/joseph/anaconda3/envs/pac/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/joseph/anaconda3/envs/pac/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/joseph/pacnet-master/task_jointUpsampling/main.py", line 348, in
main()
File "/home/joseph/pacnet-master/task_jointUpsampling/main.py", line 322, in main
log_test = test(model, test_loader, device, last_epoch, init_lr, args.loss, perf_measures, args)
File "/home/joseph/pacnet-master/task_jointUpsampling/main.py", line 86, in test
output = apply_model(model, lres, guide, args.factor)
File "/home/joseph/pacnet-master/task_jointUpsampling/main.py", line 22, in apply_model
out = net(lres, guide)
File "/home/joseph/anaconda3/envs/pac/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/joseph/pacnet-master/task_jointUpsampling/models.py", line 245, in forward
x = self.up_convts[i](x, guide_cur)
File "/home/joseph/anaconda3/envs/pac/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/joseph/pacnet-master/pac.py", line 795, in forward
self.output_padding, self.dilation, self.shared_filters, self.native_impl)
File "/home/joseph/pacnet-master/pac.py", line 507, in pacconv_transpose2d
shared_filters)
File "/home/joseph/pacnet-master/pac.py", line 261, in forward
output = torch.einsum('ijklmn,jokl->iomn', (in_mul_k, weight))
File "/home/joseph/anaconda3/envs/pac/lib/python3.6/site-packages/torch/functional.py", line 211, in einsum
return torch._C._VariableFunctions.einsum(equation, operands)
RuntimeError: CUDA out of memory. Tried to allocate 2.69 GiB (GPU 0; 10.92 GiB total capacity; 5.74 GiB already allocated; 1.86 GiB free; 2.78 GiB cached)
"It accepts all standard nn.Conv2d arguments (e.g. kernel_size, stride, padding, dilation), and we make sure that when the same arguments are used", is groups is allow to use?
Thank you!
Hi
Should we set CRF step to 1 when training the whole model? And step to whatever we want when in the inference processing?
Because when I set CRF step to num>1, it will cause the in-place operation in the training process.
Please support 1d equivalents
Thanks for sharing the code! But I still have a question.
In a pac layer, a kernel will be calculated according to the guide input. And the kernel will be calculated with the target input to get the output tensor. So when the network does the backpropagation, will the relationship between the weight of the kernel and the guide input change? Or the weight of the kernel is updated only because of the gradient?
I would be very grateful if you can give me some help. Thanks!
Great work, Han.
Does it support PacConv3d and PacTransposeConv3D? Does it support PyTorch native automatic mixed
precision (AMP)? What will the computational cost if I implement it?
As above.
I would like to ask whether the transpose operator PacConvTranspose2d is a indeed the transpose operator of PacConv2d or a generic spatially-varying upsampling operator. A transpose/adjoint operator should pass the adjoint test https://en.wikipedia.org/wiki/Hermitian_adjoint, however it is not possible to reproduce the test with success. Based on your test file, I created the following tests:
def _allclose(x1, x2, rtol=1e-5, atol=1e-10):
assert np.allclose(x1.cpu(), x2.cpu(), rtol=rtol, atol=atol)
@repeat_impl_types
def test_adjoint_const_kernel_th(self, native_impl):
bs, sz, k_ch = 1, 128, 5
args = dict(in_channels=3, out_channels=3, kernel_size=5, stride=1, padding=2, dilation=1)
k_with_d = (args['kernel_size'] - 1) * args['dilation'] + 1
im_1 = th.rand(bs, args['in_channels'], sz, sz).to(self.device)
im_2 = th.rand(bs, args['in_channels'], sz, sz).to(self.device)
conv_w = th.rand(args['in_channels'], args['out_channels'],
args['kernel_size'], args['kernel_size']).to(self.device)
conv_b = th.zeros(args['out_channels']).to(self.device)
conv_th = nn.Conv2d(**args).to(self.device)
conv_t_th = nn.ConvTranspose2d(**args).to(self.device)
conv_th.weight.data[:] = conv_t_th.weight.data[:] = conv_w
conv_th.bias.data[:] = conv_t_th.bias.data[:] = conv_b
res1 = conv_th(im_1).detach().reshape(-1)
res2 = conv_t_th(im_2).detach().reshape(-1)
_allclose(res1.dot(im_2.reshape(-1)).detach(), res2.dot(im_1.reshape(-1)).detach())
@repeat_impl_types
def test_adjoint_const_kernel_pac(self, native_impl):
bs, sz, k_ch = 1, 6, 5
args = dict(in_channels=3, out_channels=3, kernel_size=5, stride=1, padding=2, dilation=1)
k_with_d = (args['kernel_size'] - 1) * args['dilation'] + 1
sz_out = (sz - 1) * args['stride'] - 2 * args['padding'] + k_with_d + 0 #args['output_padding']
im_1 = th.rand(bs, args['in_channels'], sz, sz).to(self.device)
im_2 = th.rand(bs, args['in_channels'], sz, sz).to(self.device)
im_k = th.rand(bs, k_ch, sz_out, sz_out).to(self.device)
conv_w = th.rand(args['in_channels'], args['out_channels'],
args['kernel_size'], args['kernel_size']).to(self.device)
conv_b = th.zeros(args['out_channels']).to(self.device)
conv = pac.PacConv2d(native_impl=native_impl, **args).to(self.device)
conv_t = pac.PacConvTranspose2d(native_impl=native_impl, **args).to(self.device)
conv.weight.data[:] = conv_t.weight.data[:] = conv_w
conv.bias.data[:] = conv_t.bias.data[:] = conv_b
res1 = conv(im_1, im_k).detach().reshape(-1)
res2 = conv_t(im_2, im_k).detach().reshape(-1)
_allclose(res1.dot(im_2.reshape(-1)).detach(), res2.dot(im_1.reshape(-1)).detach())
The Pytorch implementations of Conv2D and ConvTranspose2d pass the test with success, however PacConv2d and PacConvTranspose2d fail to pass the test.
Best regards,
Filippos
Hello,
I am impressed by your great work. And I have some questions about your code.
I used model fcn8spac to train the VOC2012. And after training, I got many pth files. But when I want to generate predictions for VOC test dataset, I can only generate some black images. And I got the normal acc on VOC training data.
And my script is 'CUDA_VISIBLE_DEVICES=3 python -m task_semanticSegmentation.main --data-root data/voc --exp-root exp/voc/fcn8s_pac_but_change_to_pad --load-weights pacnet/exp/voc/fcn8s_pac_but_change_to_pad/weights_epoch_40.pth --test-crop 512 --test-split test --eval pred --model fcn8spac'.
Could you please give me some advices on how to finish that?
Best,
Amose.
Can i set a larger batch size for example 16? I learn that the default batch size is 1.
Actually, i have some questiones about the kernel, if i input an batch(B) of different images and correponding guided features into the pacconv. Different guided features will produce different kernels. There are multiple different kernels in a batch that will increase the complexity of the forward calculation. How do you deal with this kind of problem?
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/arc-wzl2611/mEMC-Net-master/main1.py", line 373, in
main()
File "/home/arc-wzl2611/mEMC-Net-master/main1.py", line 341, in main
log_test = test(model, test_loader, device, last_epoch, init_lr, args.loss, perf_measures, args)
File "/home/arc-wzl2611/mEMC-Net-master/main1.py", line 102, in test
output = apply_model(model, lres, guide, args.factor)
File "/home/arc-wzl2611/mEMC-Net-master/main1.py", line 26, in apply_model
out = net(lres, guide)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/arc-wzl2611/mEMC-Net-master/models.py", line 250, in forward
x = self.up_convts[i](x, guide_cur)
File "/usr/local/lib/python3.5/dist-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/arc-wzl2611/mEMC-Net-master/pac.py", line 786, in forward
self.output_padding, self.dilation, self.shared_filters, self.native_impl)
File "/home/arc-wzl2611/mEMC-Net-master/pac.py", line 498, in pacconv_transpose2d
shared_filters)
File "/home/arc-wzl2611/mEMC-Net-master/pac.py", line 252, in forward
output = torch.einsum('ijklmn,jokl->iomn', (in_mul_k, weight))
File "/usr/local/lib/python3.5/dist-packages/torch/functional.py", line 243, in einsum
return torch._C._VariableFunctions.einsum(equation, operands)
RuntimeError: CUDA error: out of memory
Hello,
I would like to ask some questions the CRF layers that you proposed.
Suppose I can get some CNN (e.g. FCN or DeepLab) using:
cnn = get_cnn()
This CNN can be trained with the usual cross-entropy loss without any issue.
Now to put a CRF on top of it, I define some model for combining a CNN and a CRF like this:
class CNNCRF(torch.nn.Module):
def __init__(self, cnn, crf):
super().__init__()
self.cnn = cnn
self.crf = crf
def forward(self, x):
unaries = self.cnn(x)
edge_feat = [paccrf.create_YXRGB(x, 80.0, 13.0),
paccrf.create_position_feats(x.shape[2:], 3.0, bs=x.shape[0], device=x.device)]
return self.crf(unaries, edge_feat)
Then I create a CRF layer and add it to the model:
compat = '2d'
kernel_size = 11
blur=4
dilation = 1
crf_params = dict(num_steps=crf_iterations, perturbed_init=True, fixed_weighting=False, unary_weight=0.8,
pairwise_kernels=[
dict(kernel_size=kernel_size, dilation=dilation, blur=blur, compat_type=compat, spatial_filter=False,
pairwise_weight=2.0),
dict(kernel_size=kernel_size, dilation=dilation, blur=blur, compat_type=compat, spatial_filter=False,
pairwise_weight=0.6)])
crf = paccrf.PacCRF(num_classes, **crf_params)
model = CNNCRF(cnn, crf)
I tried training this model by freezing the CNN part (the total number of trainable parameters of the model is then 885) using Adam optimizer with a learning rate of 1e-4
, but it was very difficult to converge. Could you please tell me if what I did above is correct?
Thank you in advance for your response.
Hello,
I observed that you've scaled the input to the mask over here.
Is there any significance to this scaling operation?
I think something as been shuffled around in torch. I cannot find type2backend which was previously in torch._thnn in 0.4.
Can we port this to torch 1.4.0?
Hi,
I want to use the pacconv2d in my code, so I try to running your code firstly but I meet a proplem.
The PacConv2dFn in pac.py:
in_mul_k = cols.view(bs, ch, *kernel.shape[2:]) * kernel
The error is: RuntimeError: shape '[1, 256, 3, 3, 112, 112]' is invalid for input of size 29419776
I train the model with the command as: >python -m task_semanticSegmentation.main --data-root data/voc --exp-root exp/voc/fcn8spac2 --train-split train11 --test-split val11_sbd --train-crop 449 --test-crop 512 --model fcn8spac --epochs 40 --lr 0.001 --lr-steps 20
How can I solve this problem or whether do my parameter exit error?
My environment is: python 3.7, cuda 11.1 and pytorch 1.9
Hi,
I tried to use pacnet in one my code but when using the function :
pacconv = PacConv2d(in_ch, out_ch, f)
out_pac = pacconv(input, None, guide_k)
In my case input has shape(2,1,200,200) and guide_k (2,1,3,3,200,200).
The forward pass of my code is ok but when computing the backward pass I got this error message:
trying to differentiate twice a function that was marked with @once_differentiable
Do you have any idea of this issue ? Replacing the pacconv by a simple convolution layer removes the error.
Thanks in advance
Are there any plans on adding support of autocasting of Pytorch 1.6?
Currently the weights and kernels are sticking to float and the gradients are half which give a type missmatch error in backpropagation.
For running my example i'm using the code of the 1.4 branch.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ššš
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ā¤ļø Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.