class_docstr: Computes the context window.
  
  This class applies a context window by gathering multiple time steps
  in a single feature vector. The operation is performed with a
  convolutional layer based on a fixed kernel designed for that.
  
  Arguments
  ---------
  left_frames : int
       Number of left frames (i.e, past frames) to collect.
  right_frames : int
      Number of right frames (i.e, future frames) to collect.
  
  Example
  -------
  >>> import torch
  >>> compute_cw = ContextWindow(left_frames=5, right_frames=5)
  >>> inputs = torch.randn([10, 101, 20])
  >>> features = compute_cw(inputs)
  >>> features.shape
  torch.Size([10, 101, 220])
class_docstr_tok: ["Computes","the","context","window",".","This","class","applies","a","context","window","by","gathering","multiple","time","steps","in","a","single","feature","vector",".","The","operation","is","performed","with","a","convolutional","layer","based","on","a","fixed","kernel","designed","for","that",".","Arguments","--","--","--","--","-","left_frames",":","int","Number","of","left","frames","(","i.e",",","past","frames",")","to","collect",".","right_frames",":","int","Number","of","right","frames","(","i.e",",","future","frames",")","to","collect",".","Example","--","--","--","-",">",">",">","import","torch",">",">",">","compute_cw","=","ContextWindow","(","left_frames=5",",","right_frames=5",")",">",">",">","inputs","=","torch.randn","(","[","10",",","101",",","20","]",")",">",">",">","features","=","compute_cw","(","inputs",")",">",">",">","features.shape","torch.Size","(","[","10",",","101",",","220","]",")"]
code: def __init__(
      self,
      left_frames=0,
      right_frames=0,
  ):
      super().__init__()
      self.left_frames = left_frames
      self.right_frames = right_frames
      self.context_len = self.left_frames + self.right_frames + 1
      self.kernel_len = 2 * max(self.left_frames, self.right_frames) + 1
  
      # Kernel definition
      self.kernel = torch.eye(self.context_len, self.kernel_len)
  
      if self.right_frames > self.left_frames:
          lag = self.right_frames - self.left_frames
          self.kernel = torch.roll(self.kernel, lag, 1)
  
      self.first_call = True
  
imports: import math
  import torch
  import logging
  from speechbrain.utils.checkpoints import mark_as_saver, mark_as_loader, mark_as_transfer, register_checkpoint_hooks
  from speechbrain.dataio.dataio import length_to_mask
label_desc: Use image node_id 1 to create a new ContextWindow object from inherited base classes: torch.nn with example: obj = ContextWindow(left_frames, right_frames)