parameters: (x, axis=None, keepdim=False, name=None)
return_statement: return out
docstring: r"""
      This OP calculates the log of the sum of exponentials of ``x`` along ``axis`` .
  
      .. math::
         logsumexp(x) = \\log\\sum exp(x)
  
      Args:
          x (Tensor): The input Tensor with data type float32 or float64, which 
              have no more than 4 dimensions.
          axis (int|list|tuple, optional): The axis along which to perform
              logsumexp calculations. ``axis`` should be int, list(int) or
              tuple(int). If ``axis`` is a list/tuple of dimension(s), logsumexp
              is calculated along all element(s) of ``axis`` . ``axis`` or
              element(s) of ``axis`` should be in range [-D, D), where D is the
              dimensions of ``x`` . If ``axis`` or element(s) of ``axis`` is
              less than 0, it works the same way as :math:`axis + D` . If
              ``axis`` is None, logsumexp is calculated along all elements of
              ``x``. Default is None.
          keepdim (bool, optional): Whether to reserve the reduced dimension(s)
              in the output Tensor. If ``keep_dim`` is True, the dimensions of
              the output Tensor is the same as ``x`` except in the reduced
              dimensions(it is of size 1 in this case). Otherwise, the shape of
              the output Tensor is squeezed in ``axis`` . Default is False.
          name (str, optional): Name for the operation (optional, default is None).
              For more information, please refer to :ref:`api_guide_Name`.
  
      Returns:
          Tensor, results of logsumexp along ``axis`` of ``x``, with the same data
          type as ``x``.
  
      Examples:
  
      .. code-block:: python
  
          import paddle
  
          x = paddle.to_tensor([[-1.5, 0., 2.], [3., 1.2, -2.4]])
          out1 = paddle.logsumexp(x) # [3.4691226]
          out2 = paddle.logsumexp(x, 1) # [2.15317821, 3.15684602]
docstring_summary: r"""
      This OP calculates the log of the sum of exponentials of ``x`` along ``axis`` .
docstring_tokens: r This OP calculates the log of the sum of exponentials of x along axis .
function: def logsumexp(x, axis=None, keepdim=False, name=None):
      r"""
      This OP calculates the log of the sum of exponentials of ``x`` along ``axis`` .
  
      .. math::
         logsumexp(x) = \\log\\sum exp(x)
  
      Args:
          x (Tensor): The input Tensor with data type float32 or float64, which 
              have no more than 4 dimensions.
          axis (int|list|tuple, optional): The axis along which to perform
              logsumexp calculations. ``axis`` should be int, list(int) or
              tuple(int). If ``axis`` is a list/tuple of dimension(s), logsumexp
              is calculated along all element(s) of ``axis`` . ``axis`` or
              element(s) of ``axis`` should be in range [-D, D), where D is the
              dimensions of ``x`` . If ``axis`` or element(s) of ``axis`` is
              less than 0, it works the same way as :math:`axis + D` . If
              ``axis`` is None, logsumexp is calculated along all elements of
              ``x``. Default is None.
          keepdim (bool, optional): Whether to reserve the reduced dimension(s)
              in the output Tensor. If ``keep_dim`` is True, the dimensions of
              the output Tensor is the same as ``x`` except in the reduced
              dimensions(it is of size 1 in this case). Otherwise, the shape of
              the output Tensor is squeezed in ``axis`` . Default is False.
          name (str, optional): Name for the operation (optional, default is None).
              For more information, please refer to :ref:`api_guide_Name`.
  
      Returns:
          Tensor, results of logsumexp along ``axis`` of ``x``, with the same data
          type as ``x``.
  
      Examples:
  
      .. code-block:: python
  
          import paddle
  
          x = paddle.to_tensor([[-1.5, 0., 2.], [3., 1.2, -2.4]])
          out1 = paddle.logsumexp(x) # [3.4691226]
          out2 = paddle.logsumexp(x, 1) # [2.15317821, 3.15684602]
  
      """
      if isinstance(axis, int):
          axis = [axis]
      reduce_all = True if axis is None \
          or len(axis)==0 \
          or len(axis) == len(x.shape) else False
      if axis is None or len(axis) == 0:
          axis = [0]
  
      if in_dygraph_mode():
          return _C_ops.logsumexp(x, 'axis', axis, 'keepdim', keepdim, 'reduce_all', reduce_all)
  
      check_variable_and_dtype(x, 'x',
                               ['float32', 'float64'],
                               'logsumexp')
  
      helper = LayerHelper('logsumexp', **locals())
      attrs = {'axis': axis, 'keepdim': keepdim, 'reduce_all':reduce_all}
      out = helper.create_variable_for_type_inference(x.dtype)
      helper.append_op(
          type='logsumexp', inputs={'X': x}, outputs={'Out': out}, attrs=attrs)
      return out
function_tokens: def logsumexp ( x , axis = None , keepdim = False , name = None ) : if isinstance ( axis , int ) : axis = [ axis ] reduce_all = True if axis is None or len ( axis ) == 0 or len ( axis ) == len ( x . shape ) else False if axis is None or len ( axis ) == 0 : axis = [ 0 ] if in_dygraph_mode ( ) : return _C_ops . logsumexp ( x , 'axis' , axis , 'keepdim' , keepdim , 'reduce_all' , reduce_all ) check_variable_and_dtype ( x , 'x' , [ 'float32' , 'float64' ] , 'logsumexp' ) helper = LayerHelper ( 'logsumexp' , * * locals ( ) ) attrs = { 'axis' : axis , 'keepdim' : keepdim , 'reduce_all' : reduce_all } out = helper . create_variable_for_type_inference ( x . dtype ) helper . append_op ( type = 'logsumexp' , inputs = { 'X' : x } , outputs = { 'Out' : out } , attrs = attrs ) return out