parameters: (x,
             pool_size,
             strides=(1, 1),
             padding='valid',
             data_format=None,
             pool_mode='max')
return_statement: return _postprocess_conv2d_output(x, data_format)
docstring: 2D Pooling.
  
    Arguments:
        x: Tensor or variable.
        pool_size: tuple of 2 integers.
        strides: tuple of 2 integers.
        padding: one of `"valid"`, `"same"`.
        data_format: one of `"channels_first"`, `"channels_last"`.
        pool_mode: one of `"max"`, `"avg"`.
  
    Returns:
        A tensor, result of 2D pooling.
  
    Raises:
        ValueError: if `data_format` is neither `channels_last` or
        `channels_first`.
        ValueError: if `pool_mode` is neither `max` or `avg`.
docstring_summary: 2D Pooling.
docstring_tokens: 2D Pooling .
function: def pool2d(x,
             pool_size,
             strides=(1, 1),
             padding='valid',
             data_format=None,
             pool_mode='max'):
    """2D Pooling.
  
    Arguments:
        x: Tensor or variable.
        pool_size: tuple of 2 integers.
        strides: tuple of 2 integers.
        padding: one of `"valid"`, `"same"`.
        data_format: one of `"channels_first"`, `"channels_last"`.
        pool_mode: one of `"max"`, `"avg"`.
  
    Returns:
        A tensor, result of 2D pooling.
  
    Raises:
        ValueError: if `data_format` is neither `channels_last` or
        `channels_first`.
        ValueError: if `pool_mode` is neither `max` or `avg`.
    """
    if data_format is None:
      data_format = image_data_format()
    if data_format not in {'channels_first', 'channels_last'}:
      raise ValueError('Unknown data_format ' + str(data_format))
  
    padding = _preprocess_padding(padding)
    strides = (1,) + strides + (1,)
    pool_size = (1,) + pool_size + (1,)
  
    x = _preprocess_conv2d_input(x, data_format)
  
    if pool_mode == 'max':
      x = nn.max_pool(x, pool_size, strides, padding=padding)
    elif pool_mode == 'avg':
      x = nn.avg_pool(x, pool_size, strides, padding=padding)
    else:
      raise ValueError('Invalid pooling mode:', pool_mode)
  
    return _postprocess_conv2d_output(x, data_format)
function_tokens: def pool2d ( x , pool_size , strides = ( 1 , 1 ) , padding = 'valid' , data_format = None , pool_mode = 'max' ) : if data_format is None : data_format = image_data_format ( ) if data_format not in { 'channels_first' , 'channels_last' } : raise ValueError ( 'Unknown data_format ' + str ( data_format ) ) padding = _preprocess_padding ( padding ) strides = ( 1 , ) + strides + ( 1 , ) pool_size = ( 1 , ) + pool_size + ( 1 , ) x = _preprocess_conv2d_input ( x , data_format ) if pool_mode == 'max' : x = nn . max_pool ( x , pool_size , strides , padding = padding ) elif pool_mode == 'avg' : x = nn . avg_pool ( x , pool_size , strides , padding = padding ) else : raise ValueError ( 'Invalid pooling mode:' , pool_mode ) return _postprocess_conv2d_output ( x , data_format )