code: def __init__(self, width, height, stride_w, stride_h):
      """Initializes a Stride2D instance.
  
      Args:
          width: The width of the 3D input "image".
          height: The height of the 3D input "image".
          stride_w: The stride in width direction, with which to stride the incoming
              image.
          stride_h: The stride in height direction, with which to stride the incoming
              image.
      """
      super().__init__()
  
      self.width = width
      self.height = height
      self.stride_w = stride_w
      self.stride_h = stride_h
  
      self.zeros = torch.zeros(
          size=(
              self.width * self.stride_w - (self.stride_w - 1),
              self.height * self.stride_h - (self.stride_h - 1),
          ),
          dtype=torch.float32,
      )
      self.out_width, self.out_height = (
          self.zeros.shape[0],
          self.zeros.shape[1],
      )
      # Squeeze in batch and channel dims.
      self.zeros = self.zeros.unsqueeze(0).unsqueeze(0)
  
      self.where_template = torch.zeros(
          (self.stride_w, self.stride_h), dtype=torch.float32
      )
      # Set upper/left corner to 1.0.
      self.where_template[0][0] = 1.0
      # then tile across the entire (strided) image size.
      self.where_template = self.where_template.repeat(
          (self.height, self.width)
      )[: -(self.stride_w - 1), : -(self.stride_h - 1)]
      # Squeeze in batch and channel dims and convert to bool.
      self.where_template = (
          self.where_template.unsqueeze(0).unsqueeze(0).bool()
      )
  
imports: from ray.rllib.utils.framework import try_import_torch
label_desc: Use image node_id 1 to create a new Stride2D object from inherited base classes: nn with example: obj = Stride2D(width, height, stride_w, stride_h)