class_docstr: A block containing multiple subsequent strided convolution layers.
  
  One layer consists of a single strided convolution followed by an activation function.
  The block expects the input tensors to have the from (batch-dim, channel-dim, row-dim, column-dim).
  
  :param in_keys: One key identifying the input tensors.
  :param out_keys: One key identifying the output tensors.
  :param in_shapes: List of input shapes.
  :param hidden_channels: List containing the number of hidden channels for hidden layers.
  :param hidden_kernels: List containing the size of the convolving kernels.
  :param non_lin: The non-linearity to apply after each layer.
  :param convolution_dimension: Dimension of the convolution to use [1, 2, 3]
  :param hidden_strides: List containing the strides of the convolutions.
  :param hidden_dilations: List containing the spacing between kernel elements.
  :param hidden_padding: List containing the padding added to both sides of the input
  :param padding_mode: 'zeros', 'reflect', 'replicate' or 'circular'.
class_docstr_tok: ["A","block","containing","multiple","subsequent","strided","convolution","layers",".","One","layer","consists","of","a","single","strided","convolution","followed","by","an","activation","function",".","The","block","expects","the","input","tensors","to","have","the","from","(","batch-dim",",","channel-dim",",","row-dim",",","column-dim",")",".",":","param","in_keys",":","One","key","identifying","the","input","tensors",".",":","param","out_keys",":","One","key","identifying","the","output","tensors",".",":","param","in_shapes",":","List","of","input","shapes",".",":","param","hidden_channels",":","List","containing","the","number","of","hidden","channels","for","hidden","layers",".",":","param","hidden_kernels",":","List","containing","the","size","of","the","convolving","kernels",".",":","param","non_lin",":","The","non-linearity","to","apply","after","each","layer",".",":","param","convolution_dimension",":","Dimension","of","the","convolution","to","use","[","1",",","2",",","3","]",":","param","hidden_strides",":","List","containing","the","strides","of","the","convolutions",".",":","param","hidden_dilations",":","List","containing","the","spacing","between","kernel","elements",".",":","param","hidden_padding",":","List","containing","the","padding","added","to","both","sides","of","the","input",":","param","padding_mode",":","'zeros","'",",","'reflect","'",",","'replicate","'","or","'circular","'","."]
code: def __init__(
      self,
      in_keys: Union[str, List[str]],
      out_keys: Union[str, List[str]],
      in_shapes: Union[Sequence[int], List[Sequence[int]]],
      hidden_channels: List[int],
      hidden_kernels: List[Union[int, Tuple[int, ...]]],
      non_lin: Union[str, type(nn.Module)],
      convolution_dimension: int,
      hidden_strides: Optional[List[Union[int, Tuple[int, ...]]]],
      hidden_dilations: Optional[List[Union[int, Tuple[int, ...]]]],
      hidden_padding: Optional[List[Union[int, Tuple[int, ...]]]],
      padding_mode: Optional[str],
  ):
      assert convolution_dimension in [1, 2, 3]
      if convolution_dimension == 1:
          self.convolution_nn = nn.Conv1d
          in_out_num_dims = 3
          for hk in hidden_kernels:
              assert isinstance(hk, int)
      elif convolution_dimension == 2:
          self.convolution_nn = nn.Conv2d
          in_out_num_dims = 4
          for hk in hidden_kernels:
              assert isinstance(hk, int) or len(hk) == 2
      else:
          self.convolution_nn = nn.Conv3d
          in_out_num_dims = 5
          for hk in hidden_kernels:
              assert isinstance(hk, int) or len(hk) == 3
  
      super().__init__(
          in_keys=in_keys,
          out_keys=out_keys,
          in_shapes=in_shapes,
          in_num_dims=in_out_num_dims,
          out_num_dims=in_out_num_dims,
      )
  
      self.convolutional_dim = convolution_dimension
      self.input_channels = self.in_shapes[0][-(in_out_num_dims - 1)]
  
      self.hidden_channels = hidden_channels
      self.hidden_kernels = hidden_kernels
      self.non_lin = Factory(base_type=nn.Module).type_from_name(
          non_lin
      )
      self.output_channels = self.hidden_channels[-1]
  
      # Optional arguments
      num_layers = len(self.hidden_channels)
      self.hidden_strides = (
          hidden_strides
          if hidden_strides is not None
          else [1 for _ in range(num_layers)]
      )
      self.hidden_dilations = (
          hidden_dilations
          if hidden_dilations is not None
          else [1 for _ in range(num_layers)]
      )
      self.hidden_padding = (
          hidden_padding
          if hidden_padding is not None
          else [0 for _ in range(num_layers)]
      )
      self.padding_mode = (
          padding_mode if padding_mode is not None else "zeros"
      )
  
      # checks
      assert self.padding_mode in [
          "zeros",
          "reflect",
          "replicate",
          "circular",
      ]
      assert len(self.hidden_channels) == len(self.hidden_kernels)
      assert len(self.hidden_channels) == len(self.hidden_strides)
      assert len(self.hidden_channels) == len(self.hidden_dilations)
  
      # compile layer dictionary
      layer_dict = self.build_layer_dict()
  
      # compile network
      self.net = nn.Sequential(layer_dict)
  
file_path: maze/maze/perception/blocks/feed_forward/strided_conv.py
imports: from collections import OrderedDict
  from typing import Union, List, Sequence, Dict, Tuple, Optional
  import torch
  from torch import nn
  from maze.core.annotations import override
  from maze.core.utils.factory import Factory
  from maze.perception.blocks.shape_normalization import ShapeNormalizationBlock
  from torch.nn import ZeroPad2d
label_desc: Use image node_id 1 to create a new StridedConvolutionBlock object from inherited base classes: ShapeNormalizationBlock with example: obj = StridedConvolutionBlock(in_keys, out_keys, in_shapes, hidden_channels, hidden_kernels, non_lin, convolution_dimension, hidden_strides, hidden_dilations, hidden_padding, padding_mode)