Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix upsample bilinear bug #5366

Merged
merged 29 commits into from
Jul 2, 2021
Merged

Fix upsample bilinear bug #5366

merged 29 commits into from
Jul 2, 2021

Conversation

BBuf
Copy link
Contributor

@BBuf BBuf commented Jul 2, 2021

return align_corners ? static_cast<T>(input_size - 1) / (output_size - 1)
: (scale > 0. ? 1.0 / scale : static_cast<T>(input_size) / output_size);
} else {
return 0;
Copy link
Contributor

@daquexian daquexian Jul 2, 2021

Choose a reason for hiding this comment

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

我总感觉 pytorch output_size == 1 的时候 scale 直接 return 0 是个 bug,没有找到它为什么这么写的原理

Copy link
Contributor Author

Choose a reason for hiding this comment

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

opencv是没有这个判断的,我也同意这个地方有问题,那这里还要不要特判。。

@@ -98,14 +87,32 @@ template<typename T>
__device__ void GetBilinearParam(const bool align_corners, const int64_t h, const int64_t w,
Copy link
Contributor

Choose a reason for hiding this comment

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

.cu 和 .cpp 的 GetAreaPixelScale 和 GetBilinearParam 函数的实现是不是可以复用

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

const int64_t in_h = GetNearestInputIndex(h, scale_h, in_height);
const int64_t in_w = GetNearestInputIndex(w, scale_w, in_width);
const int64_t in_h = GetNearestInputIndexFunc(h, scale_h, in_height);
const int64_t in_w = GetNearestInputIndexFunc(w, scale_w, in_width);
Copy link
Contributor

Choose a reason for hiding this comment

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

命名里的 Func 是不是可以去掉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

@BBuf BBuf requested a review from oneflow-ci-bot July 2, 2021 06:20
@BBuf BBuf added the automerge label Jul 2, 2021
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 2, 2021 07:40
@oneflow-ci-bot oneflow-ci-bot self-requested a review July 2, 2021 09:37
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 2, 2021 11:10
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 2, 2021 12:42
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 2, 2021 14:25
@oneflow-ci-bot oneflow-ci-bot requested review from oneflow-ci-bot and removed request for oneflow-ci-bot July 2, 2021 15:35
@oneflow-ci-bot oneflow-ci-bot merged commit 385ddce into master Jul 2, 2021
@oneflow-ci-bot oneflow-ci-bot deleted the fix_upsample_bilinear_bug branch July 2, 2021 17:06
@oneflow-ci-bot oneflow-ci-bot removed their request for review July 2, 2021 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants