Exemple #1
0
def avg_pool2d(inputs,
               kernel_size,
               stride=2,
               padding='VALID',
               data_format=DATA_FORMAT_NHWC,
               outputs_collections=None,
               scope=None):
    if data_format not in (DATA_FORMAT_NCHW, DATA_FORMAT_NHWC):
        raise ValueError('data_format has to be either NCHW or NHWC.')
    df = ('channels_first' if data_format and data_format.startswith('NC')
          else 'channels_last')
    return layers.average_pooling2d(inputs=inputs,
                                    pool_size=kernel_size,
                                    strides=stride,
                                    padding=padding,
                                    data_format=df)
Exemple #2
0
def avg_pool2d(inputs,
               kernel_size,
               stride=2,
               padding='VALID',
               data_format=DATA_FORMAT_NHWC,
               outputs_collections=None,
               scope=None):
    if data_format not in (DATA_FORMAT_NCHW, DATA_FORMAT_NHWC):
        raise ValueError('data_format has to be either NCHW or NHWC.')
    df = ('channels_first'
          if data_format and data_format.startswith('NC') else 'channels_last')
    return layers.average_pooling2d(inputs=inputs,
                                    pool_size=kernel_size,
                                    strides=stride,
                                    padding=padding,
                                    data_format=df)