未验证 提交 15b561d7 编写于 作者: Y Yang Zhang 提交者: GitHub

Update API usage according to 1.8 recommendations (#666)

上级 321f506d
...@@ -83,7 +83,7 @@ class TestRightPoolOp(unittest.TestCase): ...@@ -83,7 +83,7 @@ class TestRightPoolOp(unittest.TestCase):
place = fluid.CUDAPlace(0) place = fluid.CUDAPlace(0)
with fluid.program_guard(tp, sp): with fluid.program_guard(tp, sp):
x = fluid.layers.data( x = fluid.data(
name=self.name, name=self.name,
shape=x_shape, shape=x_shape,
dtype=x_type, dtype=x_type,
......
...@@ -283,22 +283,14 @@ class FCOSHead(object): ...@@ -283,22 +283,14 @@ class FCOSHead(object):
last dimension is [x1, y1, x2, y2] last dimension is [x1, y1, x2, y2]
""" """
act_shape_cls = self.__merge_hw(box_cls) act_shape_cls = self.__merge_hw(box_cls)
box_cls_ch_last = fluid.layers.reshape( box_cls_ch_last = fluid.layers.reshape(x=box_cls, shape=act_shape_cls)
x=box_cls,
shape=[self.batch_size, self.num_classes, -1],
actual_shape=act_shape_cls)
box_cls_ch_last = fluid.layers.sigmoid(box_cls_ch_last) box_cls_ch_last = fluid.layers.sigmoid(box_cls_ch_last)
act_shape_reg = self.__merge_hw(box_reg, "channel_last") act_shape_reg = self.__merge_hw(box_reg, "channel_last")
box_reg_ch_last = fluid.layers.transpose(box_reg, perm=[0, 2, 3, 1]) box_reg_ch_last = fluid.layers.transpose(box_reg, perm=[0, 2, 3, 1])
box_reg_ch_last = fluid.layers.reshape( box_reg_ch_last = fluid.layers.reshape(
x=box_reg_ch_last, x=box_reg_ch_last, shape=act_shape_reg)
shape=[self.batch_size, -1, 4],
actual_shape=act_shape_reg)
act_shape_ctn = self.__merge_hw(box_ctn) act_shape_ctn = self.__merge_hw(box_ctn)
box_ctn_ch_last = fluid.layers.reshape( box_ctn_ch_last = fluid.layers.reshape(x=box_ctn, shape=act_shape_ctn)
x=box_ctn,
shape=[self.batch_size, 1, -1],
actual_shape=act_shape_ctn)
box_ctn_ch_last = fluid.layers.sigmoid(box_ctn_ch_last) box_ctn_ch_last = fluid.layers.sigmoid(box_ctn_ch_last)
box_reg_decoding = fluid.layers.stack( box_reg_decoding = fluid.layers.stack(
......
...@@ -162,7 +162,7 @@ class FCOS(object): ...@@ -162,7 +162,7 @@ class FCOS(object):
for i in range(len(self.fcos_head.fpn_stride)): for i in range(len(self.fcos_head.fpn_stride)):
fields.extend( fields.extend(
['labels%d' % i, 'reg_target%d' % i, 'centerness%d' % i]) ['labels%d' % i, 'reg_target%d' % i, 'centerness%d' % i])
feed_vars = OrderedDict([(key, fluid.layers.data( feed_vars = OrderedDict([(key, fluid.data(
name=key, name=key,
shape=inputs_def[key]['shape'], shape=inputs_def[key]['shape'],
dtype=inputs_def[key]['dtype'], dtype=inputs_def[key]['dtype'],
......
...@@ -152,5 +152,5 @@ class BFP(object): ...@@ -152,5 +152,5 @@ class BFP(object):
out_shape = fluid.layers.cast(out_shape_, dtype='int32') out_shape = fluid.layers.cast(out_shape_, dtype='int32')
out_shape.stop_gradient = True out_shape.stop_gradient = True
body_output = fluid.layers.resize_nearest( body_output = fluid.layers.resize_nearest(
body_input, scale=scale, actual_shape=out_shape) body_input, scale=scale, out_shape=out_shape)
return body_output return body_output
...@@ -401,8 +401,7 @@ class CBResNet(object): ...@@ -401,8 +401,7 @@ class CBResNet(object):
out_shape_ = shape_hw out_shape_ = shape_hw
out_shape = fluid.layers.cast(out_shape_, dtype='int32') out_shape = fluid.layers.cast(out_shape_, dtype='int32')
out_shape.stop_gradient = True out_shape.stop_gradient = True
conv = fluid.layers.resize_nearest( conv = fluid.layers.resize_nearest(conv, scale=2., out_shape=out_shape)
conv, scale=2., actual_shape=out_shape)
output = fluid.layers.elementwise_add(x=right, y=conv) output = fluid.layers.elementwise_add(x=right, y=conv)
return output return output
......
...@@ -120,7 +120,7 @@ class HRFPN(object): ...@@ -120,7 +120,7 @@ class HRFPN(object):
out_shape = fluid.layers.cast(out_shape_, dtype='int32') out_shape = fluid.layers.cast(out_shape_, dtype='int32')
out_shape.stop_gradient = True out_shape.stop_gradient = True
body_output = fluid.layers.resize_bilinear( body_output = fluid.layers.resize_bilinear(
body_input, scale=scale, actual_shape=out_shape) body_input, scale=scale, out_shape=out_shape)
return body_output return body_output
def pooling(self, input, size, stride, pooling_type): def pooling(self, input, size, stride, pooling_type):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册