code: def test_conv_dilation_params(self):
      with self.subTest(name="no dilations"):
          input_spec = tensor_spec.TensorSpec((32, 32, 3), tf.float32)
          network = encoding_network.EncodingNetwork(
              input_spec,
              conv_layer_params=((16, 2, 1), (15, 2, 1)),
          )
  
          network.create_variables()
          variables = network.variables
  
          self.assertLen(variables, 4)
          self.assertLen(network.layers, 3)
  
          # Validate dilation rates
          config = network.layers[0].get_config()
          self.assertEqual((1, 1), config["dilation_rate"])
          config = network.layers[1].get_config()
          self.assertEqual((1, 1), config["dilation_rate"])
  
      with self.subTest(name="dilations"):
          input_spec = tensor_spec.TensorSpec((32, 32, 3), tf.float32)
          network = encoding_network.EncodingNetwork(
              input_spec,
              conv_layer_params=((16, 2, 1, 2), (15, 2, 1, (2, 4))),
          )
  
          network.create_variables()
          variables = network.variables
  
          self.assertLen(variables, 4)
          self.assertLen(network.layers, 3)
  
          # Validate dilation rates
          config = network.layers[0].get_config()
          self.assertEqual((2, 2), config["dilation_rate"])
          config = network.layers[1].get_config()
          self.assertEqual((2, 4), config["dilation_rate"])
  
      with self.subTest(name="failing conv spec"):
          input_spec = tensor_spec.TensorSpec((32, 32, 3), tf.float32)
          with self.assertRaises(ValueError):
              network = encoding_network.EncodingNetwork(
                  input_spec,
                  conv_layer_params=((16, 2, 1, 2, 4), (15, 2, 1)),
              )
          with self.assertRaises(ValueError):
              network = encoding_network.EncodingNetwork(
                  input_spec,
                  conv_layer_params=((16, 2, 1), (15, 2)),
              )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tf_agents.networks import encoding_network
  from tf_agents.specs import tensor_spec
  from tf_agents.utils import test_utils
label_desc: Use image node_id 5 for calling the EncodingNetworkTest obj's underlying member method code with example usage: obj.test_conv_dilation_params() without return types