docstr: Tests building CNN encoders with valid padding.
docstr_tok: ["Tests","building","CNN","encoders","with","valid","padding","."]
code: def test_cnn_encoders_valid_padding(self):
      """Tests building CNN encoders with valid padding."""
  
      inputs_dims = [42, 42, 3]
  
      # Test filter specifier with "valid"-padding setting in it.
      # Historical fun fact: The following was our old default CNN setup for
      # (42, 42, 3) Atari image spaces. The last layer, with its hard-coded :( padding
      # setting was narrowing down the image size to 1x1, so we could use the last
      # layer already as a 256-sized pre-logits layer (normally done by a Dense).
      filter_specifiers = [
          [16, 4, 2, "same"],
          [32, 4, 2],
          [256, 11, 1, "valid"],
      ]
  
      config = CNNEncoderConfig(
          input_dims=inputs_dims,
          cnn_filter_specifiers=filter_specifiers,
      )
  
      # Use a ModelChecker to compare all added models (different frameworks)
      # with each other.
      model_checker = ModelChecker(config)
  
      for fw in framework_iterator(frameworks=("tf2", "torch")):
          # Add this framework version of the model to our checker.
          outputs = model_checker.add(framework=fw)
          # Confirm that the config conputed the correct (actual) output dims.
          self.assertEqual(
              outputs[ENCODER_OUT].shape, (1, config.output_dims[0])
          )
  
      # Check all added models against each other.
      model_checker.check()
  
file_path: ray/python/ray/rllib/core/models/tests/test_cnn_encoders.py
imports: import itertools
  import unittest
  from ray.rllib.core.models.base import ENCODER_OUT
  from ray.rllib.core.models.configs import CNNEncoderConfig
  from ray.rllib.models.utils import get_filter_config
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
  from ray.rllib.utils.test_utils import framework_iterator, ModelChecker
label_desc: Use image node_id 2 for calling the TestCNNEncoders obj's underlying member method code with example usage: obj.test_cnn_encoders_valid_padding() without return types