class_docstr: Tests for FractionalAvgPoolGrad.
  
  Two types of tests for FractionalAvgPoolGrad.
  1) Test fractional_avg_pool_grad() directly.
    This type of test relies on gen_nn_ops.avg_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 important, since 10/2 is divisible
  avg pooling should generate the same result as fractional avg 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
  avg pooling should generate the same result as fractional avg pooling with:
    * row_sequence = [0, 2, 4, 7]
    * col_sequence = [0, 2, 4, 7]
    * overlapping = True
  2) Test through compute_gradient_error()
code: def testLargePoolingRatioThroughGradientError(self):
      input_shape = (1, 17, 23, 1)
      input_data = self._GenerateRandomInputTensor(input_shape)
      pooling_ratio = (1, math.sqrt(13), math.sqrt(7), 1)
      output_shape = [
          int(a / b) for a, b in zip(input_shape, pooling_ratio)
      ]
      overlapping = True
      pseudo_random = False
  
      with self.cached_session() as _:
          input_tensor = constant_op.constant(
              input_data, shape=input_shape
          )
          (
              output_tensor,
              unused_a,
              unused_b,
          ) = nn_ops.fractional_avg_pool_v2(
              input_tensor,
              pooling_ratio,
              pseudo_random=pseudo_random,
              overlapping=overlapping,
              seed=self._SEED,
          )
          # error_margin and delta setting is similar to avg_pool_grad.
          error_margin = 1e-4
          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 6 for calling the FractionalAvgPoolGradTest obj's underlying member method code with example usage: obj.testLargePoolingRatioThroughGradientError() without return types