img_conv_group(input, conv_num_filter, pool_size, conv_padding=1, conv_filter_size=3, conv_act=None, param_attr=None, conv_with_batchnorm=False, conv_batchnorm_drop_rate=0.0, pool_stride=1, pool_type='max', use_cudnn=True)
The Image Convolution Group is composed of Convolution2d, BatchNorm, DropOut, and Pool2d. According to the input arguments, img_conv_group will do serials of computation for Input using Convolution2d, BatchNorm, DropOut, and pass the last result to Pool2d.
input (Variable) – The input is 4-D Tensor with shape [N, C, H, W], the data type of input is float32 or float64.
conv_num_filter (list|tuple) – Indicates the numbers of filter of this group.
pool_size (int|list|tuple) – The pooling size of Pool2d Layer. If pool_size is a list or tuple, it must contain two integers, (pool_size_height, pool_size_width). Otherwise, the pool_size_height = pool_size_width = pool_size.
conv_padding (int|list|tuple) – The padding size of the Conv2d Layer. If padding is a list or tuple, its length must be equal to the length of conv_num_filter. Otherwise the conv_padding of all Conv2d Layers are the same. Default 1.
conv_filter_size (int|list|tuple) – The filter size. If filter_size is a list or tuple, its length must be equal to the length of conv_num_filter. Otherwise the conv_filter_size of all Conv2d Layers are the same. Default 3.
conv_act (str) – Activation type for Conv2d Layer that is not followed by BatchNorm. Default: None.
param_attr (ParamAttr) – The parameters to the Conv2d Layer. Default: None
conv_with_batchnorm (bool|list) – Indicates whether to use BatchNorm after Conv2d Layer. If conv_with_batchnorm is a list, its length must be equal to the length of conv_num_filter. Otherwise, conv_with_batchnorm indicates whether all the Conv2d Layer follows a BatchNorm. Default False.
conv_batchnorm_drop_rate (float|list) – Indicates the drop_rate of Dropout Layer after BatchNorm. If conv_batchnorm_drop_rate is a list, its length must be equal to the length of conv_num_filter. Otherwise, drop_rate of all Dropout Layers is conv_batchnorm_drop_rate. Default 0.0.
pool_stride (int|list|tuple) – The pooling stride of Pool2d layer. If pool_stride is a list or tuple, it must contain two integers, (pooling_stride_H, pooling_stride_W). Otherwise, the pooling_stride_H = pooling_stride_W = pool_stride. Default 1.
pool_type (str) – Pooling type can be \(max\) for max-pooling and \(avg\) for average-pooling. Default \(max\).
use_cudnn (bool) – Use cudnn kernel or not, it is valid only when the cudnn library is installed. Default: True
A Variable holding Tensor representing the final result after serial computation using Convolution2d, BatchNorm, DropOut, and Pool2d, whose data type is the same with input.
import paddle.fluid as fluid img = fluid.data(name='img', shape=[None, 1, 28, 28], dtype='float32') conv_pool = fluid.nets.img_conv_group(input=img, conv_padding=1, conv_num_filter=[3, 3], conv_filter_size=3, conv_act="relu", pool_size=2, pool_stride=2)