code: def test_output_with_max_pooling(
      self, filters, in_channels, strides, pool_shape, pool_stride
  ):
      dim_prod = self.input_width * self.input_height * 3
      input_ph = tf.compat.v1.placeholder(
          tf.float32, shape=(None, dim_prod), name="input_flattened"
      )
  
      # Build a cnn with random filter weights
      with tf.compat.v1.variable_scope("CNN"):
          self.cnn2 = cnn_with_max_pooling(
              input_var=input_ph,
              input_dim=self.input_dim,
              filters=filters,
              strides=strides,
              name="cnn1",
              pool_shapes=(pool_shape, pool_shape),
              pool_strides=(pool_stride, pool_stride),
              padding="VALID",
              hidden_w_init=tf.constant_initializer(1),
              hidden_nonlinearity=self.hidden_nonlinearity,
          )
  
      self.sess.run(tf.compat.v1.global_variables_initializer())
  
      obs_input = np.ones((self.batch_size, dim_prod))
      result = self.sess.run(self.cnn2, feed_dict={input_ph: obs_input})
  
      two_layer = len(filters) == 2
      # get weight values
      with tf.compat.v1.variable_scope("CNN", reuse=True):
          h0_w = tf.compat.v1.get_variable("cnn1/h0/weight").eval()
          h0_b = tf.compat.v1.get_variable("cnn1/h0/bias").eval()
          if two_layer:
              h1_w = tf.compat.v1.get_variable("cnn1/h1/weight").eval()
              h1_b = tf.compat.v1.get_variable("cnn1/h1/bias").eval()
  
      filter_weights = (h0_w, h1_w) if two_layer else (h0_w,)
      filter_bias = (h0_b, h1_b) if two_layer else (h0_b,)
  
      input_val = self.obs_input
  
      # convolution according to TensorFlow's approach
      # and perform max pooling on each layer
      for filter_iter, filter_weight, _filter_bias, in_channel in zip(
          filters, filter_weights, filter_bias, in_channels
      ):
          input_val = convolve(
              _input=input_val,
              filter_weights=(filter_weight,),
              filter_bias=(_filter_bias,),
              strides=strides,
              filters=(filter_iter,),
              in_channels=(in_channel,),
              hidden_nonlinearity=self.hidden_nonlinearity,
          )
  
          # max pooling
          input_val = max_pooling(
              _input=input_val,
              pool_shape=pool_shape,
              pool_stride=pool_stride,
          )
  
      # flatten
      dense_out = input_val.reshape((self.batch_size, -1)).astype(
          np.float32
      )
      np.testing.assert_array_equal(dense_out, result)
  
file_path: garage/tests/garage/tf/models/test_cnn.py
imports: import numpy
  import pytest
  import tensorflow
  from garage.tf.models.cnn import cnn, cnn_with_max_pooling
  from tests.fixtures import TfGraphTestCase
  from tests.helpers import convolve, max_pooling
label_desc: Use image node_id 7 for calling the TestCNN obj's underlying member method code with example usage: obj.test_output_with_max_pooling(filters, in_channels, strides, pool_shape, pool_stride) without return types