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

remove unnecessary flags

test=develop
上级 6961a94e
...@@ -227,8 +227,7 @@ class InterpolateOpCUDAKernel : public framework::OpKernel<T> { ...@@ -227,8 +227,7 @@ 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;
} }
...@@ -302,8 +301,7 @@ class InterpolateGradOpCUDAKernel : public framework::OpKernel<T> { ...@@ -302,8 +301,7 @@ 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;
} }
......
...@@ -199,8 +199,7 @@ class InterpolateKernel : public framework::OpKernel<T> { ...@@ -199,8 +199,7 @@ 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;
} }
...@@ -258,8 +257,7 @@ class InterpolateGradKernel : public framework::OpKernel<T> { ...@@ -258,8 +257,7 @@ 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;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册