class_docstr: Gradient-checking for ExtractImagePatches op.
code: def testConstructGradientWithLargeImages(self, use_tape):
      with test_util.AbstractGradientTape(use_tape=use_tape) as tape:
          batch_size = 4
          # Prevent OOM by setting reasonably large image size (b/171808681).
          height = 512
          width = 512
          ksize = 5
          shape = (batch_size, height, width, 1)
          images = variables.Variable(
              np.random.uniform(size=np.prod(shape)).reshape(shape),
              name="inputs",
          )
          tape.watch(images)
          patches = array_ops.extract_image_patches(
              images,
              ksizes=[1, ksize, ksize, 1],
              strides=[1, 1, 1, 1],
              rates=[1, 1, 1, 1],
              padding="SAME",
          )
          # Github issue: #20146
          # tf.image.extract_image_patches() gradient very slow at graph
          # construction time.
          gradients = tape.gradient(patches, images)
          # Won't time out.
          self.assertIsNotNone(gradients)
  
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.python.eager import context
  from tensorflow.python.eager.polymorphic_function import polymorphic_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import random_seed
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import gradient_checker_v2
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling the ExtractImagePatchesGradTest obj's underlying member method code with example usage: obj.testConstructGradientWithLargeImages(use_tape) without return types