From 59d4eef6dadf47b7405765200c44aaa9f2b3aa5a Mon Sep 17 00:00:00 2001 From: Guanghua Yu <742925032@qq.com> Date: Wed, 13 Jan 2021 21:45:33 +0800 Subject: [PATCH] fix framework warning (#2059) --- ppdet/modeling/backbones/fpn.py | 3 +-- ppdet/modeling/backbones/mobilenet_v3.py | 2 +- ppdet/modeling/ops.py | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ppdet/modeling/backbones/fpn.py b/ppdet/modeling/backbones/fpn.py index f09e8f8f8..baefd4019 100644 --- a/ppdet/modeling/backbones/fpn.py +++ b/ppdet/modeling/backbones/fpn.py @@ -18,7 +18,6 @@ from __future__ import print_function from collections import OrderedDict import copy -import paddle from paddle import fluid from paddle.fluid.param_attr import ParamAttr from paddle.fluid.initializer import Xavier @@ -106,7 +105,7 @@ class FPN(object): out_shape=[body_input.shape[2], body_input.shape[3]], name=topdown_name) - return paddle.add(lateral, topdown) + return fluid.layers.elementwise_add(lateral, topdown) def get_output(self, body_dict): """ diff --git a/ppdet/modeling/backbones/mobilenet_v3.py b/ppdet/modeling/backbones/mobilenet_v3.py index d4727449a..96c425fd6 100644 --- a/ppdet/modeling/backbones/mobilenet_v3.py +++ b/ppdet/modeling/backbones/mobilenet_v3.py @@ -225,7 +225,7 @@ class MobileNetV3(object): return out def _hard_swish(self, x): - return x * fluid.layers.relu6(x + 3) / 6. + return fluid.layers.elementwise_mul(x, fluid.layers.relu6(x + 3) / 6.) def _se_block(self, input, num_out_filter, ratio=4, name=None): lr_idx = self.curr_stage // 3 diff --git a/ppdet/modeling/ops.py b/ppdet/modeling/ops.py index 00a611348..86cd9d5cc 100644 --- a/ppdet/modeling/ops.py +++ b/ppdet/modeling/ops.py @@ -325,7 +325,8 @@ def DropBlock(input, block_size, keep_prob, is_test): elem_sum_m = fluid.layers.cast(elem_sum, dtype="float32") elem_sum_m.stop_gradient = True - output = input * mask * elem_numel_m / elem_sum_m + output = fluid.layers.elementwise_mul(input, + mask) * elem_numel_m / elem_sum_m return output -- GitLab