f-dangel / unfoldNd

(N=1,2,3)-dimensional unfold (im2col) and fold (col2im) in PyTorch
MIT License
82 stars 6 forks source link

kernal size #25

Closed HaoGuo98 closed 7 months ago

HaoGuo98 commented 3 years ago

Can i set kernal size like [1,3,3], it seems that this tool can only support the filter have same dimmension.

f-dangel commented 3 years ago

Hi,

could you provide more details (e.g. which functionality you are trying to use, an exception the code runs into, a code example to showcase what you are trying to do)?

HaoGuo98 commented 3 years ago

i want to use a filter with a size of [1,3,3]. but in the example, the kernel size can just set a number not a triple?

f-dangel commented 3 years ago

That is because the example uses 4d tensors (images), hence the kernel can have at most two spatial dimensions. Also, they must be specified as int or tuple, as specified here. I just ran the example with kernel_size = (1, 3) and it seemed to work.

Let me know if this solves your problem.

HaoGuo98 commented 3 years ago

Thankes! It works now. However, compared with method in https://discuss.pytorch.org/t/manual-implementation-of-unrolled-3d-convolutions/91021/3, although the results have the same size, they are different. image

f-dangel commented 3 years ago

Although there could be a bug in this lib, this message indicates that something could be wrong with your comparison implementation for in_channels > 1. Are the outputs still different if you set in_channels = 1? If so, can you provide an output of the mismatching values, or a script to reproduce the behavior?

f-dangel commented 7 months ago

Closing as stale.