Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

What will mxnet convolution do if the dilate shape is greater than the input shape #3479

Closed
shuokay opened this issue Oct 8, 2016 · 6 comments

Comments

@shuokay
Copy link
Contributor

shuokay commented Oct 8, 2016

For example, the input shape is (1,100) and the dilate is (3, 3).

I have tried to set the dilate to (1,3), and the error is
mxnet/mshadow/mshadow/././extension/pack_col2patch.h:53: Check failed: (sshape[1]) == (o_height * o_width * imshape.ProdShape(0, dstdim - 3)) PackColToPatchEx p: src.size(1) mismatch

@feiyulv
Copy link

feiyulv commented Oct 9, 2016

That may be a bug in the backward of dilation convolution
change the following code of convolution-inl.h:246

      if (param_.pad[0] == 0 && param_.pad[1] == 0) {
        Assign(gdata.Slice(i, i + step), req[conv::kData],
               pack_col2patch(temp_col,
                              data.Slice(i, i + step).shape_,
                              param_.kernel[0],
                              param_.kernel[1],
                              param_.stride[0],
                              param_.dilate[0]));
      } else {
        Shape<4> pshape = data.Slice(i, i + step).shape_;
        pshape[2] += 2 * param_.pad[0];
        pshape[3] += 2 * param_.pad[1];
        Assign(gdata.Slice(i, i + step), req[conv::kData],
               crop(pack_col2patch(temp_col,
                                   pshape,
                                   param_.kernel[0],
                                   param_.kernel[1],
                                   param_.stride[0],
                                   param_.dilate[0]),
                    gdata[i][0].shape_));
      }

to

  if (param_.pad[0] == 0 && param_.pad[1] == 0) {
        Assign(gdata.Slice(i, i + step), req[conv::kData],
               pack_col2patch(temp_col,
                              data.Slice(i, i + step).shape_,
                              param_.kernel[0],
                              param_.kernel[1],
                              param_.stride[0],
                              param_.stride[1],
                              param_.dilate[0],
                              param_.dilate[1]));
      } else {
        Shape<4> pshape = data.Slice(i, i + step).shape_;
        pshape[2] += 2 * param_.pad[0];
        pshape[3] += 2 * param_.pad[1];
        Assign(gdata.Slice(i, i + step), req[conv::kData],
               crop(pack_col2patch(temp_col,
                                   pshape,
                                   param_.kernel[0],
                                   param_.kernel[1],
                                   param_.stride[0],
                                   param_.stride[1],
                                   param_.dilate[0],
                                   param_.dilate[1]),
                    gdata[i][0].shape_));
      }

@winstywang
Copy link
Contributor

@feiyulv Could you submit a PR on this?

@winstywang
Copy link
Contributor

It may relate to this PR: #2365

@feiyulv
Copy link

feiyulv commented Oct 10, 2016

@winstywang yes, the same problem

@winstywang
Copy link
Contributor

@feiyulv Could you submit a PR on this? The old PR is inactive for a long time.

@yajiedesign
Copy link
Contributor

This issue is closed due to lack of activity in the last 90 days. Feel free to reopen if this is still an active issue. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants