code: def get_mini_batch_mask(mini_batch, seq_lengths):
      mask = torch.zeros(mini_batch.shape[0:2])
      for b in range(mini_batch.shape[0]):
          mask[b, 0 : seq_lengths[b]] = torch.ones(seq_lengths[b])
      return mask
  
file_path: pyro/pyro/contrib/examples/polyphonic_data_loader.py
imports: import os
  import pickle
  from collections import namedtuple
  from urllib.request import urlopen
  import torch
  import torch.nn
  from torch.nn.utils.rnn import pad_sequence
  from pyro.contrib.examples.util import get_data_directory
label_desc: Use image node_id 5 for calling a global function with example usage: get_mini_batch_mask(mini_batch, seq_lengths) and returns: mask