code: def log_sum_exp(vec, m_size):
      """
      calculate log of exp sum
      args:
          vec (batch_size, vanishing_dim, hidden_dim) : input tensor
          m_size : hidden_dim
      return:
          batch_size, hidden_dim
      """
      _, idx = torch.max(vec, 1)  # B * 1 * M
      max_score = torch.gather(vec, 1, idx.view(-1, 1, m_size)).view(
          -1, 1, m_size
      )  # B * M
      return max_score.view(-1, m_size) + torch.log(
          torch.sum(torch.exp(vec - max_score.expand_as(vec)), 1)
      ).view(-1, m_size)
  
file_path: DeepKE/src/deepke/event_extraction/standard/bertcrf/crf.py
imports: import torch
  import torch.autograd
  import torch.nn
label_desc: Use image node_id 1 for calling a global function with example usage: log_sum_exp(vec, m_size) and returns: unknown