code: def weighted_softmax(v, w):
      # to avoid NaN...
      v = v - torch.max(v, dim=-1, keepdim=True)[0]
      v = torch.exp(v) + 1e-8  # to avoid NaN...
      v_sum = torch.sum(
          (v[..., :-1] + v[..., 1:]) / 2 * w, dim=-1, keepdim=True
      )
      return v / v_sum
  
file_path: NeMo/nemo/collections/tts/parts/utils/splines.py
imports: import numpy
  import torch
  import torch.nn.functional
label_desc: Use image node_id 4 for calling a global function with example usage: weighted_softmax(v, w) and returns: unknown