code: def collate_tensors(stream, pad):
      """
      >>> tensors = [torch.tensor(x) for x in [[1,2,3], [1]]]
      >>> pad = 0
      >>> collate_tensors(tensors, pad)
      tensor([[1, 2, 3],
          [1, 0, 0]])
      """
      assert len(stream) > 0
  
      length = max(v.size(0) for v in stream)
      n_samples = len(stream)
  
      collated = stream[0].new_full((n_samples, length), pad)
  
      for i, v in enumerate(stream):
          collated[i, : v.size(0)] = v
  
      return collated
  
label_desc: Use image node_id 1 for calling a global function with example usage: collate_tensors(stream, pad) and returns: collated