code: def factorized_pool(
      input_tensor,
      window_shape,
      pooling_type,
      strides,
      padding,
      name=None,
  ):
      """Performs m x n pooling through a combination of 1xm and 1xn pooling.
  
      Args:
        input_tensor: Input tensor. Must be rank 2
        window_shape: Pooling window shape
        pooling_type: Either 'MAX' or 'AVG'
        strides: The stride of the pooling window
        padding: 'SAME' or 'VALID'.
        name: Name of the op
  
      Returns:
        A rank 2 tensor containing the pooled output
  
      Raises:
        ValueError: if the input tensor is not rank 2
      """
      if input_tensor.get_shape().ndims != 2:
          raise ValueError(
              "factorized_pool() accepts tensors of rank 2 only"
          )
  
      [height, width] = input_tensor.get_shape()
      if name is None:
          name = "factorized_pool"
      with tf.name_scope(name):
          input_tensor_aligned = tf.reshape(
              input_tensor, [1, 1, height, width]
          )
  
          height_pooling = tf.nn.pool(
              input_tensor_aligned,
              window_shape=[1, window_shape[0]],
              pooling_type=pooling_type,
              strides=[1, strides[0]],
              padding=padding,
          )
          swap_height_width = tf.transpose(
              height_pooling, perm=[0, 1, 3, 2]
          )
  
          width_pooling = tf.nn.pool(
              swap_height_width,
              window_shape=[1, window_shape[1]],
              pooling_type=pooling_type,
              strides=[1, strides[1]],
              padding=padding,
          )
  
      return tf.squeeze(tf.transpose(width_pooling, perm=[0, 1, 3, 2]))
  
file_path: model-optimization/tensorflow_model_optimization/python/core/sparsity/keras/pruning_utils.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: factorized_pool(input_tensor, window_shape, pooling_type, strides, padding, name) and returns: tf