@@ -1329,6 +1329,8 @@ def sequence_pool(input, pool_type):
1329
1329
sqrt : out.data = [2.82, 6.93, 4.24], where 2.82=(1+3)/sqrt(2),
1330
1330
6.93=(2+4+6)/sqrt(3), 4.24=(5+1)/sqrt(2)
1331
1331
max : out.data = [3, 6, 5], where 3=max(1,3), 6=max(2,4,6), 5=max(5,1)
1332
+ last : out.data = [3, 6, 1], where 3=last(1,3), 6=last(2,4,6), 1=last(5,1)
1333
+ first : out.data = [1, 2, 5], where 1=first(1,3), 2=first(2,4,6), 5=first(5,1)
1332
1334
1333
1335
Args:
1334
1336
input(variable): The input variable which is a LoDTensor.
@@ -1348,6 +1350,8 @@ def sequence_pool(input, pool_type):
1348
1350
sum_x = fluid.layers.sequence_pool(input=x, pool_type='sum')
1349
1351
sqrt_x = fluid.layers.sequence_pool(input=x, pool_type='sqrt')
1350
1352
max_x = fluid.layers.sequence_pool(input=x, pool_type='max')
1353
+ last_x = fluid.layers.sequence_pool(input=x, pool_type='last')
1354
+ first_x = fluid.layers.sequence_pool(input=x, pool_type='first')
1351
1355
"""
1352
1356
helper = LayerHelper ('sequence_pool' , ** locals ())
1353
1357
dtype = helper .input_dtype ()
@@ -3769,22 +3773,22 @@ def label_smooth(label,
3769
3773
3770
3774
def roi_pool (input , rois , pooled_height = 1 , pooled_width = 1 , spatial_scale = 1.0 ):
3771
3775
"""
3772
- Region of interest pooling (also known as RoI pooling) is to perform
3776
+ Region of interest pooling (also known as RoI pooling) is to perform
3773
3777
is to perform max pooling on inputs of nonuniform sizes to obtain
3774
3778
fixed-size feature maps (e.g. 7*7).
3775
- The operator has three steps:
3776
- 1. Dividing each region proposal into equal-sized sections with
3777
- the pooled_width and pooled_height
3778
- 2. Finding the largest value in each section
3779
+ The operator has three steps:
3780
+ 1. Dividing each region proposal into equal-sized sections with
3781
+ the pooled_width and pooled_height
3782
+ 2. Finding the largest value in each section
3779
3783
3. Copying these max values to the output buffer
3780
3784
3781
3785
Args:
3782
3786
input (Variable): The input for ROI pooling.
3783
3787
rois (Variable): ROIs (Regions of Interest) to pool over. It should
3784
3788
be a 2-D one level LoTensor of shape [num_rois, 4].
3785
3789
The layout is [x1, y1, x2, y2], where (x1, y1)
3786
- is the top left coordinates, and (x2, y2) is the
3787
- bottom right coordinates. The num_rois is the
3790
+ is the top left coordinates, and (x2, y2) is the
3791
+ bottom right coordinates. The num_rois is the
3788
3792
total number of ROIs in this batch data.
3789
3793
pooled_height (integer): The pooled output height. Default: 1
3790
3794
pooled_width (integer): The pooled output width. Default: 1
@@ -3793,11 +3797,11 @@ def roi_pool(input, rois, pooled_height=1, pooled_width=1, spatial_scale=1.0):
3793
3797
to the scale used when pooling. Default: 1.0
3794
3798
3795
3799
Returns:
3796
- pool_out (Variable): The output is a 4-D tensor of the shape
3800
+ pool_out (Variable): The output is a 4-D tensor of the shape
3797
3801
(num_rois, channels, pooled_h, pooled_w).
3798
3802
3799
3803
Examples:
3800
- pool_out = fluid.layers.roi_pool(input=x, rois=rois, 7, 7, 1.0)
3804
+ pool_out = fluid.layers.roi_pool(input=x, rois=rois, 7, 7, 1.0)
3801
3805
"""
3802
3806
helper = LayerHelper ('roi_pool' , ** locals ())
3803
3807
dtype = helper .input_dtype ()
0 commit comments