nets.py 758 字节
Newer Older
F
fengjiayi 已提交
1 2 3 4 5 6 7 8 9
import paddle.v2.framework.layers as layers


def simple_img_conv_pool(input,
                         filter_size,
                         num_filters,
                         pool_size,
                         pool_stride,
                         act,
F
fengjiayi 已提交
10 11
                         program=None,
                         init_program=None):
F
fengjiayi 已提交
12 13 14 15 16
    conv_out = layers.conv2d(
        input=input,
        num_filters=num_filters,
        filter_size=filter_size,
        act=act,
F
fengjiayi 已提交
17 18
        program=program,
        init_program=init_program)
F
fengjiayi 已提交
19 20 21 22 23 24

    pool_out = layers.pool2d(
        input=conv_out,
        pool_size=pool_size,
        pool_type='max',
        pool_stride=pool_stride,
F
fengjiayi 已提交
25 26
        program=program,
        init_program=init_program)
F
fengjiayi 已提交
27
    return pool_out