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

Add cpu implementation for Deformable Convolution #14879

Merged
merged 12 commits into from
May 24, 2019

Conversation

arcadiaphy
Copy link
Member

@arcadiaphy arcadiaphy commented May 5, 2019

Description

Add cpu deformable_im2col implementation, also fix some errors in doc string.

Update:
The whole cpu part is implemented, and the code style is fixed to pass lint check.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at https://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • Feature1, tests, (and when applicable, API doc)
  • Feature2, tests, (and when applicable, API doc)

Comments

  • If this change is a backward incompatible change, why must this change be made.
  • Interesting edge cases to note here

@wkcn
Copy link
Member

wkcn commented May 5, 2019

Great Work! Thanks for your contribution!

Could you please add a forward consistance check in https://github.com/apache/incubator-mxnet/blob/master/tests/python/gpu/test_operator_gpu.py ?

Thank you!

@anirudhacharya
Copy link
Member

@mxnet-label-bot add [pr-awaiting-review]

@marcoabreu marcoabreu added the pr-awaiting-review PR is waiting for code review label May 6, 2019
@arcadiaphy arcadiaphy changed the title Add cpu forward implementation for Deformable Convolution Add cpu implementation for Deformable Convolution May 8, 2019
@karan6181
Copy link
Contributor

@wkcn Could you please review this PR once again? Thanks!

Copy link
Member

@wkcn wkcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! LGTM.
Thanks for your contribution!

}
else {
h_high = h_low + 1;
}

if (w_low >= width - 1) {
w_high = w_low = width - 1;
w = (DType)w_low;
w = static_cast<DType>(w_low);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we have overflows?

// num_axes should be smaller than block size
index_t num_spatial_axes = kernel_shape.ndim();
int num_spatial_axes = kernel_shape.ndim();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be const?


if (h_low >= height - 1) {
h_high = height - 1;
h = static_cast<DType>(h_low);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we overflow?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I'll look into the code in the perspective of overflow and change the type of int used in indexing and tensor size to index_t.

For int to float conversion, I think the overflow can't happens in float32 or float64.

@arcadiaphy arcadiaphy merged commit eade26f into apache:master May 24, 2019
@arcadiaphy arcadiaphy deleted the pr_deform branch May 24, 2019 02:00
haohuanw pushed a commit to haohuanw/incubator-mxnet that referenced this pull request Jun 23, 2019
* add cpu deformable_im2col

* fix doc string

* fix lint

* add consistency check

* fix code style

* add cpu deformable_col2im, deformable_col2im_coord

* update consistency test

* unify variable names

* fix lint

* update to index_t
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants