code: def _zero_pad_sequences(
      sequences: List[torch.Tensor], side: str = "left"
  ) -> torch.Tensor:
      assert side in ("left", "right")
      max_len = max(seq.size(0) for seq in sequences)
      padded_sequences = []
      for seq in sequences:
          pad_len = max_len - seq.size(0)
          padding = (pad_len, 0) if side == "left" else (0, pad_len)
          padded_sequences.append(F.pad(seq, padding))
      return torch.stack(padded_sequences, dim=0)
  
file_path: ColossalAI/applications/Chat/coati/experience_buffer/utils.py
imports: from dataclasses import dataclass
  from typing import List, Optional
  import torch
  import torch.nn.functional
  from coati.experience_maker.base import Experience
label_desc: Use image node_id 2 for calling a global function with example usage: _zero_pad_sequences(sequences, side) and returns: torch