def __init__(self, pool_size=(2, 2), strides=None, padding='valid', data_format='default'):
        if data_format == 'default':
            data_format = default_data_format
        assert data_format in {'channels_last', 'channels_first'}, 'data_format must be in {channels_last, channels_first}'
        self.pool_size = tuple(pool_size)
        if strides is None:
            strides = self.pool_size
        self.strides = tuple(strides)
        assert padding in {'valid', 'same'}, 'border_mode must be in {valid, same}'
        self.border_mode = padding
        self.dim_ordering = data_format