class_docstr: Tests for FractionalMaxPoolGrad.
  
  Two types of tests for FractionalMaxPoolGrad.
  1) Test fractional_max_pool_grad() directly.
    This type of test relies on gen_nn_ops.max_pool_grad() returns the correct
  result. For example:
    * input_tensor_shape = (1, 10, 10, 1)
    * window_size = (1, 2, 2, 1)
    * stride_size = (1, 2, 2, 1)
    * padding: not really import, since 10/2 is divisible
  max pooling should generate the same result as fractional max pooling with:
    * row_sequence = [0, 2, 4, 6, 8, 10]
    * col_sequence = [0, 2, 4, 6, 8, 10]
    * overlapping = False
  This also means their gradients in such case will be the same.
  
    Similarly, when
    * input_tensor_shape = (1, 7, 7, 1)
    * window_size = (1, 3, 3, 1)
    * stride_size = (1, 2, 2, 1)
    * padding: not important
  max pooling should generate the same result as fractional max pooling with:
    * row_sequence = [0, 2, 4, 7]
    * col_sequence = [0, 2, 4, 7]
    * overlapping = True
  2) Test through compute_gradient_error()
code: def testDifferentTensorShapesThroughGradientError(self):
      pseudo_random = True
      overlapping = True
      pooling_ratio = [1, math.sqrt(3), math.sqrt(2), 1]
      for num_batches in [1, 2]:
          for num_rows in [5, 13]:
              for num_cols in [5, 11]:
                  for num_channels in [1, 3]:
                      input_shape = (
                          num_batches,
                          num_rows,
                          num_cols,
                          num_channels,
                      )
                      input_data = (
                          self._GenerateUniqueRandomInputTensor(
                              input_shape
                          )
                      )
                      # Add some randomness to make input_data not so 'integer'
                      input_data += self._PRNG.random_sample(
                          input_shape
                      )
                      with self.cached_session() as _:
                          input_tensor = constant_op.constant(
                              input_data, shape=input_shape
                          )
                          (
                              output_tensor,
                              unused_a,
                              unused_b,
                          ) = nn_ops.fractional_max_pool_v2(
                              input_tensor,
                              pooling_ratio,
                              pseudo_random=pseudo_random,
                              overlapping=overlapping,
                              seed=self._SEED,
                          )
                          output_data = self.evaluate(output_tensor)
                          output_shape = output_data.shape
                          # error_margin and delta setting is similar to max_pool_grad.
                          error_margin = 1e-3
                          gradient_error = (
                              gradient_checker.compute_gradient_error(
                                  input_tensor,
                                  input_shape,
                                  output_tensor,
                                  output_shape,
                                  x_init_value=input_data.reshape(
                                      input_shape
                                  ),
                                  delta=1e-2,
                              )
                          )
                          self.assertLess(gradient_error, error_margin)
  
imports: import math
  import numpy
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_nn_ops
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import nn_ops
  import tensorflow.python.ops.nn_grad
  from tensorflow.python.platform import test
label_desc: Use image node_id 5 for calling the FractionalMaxPoolGradTest obj's underlying member method code with example usage: obj.testDifferentTensorShapesThroughGradientError() without return types