caffe2
caffe2 copied to clipboard
Zero Padding problem
Hi, There're some operators with zero padding doesn't provide an interface setting the padding and stride. In the tutorial it said we don't need to specify the value since it is provided by ConvPoolOpBase, but the default value of zero padding is 0, which I don't know how to change it. Is there any idea to set the zero padding and stride argument in Python / C++ ? Thanks!
Finally I found that we can set the arguments (pad_t, pad_b, pad_r, pad_l) as the indication of zero padding, which is not mentioned in operator catalogue. Please alarm me if it is incorrect :)
I used "pad" in python
Thanks to @laetitiaoist , I added a parameter pad=1 to brew.conv(), it did achieve the padding goal.
@honamida Hi, do you know how to set the arguments (pad_t, pad_b, pad_r, pad_l). I set them like m.Conv('x', 'y', dim_in, dim_out, kernel_size, pad_t=1, pad_b=1) but it didn't work
Hi @laetitiaoist @lhCheung1991 @honamida ,
were you able to do assymetric padding in the case of pad_t, pad_b, pad_r, pad_l while training on GPU? I could do it but only on CPU. I get the following error training on GPU:
RuntimeError: [enforce fail at pool_op_cudnn.cu:430] legacy_pad_ == LegacyPadding::CAFFE_LEGACY_POOLING. Cudnn pooling only supports even padding on both sides, with the only exception of the caffe legacy pooling case where we try to preserve backward compatibility with Caffe. Error from operator:
input: "conv5_" input: "pool5_" input: "pool5__grad" output: "conv5__grad" name: "" type: "MaxPoolGradient" arg { name: "kernel" i: 3 } arg { name: "pad_l" i: 1 } arg { name: "pad_b" i: 0 } arg { name: "cudnn_exhaustive_search" i: 0 } arg { name: "stride" i: 2 } arg { name: "pad_r" i: 1 } arg { name: "order" s: "NHWC" } arg { name: "pad_t" i: 1 } device_option { device_type: 1 cuda_gpu_id: 0 } engine: "CUDNN" is_gradient_op: true