code: def unpack_constraints(
      constraint_tensor: torch.Tensor,
  ) -> List[torch.Tensor]:
      """
      Transforms *one row* of a packed constraint tensor (e.g., for one
      sentence in the batch) into a list of constraint tensors.
      """
      constraint_list = []
      num_constraints = constraint_tensor[0]
      constraints = constraint_tensor.tolist()
      offset = 1
      for i in range(num_constraints):
          where = constraints.index(0, offset)
          constraint_list.append(constraint_tensor[offset:where])
          offset = where + 1
  
      return constraint_list
  
imports: from collections import Counter
  from typing import List, Optional, Set, Tuple
  import torch
label_desc: Use image node_id 2 for calling a global function with example usage: unpack_constraints(constraint_tensor) and returns: constraint_list