parameters: (input, ksize, strides, padding, data_format=None, name=None)
return_statement: return op(
        input,
        ksize=ksize,
        strides=strides,
        padding=padding,
        data_format=data_format,
        name=name)
docstring: Performs the max pooling on the input.
  
    Args:
      input:  Tensor of rank N+2, of shape `[batch_size] + input_spatial_shape +
        [num_channels]` if `data_format` does not start with "NC" (default), or
        `[batch_size, num_channels] + input_spatial_shape` if data_format starts
        with "NC". Pooling happens over the spatial dimensions only.
      ksize: An int or list of `ints` that has length `1`, `N` or `N+2`. The size
        of the window for each dimension of the input tensor.
      strides: An int or list of `ints` that has length `1`, `N` or `N+2`. The
        stride of the sliding window for each dimension of the input tensor.
      padding: A string, either `'VALID'` or `'SAME'`. The padding algorithm. See
        the "returns" section of `tf.nn.convolution` for details.
      data_format: A string. Specifies the channel dimension. For N=1 it can be
        either "NWC" (default) or "NCW", for N=2 it can be either "NHWC" (default)
        or "NCHW" and for N=3 either "NDHWC" (default) or "NCDHW".
      name: Optional name for the operation.
  
    Returns:
      A `Tensor` of format specified by `data_format`.
      The max pooled output tensor.
docstring_summary: Performs the max pooling on the input.
docstring_tokens: Performs the max pooling on the input .
function: def max_pool_v2(input, ksize, strides, padding, data_format=None, name=None):
    """Performs the max pooling on the input.
  
    Args:
      input:  Tensor of rank N+2, of shape `[batch_size] + input_spatial_shape +
        [num_channels]` if `data_format` does not start with "NC" (default), or
        `[batch_size, num_channels] + input_spatial_shape` if data_format starts
        with "NC". Pooling happens over the spatial dimensions only.
      ksize: An int or list of `ints` that has length `1`, `N` or `N+2`. The size
        of the window for each dimension of the input tensor.
      strides: An int or list of `ints` that has length `1`, `N` or `N+2`. The
        stride of the sliding window for each dimension of the input tensor.
      padding: A string, either `'VALID'` or `'SAME'`. The padding algorithm. See
        the "returns" section of `tf.nn.convolution` for details.
      data_format: A string. Specifies the channel dimension. For N=1 it can be
        either "NWC" (default) or "NCW", for N=2 it can be either "NHWC" (default)
        or "NCHW" and for N=3 either "NDHWC" (default) or "NCDHW".
      name: Optional name for the operation.
  
    Returns:
      A `Tensor` of format specified by `data_format`.
      The max pooled output tensor.
    """
    if input.shape is not None:
      n = len(input.shape) - 2
    elif data_format is not None:
      n = len(data_format) - 2
    else:
      raise ValueError(
          "The input must have a rank or a data format must be given.")
    if not 1 <= n <= 3:
      raise ValueError(
          "Input tensor must be of rank 3, 4 or 5 but was {}.".format(n + 2))
  
    if data_format is None:
      channel_index = n + 1
    else:
      channel_index = 1 if data_format.startswith("NC") else n + 1
  
    ksize = _get_sequence(ksize, n, channel_index, "ksize")
    strides = _get_sequence(strides, n, channel_index, "strides")
  
    max_pooling_ops = {
        1: max_pool1d,
        2: gen_nn_ops.max_pool,
        3: gen_nn_ops.max_pool3d
    }
  
    op = max_pooling_ops[n]
    return op(
        input,
        ksize=ksize,
        strides=strides,
        padding=padding,
        data_format=data_format,
        name=name)
function_tokens: def max_pool_v2 ( input , ksize , strides , padding , data_format = None , name = None ) : if input . shape is not None : n = len ( input . shape ) - 2 elif data_format is not None : n = len ( data_format ) - 2 else : raise ValueError ( "The input must have a rank or a data format must be given." ) if not 1 <= n <= 3 : raise ValueError ( "Input tensor must be of rank 3, 4 or 5 but was {}." . format ( n + 2 ) ) if data_format is None : channel_index = n + 1 else : channel_index = 1 if data_format . startswith ( "NC" ) else n + 1 ksize = _get_sequence ( ksize , n , channel_index , "ksize" ) strides = _get_sequence ( strides , n , channel_index , "strides" ) max_pooling_ops = { 1 : max_pool1d , 2 : gen_nn_ops . max_pool , 3 : gen_nn_ops . max_pool3d } op = max_pooling_ops [ n ] return op ( input , ksize = ksize , strides = strides , padding = padding , data_format = data_format , name = name )