class_docstr: Test CNNModule.
class_docstr_tok: ["Test","CNNModule","."]
docstr: Test output values with unequal stride and padding from CNNModule.
  
  Args:
      kernel_sizes (tuple[int]): Kernel sizes.
      hidden_channels (tuple[int]): hidden channels.
      strides (tuple[int]): strides.
      paddings (tuple[int]): value of zero-padding.
docstr_tok: ["Test","output","values","with","unequal","stride","and","padding","from","CNNModule",".","Args",":","kernel_sizes","(","tuple","[","int","]",")",":","Kernel","sizes",".","hidden_channels","(","tuple","[","int","]",")",":","hidden","channels",".","strides","(","tuple","[","int","]",")",":","strides",".","paddings","(","tuple","[","int","]",")",":","value","of","zero-padding","."]
code: def test_output_values_with_unequal_stride_with_padding(
      self, hidden_channels, kernel_sizes, strides, paddings
  ):
      """Test output values with unequal stride and padding from CNNModule.
  
      Args:
          kernel_sizes (tuple[int]): Kernel sizes.
          hidden_channels (tuple[int]): hidden channels.
          strides (tuple[int]): strides.
          paddings (tuple[int]): value of zero-padding.
  
      """
      model = CNNModule(
          self.input_spec,
          image_format="NCHW",
          hidden_channels=hidden_channels,
          kernel_sizes=kernel_sizes,
          strides=strides,
          paddings=paddings,
          padding_mode="zeros",
          hidden_nonlinearity=torch.relu,
          hidden_w_init=nn.init.xavier_uniform_,
      )
      output = model(self.input)
  
      current_size = self.input_width
      for filter_size, stride, padding in zip(
          kernel_sizes, strides, paddings
      ):
          # padding = float((filter_size - 1) / 2) # P = (F - 1) /2
          current_size = (
              int((current_size - filter_size + padding * 2) / stride)
              + 1
          )  # conv formula = ((W - F + 2P) / S) + 1
      flatten_shape = current_size * current_size * hidden_channels[-1]
  
      expected_output = torch.zeros((self.batch_size, flatten_shape))
      assert np.array_equal(
          torch.all(torch.eq(output, expected_output)), True
      )
  
file_path: garage/tests/garage/torch/modules/test_cnn_module.py
imports: import pickle
  import akro
  import numpy
  import pytest
  import torch
  import torch.nn
  from garage import InOutSpec
  from garage.torch.modules import CNNModule
  from garage.torch.modules.cnn_module import _check_spec
label_desc: Use image node_id 3 for calling the TestCNNModule obj's underlying member method code with example usage: obj.test_output_values_with_unequal_stride_with_padding(hidden_channels, kernel_sizes, strides, paddings) without return types