提交 909f864a 编写于 作者: T tink2123

remove unnecessary flags

test=develop
上级 6961a94e
...@@ -227,9 +227,8 @@ class InterpolateOpCUDAKernel : public framework::OpKernel<T> { ...@@ -227,9 +227,8 @@ class InterpolateOpCUDAKernel : public framework::OpKernel<T> {
: static_cast<float>(in_h) / out_h; : static_cast<float>(in_h) / out_h;
} }
if (out_w > 1) { if (out_w > 1) {
ratio_w = (align_corners && out_w > 1) ratio_w = (align_corners) ? static_cast<float>(in_w - 1) / (out_w - 1)
? static_cast<float>(in_w - 1) / (out_w - 1) : static_cast<float>(in_w) / out_w;
: static_cast<float>(in_w) / out_w;
} }
if (in_h == out_h && in_w == out_w) { if (in_h == out_h && in_w == out_w) {
...@@ -302,9 +301,8 @@ class InterpolateGradOpCUDAKernel : public framework::OpKernel<T> { ...@@ -302,9 +301,8 @@ class InterpolateGradOpCUDAKernel : public framework::OpKernel<T> {
: static_cast<float>(in_h) / out_h; : static_cast<float>(in_h) / out_h;
} }
if (out_w > 1) { if (out_w > 1) {
ratio_w = (align_corners && out_w > 1) ratio_w = (align_corners) ? static_cast<float>(in_w - 1) / (out_w - 1)
? static_cast<float>(in_w - 1) / (out_w - 1) : static_cast<float>(in_w) / out_w;
: static_cast<float>(in_w) / out_w;
} }
if (in_h == out_h && in_w == out_w) { if (in_h == out_h && in_w == out_w) {
......
...@@ -199,9 +199,8 @@ class InterpolateKernel : public framework::OpKernel<T> { ...@@ -199,9 +199,8 @@ class InterpolateKernel : public framework::OpKernel<T> {
: static_cast<float>(in_h) / out_h; : static_cast<float>(in_h) / out_h;
} }
if (out_w > 1) { if (out_w > 1) {
ratio_w = (align_corners && out_w > 1) ratio_w = (align_corners) ? static_cast<float>(in_w - 1) / (out_w - 1)
? static_cast<float>(in_w - 1) / (out_w - 1) : static_cast<float>(in_w) / out_w;
: static_cast<float>(in_w) / out_w;
} }
if ("bilinear" == interp_method) { if ("bilinear" == interp_method) {
...@@ -258,9 +257,8 @@ class InterpolateGradKernel : public framework::OpKernel<T> { ...@@ -258,9 +257,8 @@ class InterpolateGradKernel : public framework::OpKernel<T> {
: static_cast<float>(in_h) / out_h; : static_cast<float>(in_h) / out_h;
} }
if (out_w > 1) { if (out_w > 1) {
ratio_w = (align_corners && out_w > 1) ratio_w = (align_corners) ? static_cast<float>(in_w - 1) / (out_w - 1)
? static_cast<float>(in_w - 1) / (out_w - 1) : static_cast<float>(in_w) / out_w;
: static_cast<float>(in_w) / out_w;
} }
if ("bilinear" == interp_method) { if ("bilinear" == interp_method) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册