code: def generate_path(duration, mask):
      """
      Shapes:
          - duration: :math:`[B, T_en]`
          - mask: :math:'[B, T_en, T_de]`
          - path: :math:`[B, T_en, T_de]`
      """
      b, t_x, t_y = mask.shape
      cum_duration = torch.cumsum(duration, 1)
  
      cum_duration_flat = cum_duration.view(b * t_x)
      path = sequence_mask(cum_duration_flat, t_y).to(mask.dtype)
      path = path.view(b, t_x, t_y)
      path = (
          path
          - F.pad(path, convert_pad_shape([[0, 0], [1, 0], [0, 0]]))[
              :, :-1
          ]
      )
      path = path * mask
      return path
  
imports: import numpy
  import torch
  from scipy.stats import betabinom
  from torch.nn import functional
label_desc: Use image node_id 6 for calling a global function with example usage: generate_path(duration, mask) and returns: path