|  |  | @ -1329,6 +1329,8 @@ def sequence_pool(input, pool_type): | 
			
		
	
		
		
			
				
					
					|  |  |  |          sqrt   : out.data = [2.82, 6.93, 4.24], where 2.82=(1+3)/sqrt(2), |  |  |  |          sqrt   : out.data = [2.82, 6.93, 4.24], where 2.82=(1+3)/sqrt(2), | 
			
		
	
		
		
			
				
					
					|  |  |  |                     6.93=(2+4+6)/sqrt(3), 4.24=(5+1)/sqrt(2) |  |  |  |                     6.93=(2+4+6)/sqrt(3), 4.24=(5+1)/sqrt(2) | 
			
		
	
		
		
			
				
					
					|  |  |  |          max    : out.data = [3, 6, 5], where 3=max(1,3), 6=max(2,4,6), 5=max(5,1) |  |  |  |          max    : out.data = [3, 6, 5], where 3=max(1,3), 6=max(2,4,6), 5=max(5,1) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |          last   : out.data = [3, 6, 1], where 3=last(1,3), 6=last(2,4,6), 1=last(5,1) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |          first  : out.data = [1, 2, 5], where 1=first(1,3), 2=first(2,4,6), 5=first(5,1) | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     Args: |  |  |  |     Args: | 
			
		
	
		
		
			
				
					
					|  |  |  |         input(variable): The input variable which is a LoDTensor. |  |  |  |         input(variable): The input variable which is a LoDTensor. | 
			
		
	
	
		
		
			
				
					|  |  | @ -1348,6 +1350,8 @@ def sequence_pool(input, pool_type): | 
			
		
	
		
		
			
				
					
					|  |  |  |              sum_x = fluid.layers.sequence_pool(input=x, pool_type='sum') |  |  |  |              sum_x = fluid.layers.sequence_pool(input=x, pool_type='sum') | 
			
		
	
		
		
			
				
					
					|  |  |  |              sqrt_x = fluid.layers.sequence_pool(input=x, pool_type='sqrt') |  |  |  |              sqrt_x = fluid.layers.sequence_pool(input=x, pool_type='sqrt') | 
			
		
	
		
		
			
				
					
					|  |  |  |              max_x = fluid.layers.sequence_pool(input=x, pool_type='max') |  |  |  |              max_x = fluid.layers.sequence_pool(input=x, pool_type='max') | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |              last_x = fluid.layers.sequence_pool(input=x, pool_type='last') | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |              first_x = fluid.layers.sequence_pool(input=x, pool_type='first') | 
			
		
	
		
		
			
				
					
					|  |  |  |     """ |  |  |  |     """ | 
			
		
	
		
		
			
				
					
					|  |  |  |     helper = LayerHelper('sequence_pool', **locals()) |  |  |  |     helper = LayerHelper('sequence_pool', **locals()) | 
			
		
	
		
		
			
				
					
					|  |  |  |     dtype = helper.input_dtype() |  |  |  |     dtype = helper.input_dtype() | 
			
		
	
	
		
		
			
				
					|  |  | @ -3263,35 +3267,35 @@ def smooth_l1(x, y, inside_weight=None, outside_weight=None, sigma=None): | 
			
		
	
		
		
			
				
					
					|  |  |  |     """ |  |  |  |     """ | 
			
		
	
		
		
			
				
					
					|  |  |  |     **Smooth L1 Loss Operator. ** |  |  |  |     **Smooth L1 Loss Operator. ** | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     This operator computes the smooth l1 loss for X and Y. |  |  |  |     This operator computes the smooth L1 loss for X and Y. | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     The operator takes the first dimension of X and Y as batch size. |  |  |  |     The operator takes the first dimension of X and Y as batch size. | 
			
		
	
		
		
			
				
					
					|  |  |  |     For each instance, it computes the smooth l1 loss element by element first |  |  |  |     For each instance, it computes the smooth L1 loss element by element first | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     and then sums all the losses. So the shape of Out is [batch_size, 1]. |  |  |  |     and then sums all the losses. So the shape of Out is [batch_size, 1]. | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     Args: |  |  |  |     Args: | 
			
		
	
		
		
			
				
					
					|  |  |  |         x (Variable): A tensor with rank at least 2. The input value of smooth |  |  |  |         x (Variable): A tensor with rank at least 2. The input value of smooth | 
			
		
	
		
		
			
				
					
					|  |  |  |             l1 loss op with shape [batch_size, dim1, ..., dimN]. |  |  |  |             L1 loss op with shape [batch_size, dim1, ..., dimN]. | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         y (Variable): A tensor with rank at least 2. The target value of smooth |  |  |  |         y (Variable): A tensor with rank at least 2. The target value of smooth | 
			
		
	
		
		
			
				
					
					|  |  |  |             l1 loss op with same shape as x. |  |  |  |             L1 loss op with same shape as x. | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         inside_weight (Variable|None):  A tensor with rank at least 2. This |  |  |  |         inside_weight (Variable|None):  A tensor with rank at least 2. This | 
			
		
	
		
		
			
				
					
					|  |  |  |             input is optional and should have same shape with x. If provided, |  |  |  |             input is optional and should have same shape with x. If provided, | 
			
		
	
		
		
			
				
					
					|  |  |  |             the result of (x - y) will be multiplied by this tensor element by |  |  |  |             the result of (x - y) will be multiplied by this tensor element by | 
			
		
	
		
		
			
				
					
					|  |  |  |             element. |  |  |  |             element. | 
			
		
	
		
		
			
				
					
					|  |  |  |         outside_weight (Variable|None): A tensor with rank at least 2. This |  |  |  |         outside_weight (Variable|None): A tensor with rank at least 2. This | 
			
		
	
		
		
			
				
					
					|  |  |  |             input is optional and should have same shape with x. If provided, |  |  |  |             input is optional and should have same shape with x. If provided, | 
			
		
	
		
		
			
				
					
					|  |  |  |             the out smooth l1 loss will be multiplied by this tensor element |  |  |  |             the out smooth L1 loss will be multiplied by this tensor element | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             by element. |  |  |  |             by element. | 
			
		
	
		
		
			
				
					
					|  |  |  |         sigma (float|None): Hyper parameter of smooth l1 loss op. A float scalar |  |  |  |         sigma (float|None): Hyper parameter of smooth L1 loss op. A float scalar | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             with default value 1.0. |  |  |  |             with default value 1.0. | 
			
		
	
		
		
			
				
					
					|  |  |  |     Returns: |  |  |  |     Returns: | 
			
		
	
		
		
			
				
					
					|  |  |  |         Variable: A tensor with rank be 2. The output smooth l1 loss with |  |  |  |         Variable: A tensor with rank be 2. The output smooth L1 loss with | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             shape [batch_size, 1]. |  |  |  |             shape [batch_size, 1]. | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     Examples: |  |  |  |     Examples: | 
			
		
	
		
		
			
				
					
					|  |  |  |         .. code-block:: python |  |  |  |         .. code-block:: python | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             data = fluid.layers.data(name='data', shape=[128], dtype='float32') |  |  |  |             data = fluid.layers.data(name='data', shape=[128], dtype='float32') | 
			
		
	
		
		
			
				
					
					|  |  |  |             label = fluid.layers.data(name='label', shape=[100], dtype='int64') |  |  |  |             label = fluid.layers.data(name='label', shape=[100], dtype='float32') | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             fc = fluid.layers.fc(input=data, size=100) |  |  |  |             fc = fluid.layers.fc(input=data, size=100) | 
			
		
	
		
		
			
				
					
					|  |  |  |             out = fluid.layers.smooth_l1(x=fc, y=label) |  |  |  |             out = fluid.layers.smooth_l1(x=fc, y=label) | 
			
		
	
		
		
			
				
					
					|  |  |  |     """ |  |  |  |     """ | 
			
		
	
	
		
		
			
				
					|  |  | @ -3769,13 +3773,13 @@ def label_smooth(label, | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | def roi_pool(input, rois, pooled_height=1, pooled_width=1, spatial_scale=1.0): |  |  |  | def roi_pool(input, rois, pooled_height=1, pooled_width=1, spatial_scale=1.0): | 
			
		
	
		
		
			
				
					
					|  |  |  |     """ |  |  |  |     """ | 
			
		
	
		
		
			
				
					
					|  |  |  |     Region of interest pooling (also known as RoI pooling) is to perform  |  |  |  |     Region of interest pooling (also known as RoI pooling) is to perform | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         is to perform max pooling on inputs of nonuniform sizes to obtain |  |  |  |         is to perform max pooling on inputs of nonuniform sizes to obtain | 
			
		
	
		
		
			
				
					
					|  |  |  |         fixed-size feature maps (e.g. 7*7). |  |  |  |         fixed-size feature maps (e.g. 7*7). | 
			
		
	
		
		
			
				
					
					|  |  |  |     The operator has three steps:  |  |  |  |     The operator has three steps: | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         1. Dividing each region proposal into equal-sized sections with  |  |  |  |         1. Dividing each region proposal into equal-sized sections with | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |            the pooled_width and pooled_height  |  |  |  |            the pooled_width and pooled_height | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         2. Finding the largest value in each section  |  |  |  |         2. Finding the largest value in each section | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         3. Copying these max values to the output buffer |  |  |  |         3. Copying these max values to the output buffer | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     Args: |  |  |  |     Args: | 
			
		
	
	
		
		
			
				
					|  |  | @ -3783,8 +3787,8 @@ def roi_pool(input, rois, pooled_height=1, pooled_width=1, spatial_scale=1.0): | 
			
		
	
		
		
			
				
					
					|  |  |  |         rois (Variable): ROIs (Regions of Interest) to pool over. It should |  |  |  |         rois (Variable): ROIs (Regions of Interest) to pool over. It should | 
			
		
	
		
		
			
				
					
					|  |  |  |                          be a 2-D one level LoTensor of shape [num_rois, 4]. |  |  |  |                          be a 2-D one level LoTensor of shape [num_rois, 4]. | 
			
		
	
		
		
			
				
					
					|  |  |  |                          The layout is [x1, y1, x2, y2], where (x1, y1) |  |  |  |                          The layout is [x1, y1, x2, y2], where (x1, y1) | 
			
		
	
		
		
			
				
					
					|  |  |  |                          is the top left coordinates, and (x2, y2) is the  |  |  |  |                          is the top left coordinates, and (x2, y2) is the | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                          bottom right coordinates. The num_rois is the  |  |  |  |                          bottom right coordinates. The num_rois is the | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                          total number of ROIs in this batch data. |  |  |  |                          total number of ROIs in this batch data. | 
			
		
	
		
		
			
				
					
					|  |  |  |         pooled_height (integer): The pooled output height. Default: 1 |  |  |  |         pooled_height (integer): The pooled output height. Default: 1 | 
			
		
	
		
		
			
				
					
					|  |  |  |         pooled_width (integer): The pooled output width. Default: 1 |  |  |  |         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): | 
			
		
	
		
		
			
				
					
					|  |  |  |                                to the scale used when pooling. Default: 1.0 |  |  |  |                                to the scale used when pooling. Default: 1.0 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     Returns: |  |  |  |     Returns: | 
			
		
	
		
		
			
				
					
					|  |  |  |         pool_out (Variable): The output is a 4-D tensor of the shape  |  |  |  |         pool_out (Variable): The output is a 4-D tensor of the shape | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                              (num_rois, channels, pooled_h, pooled_w). |  |  |  |                              (num_rois, channels, pooled_h, pooled_w). | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     Examples: |  |  |  |     Examples: | 
			
		
	
		
		
			
				
					
					|  |  |  |             pool_out = fluid.layers.roi_pool(input=x, rois=rois, 7, 7, 1.0)  |  |  |  |             pool_out = fluid.layers.roi_pool(input=x, rois=rois, 7, 7, 1.0) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     """ |  |  |  |     """ | 
			
		
	
		
		
			
				
					
					|  |  |  |     helper = LayerHelper('roi_pool', **locals()) |  |  |  |     helper = LayerHelper('roi_pool', **locals()) | 
			
		
	
		
		
			
				
					
					|  |  |  |     dtype = helper.input_dtype() |  |  |  |     dtype = helper.input_dtype() | 
			
		
	
	
		
		
			
				
					|  |  | 
 |