code: def stack_conds(tensors):
      # if prompts have wildly different lengths above the limit we'll get tensors of different shapes
      # and won't be able to torch.stack them. So this fixes that.
      token_count = max([x.shape[0] for x in tensors])
      for i in range(len(tensors)):
          if tensors[i].shape[0] != token_count:
              last_vector = tensors[i][-1:]
              last_vector_repeated = last_vector.repeat(
                  [token_count - tensors[i].shape[0], 1]
              )
              tensors[i] = torch.vstack(
                  [tensors[i], last_vector_repeated]
              )
  
      return torch.stack(tensors)
  
imports: from __future__ import annotations
  import re
  from collections import namedtuple
  import lark
label_desc: Use image node_id 6 for calling a global function with example usage: stack_conds(tensors) and returns: torch