code: def pack_sequence(sequences, batch_first=False, enforce_sorted=True):
      """Pack a list of variable-length Variables.
  
      This method packs a list of variable-length Variables.
  
      :math:`T_i` is the length of the :math:`i`-th Variable in the sequences.
      :math:`T` is the max of :math:`T_i` for all :math:`i`.
      :math:`B` is the batch size equal to the length of the sequences.
      :math:`*` is the remaining dimensions including none.
  
      .. note::
        This function **must** be used the dynamic computation mode.
  
      Example:
  
      .. code-block:: python
  
        import numpy as np
        import nnabla as nn
        import nnabla.functions as F
        import nnabla.utils.rnn as rnn_utils
  
        nn.set_auto_forward(True)
  
        l2v = lambda ldata: nn.Variable.from_numpy_array(np.asarray(ldata))
        a = l2v([3, 3])
        b = l2v([2, 2, 2])
        c = l2v([2, 2, 2])
        d = l2v([1, 1, 1, 1])
        e = l2v([3, 3])
        sequences = [a, b, c, d, e]
  
        packed_sequence = rnn_utils.pack_sequence(sequences, enforce_sorted=False)
        print(packed_sequence.data.d)
        print(packed_sequence.batch_sizes.d)
  
      Args:
        sequences (list of :obj:`nnabla.Variable`): List of :obj:`nnabla.Variable` of (:math:`T_i`, :math:`*`) shape.
        enforce_sorted (bool): Sequences are sorted by the length in a decreasing order if True. Default is True.
  
      Returns:
          :obj:`PackedSequence`: packed_sequence
      """
      pad_sequences = pad_sequence(sequences)
      lengths = np.array([sequence.shape[0] for sequence in sequences])
      lengths = nn.Variable.from_numpy_array(lengths)
      packed_sequence = pack_padded_sequence(
          pad_sequences, lengths, enforce_sorted=enforce_sorted
      )
      return packed_sequence
  
file_path: nnabla/python/src/nnabla/utils/rnn.py
imports: import nnabla
  import nnabla.functions
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: pack_sequence(sequences, batch_first, enforce_sorted) and returns: packed_sequence