docstr: Differentiable LogSumExp: Does not creates nan gradients
      when all the inputs are -inf yeilds 0 gradients.
  Args:
      x : torch.Tensor -  The input tensor
      dim: int - The dimension on which the log sum exp has to be applied
docstr_tok: ["Differentiable","LogSumExp",":","Does","not","creates","nan","gradients","when","all","the","inputs","are","-inf","yeilds","0","gradients",".","Args",":","x",":","torch.Tensor","-","The","input","tensor","dim",":","int","-","The","dimension","on","which","the","log","sum","exp","has","to","be","applied"]
code: def logsumexp(x, dim):
      r"""
      Differentiable LogSumExp: Does not creates nan gradients
          when all the inputs are -inf yeilds 0 gradients.
      Args:
          x : torch.Tensor -  The input tensor
          dim: int - The dimension on which the log sum exp has to be applied
      """
  
      m, _ = x.max(dim=dim)
      mask = m == -float("inf")
      s = (
          (x - m.masked_fill_(mask, 0).unsqueeze(dim=dim))
          .exp()
          .sum(dim=dim)
      )
      return s.masked_fill_(mask, 1).log() + m.masked_fill_(
          mask, -float("inf")
      )
  
imports: from typing import List, Tuple
  import torch
  import torch.nn.functional
  from torch import nn
  from tqdm.auto import tqdm
  from TTS.tts.layers.tacotron.common_layers import Linear
  from TTS.tts.layers.tacotron.tacotron2 import ConvBNBlock
label_desc: Use image node_id 6 for calling the OverflowUtils obj's underlying member method code with example usage: obj.logsumexp(x, dim) and returns: unknown