code: def _pool(self, pool_name, pool_function, k_height, k_width, d_height,
                d_width, mode, input_layer, num_channels_in):
          
          if input_layer is None:
              input_layer = self.top_layer
          else:
              self.top_size = num_channels_in
          name = pool_name + str(self.counts[pool_name])
          self.counts[pool_name] += 1
          if self.use_tf_layers:
              pool = pool_function(
                  input_layer, [k_height, k_width], [d_height, d_width],
                  padding=mode,
                  data_format=self.channel_pos,
                  name=name)
          else:
              if self.data_format == "NHWC":
                  ksize = [1, k_height, k_width, 1]
                  strides = [1, d_height, d_width, 1]
              else:
                  ksize = [1, 1, k_height, k_width]
                  strides = [1, 1, d_height, d_width]
              pool = tf.nn.max_pool(
                  input_layer,
                  ksize,
                  strides,
                  padding=mode,
                  data_format=self.data_format,
                  name=name)
          self.top_layer = pool
          return pool
docs: Construct a pooling layer.