class_docstr: A striding layer for doing torch Conv2DTranspose operations.
  
  Using this layer before the 0-padding (on a 3D input "image") and before
  the actual ConvTranspose2d allows for a padding="same" behavior that matches
  100% that of a `tf.keras.layers.Conv2DTranspose` layer.
  
  Examples:
      Input image (4x4):
      A B C D
      E F G H
      I J K L
      M N O P
  
      Stride with stride=2 -> output image=(7x7)
      A 0 B 0 C 0 D
      0 0 0 0 0 0 0
      E 0 F 0 G 0 H
      0 0 0 0 0 0 0
      I 0 J 0 K 0 L
      0 0 0 0 0 0 0
      M 0 N 0 O 0 P
class_docstr_tok: ["A","striding","layer","for","doing","torch","Conv2DTranspose","operations",".","Using","this","layer","before","the","0-padding","(","on","a","3D","input","``","image","''",")","and","before","the","actual","ConvTranspose2d","allows","for","a","padding=","''","same","''","behavior","that","matches","100","%","that","of","a","`","tf.keras.layers.Conv2DTranspose","`","layer",".","Examples",":","Input","image","(","4x4",")",":","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Stride","with","stride=2","-",">","output","image=","(","7x7",")","A","0","B","0","C","0","D","0","0","0","0","0","0","0","E","0","F","0","G","0","H","0","0","0","0","0","0","0","I","0","J","0","K","0","L","0","0","0","0","0","0","0","M","0","N","0","O","0","P"]
docstr: 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.
docstr_tok: ["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","."]
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)