class_docstr: A batch of series from different base datasets, represented by the padded batch, the lengths of the series
  and the splits sizes indicating the corresponding base dataset.
class_docstr_tok: ["A","batch","of","series","from","different","base","datasets",",","represented","by","the","padded","batch",",","the","lengths","of","the","series","and","the","splits","sizes","indicating","the","corresponding","base","dataset","."]
docstr: Unpad sequences in batch by using the lengths.
docstr_tok: ["Unpad","sequences","in","batch","by","using","the","lengths","."]
code: def unpad(self, to_numpy: bool = False, squeeze: bool = False):
      """
      Unpad sequences in batch by using the lengths.
      """
      t = tensor_to_np if to_numpy else lambda x: x
      sq = torch.squeeze if squeeze else lambda x: x
  
      splits = torch.split(self.sequences, self.split_sections.tolist())
      lengths = torch.split(self.lengths, self.split_sections.tolist())
      out = []
      for l_split, split in zip(lengths, splits):
          un_padded = [t(sq(s[:l])) for l, s in zip(l_split, split)]
          if squeeze:
              out.extend(un_padded)
          else:
              out.append(un_padded)
      return out
  
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 3 for calling the SeriesBatch obj's underlying member method code with example usage: obj.unpad(to_numpy, squeeze) and returns: out