diff --git a/ppdet/modeling/backbones/fpn.py b/ppdet/modeling/backbones/fpn.py index f09e8f8f852d1ee445d3fb1ca62a7dfa625ea324..baefd40193013ffec3f7749149f18f31f5f3c9d4 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 d4727449a6fd99e129a686b02fc1e1b69a28c7ba..96c425fd6a54fa1b41a7b08049701d9c94366fc9 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 00a6113485963ce7c40b3f804fd8b7031551890c..86cd9d5cc65ac0402ad312f65f3d65eec0250358 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