class_docstr: A triplet batch, composed of a batch of support sets, query contexts and prediction horizons.
  Compared to a simple triplet, it also manages the lengths of all samples.
class_docstr_tok: ["A","triplet","batch",",","composed","of","a","batch","of","support","sets",",","query","contexts","and","prediction","horizons",".","Compared","to","a","simple","triplet",",","it","also","manages","the","lengths","of","all","samples","."]
docstr: Combines a list of triplets into a batched triplet to pass to a network.
docstr_tok: ["Combines","a","list","of","triplets","into","a","batched","triplet","to","pass","to","a","network","."]
code: def collate(cls, triplets: List[Triplet]) -> TripletBatch:
      """
      Combines a list of triplets into a batched triplet to pass to a network.
      """
      s, p, f = zip(*triplets)
      return TripletBatch(
          SeriesBatch.from_lists(list(s)),
          SeriesBatch.from_lists(list(p)),
          SeriesBatch.from_lists(list(f), squeeze=True),
      )
  
imports: from __future__ import annotations
  from dataclasses import dataclass
  from typing import List, Optional
  import torch
  from torch.nn.utils.rnn import pad_sequence
  from .sampling import Triplet
  from .dataset import TimeSeries
  from meta.common.torch import tensor_to_np
label_desc: Use image node_id 1 for calling the TripletBatch obj's underlying member method code with example usage: obj.collate(cls, triplets) and returns: TripletBatch