code: def testGatherGradHasPartialStaticShape(self):
      # Create a tensor with an unknown dim 1.
      x = random_ops.random_normal([4, 10, 10])
      x = array_ops.gather(
          x,
          array_ops.reshape(array_ops.where_v2(x[0, :, 0] > 0.5), [-1]),
          axis=1,
      )
      x.shape.assert_is_compatible_with([4, None, 10])
  
      with backprop.GradientTape() as tape:
          tape.watch(x)
          a = array_ops.gather(array_ops.gather(x, [0, 1]), [0, 1])
      grad_a = tape.gradient(a, x)
      with backprop.GradientTape() as tape:
          tape.watch(x)
          b = array_ops.gather(
              array_ops.gather(x, [2, 3], axis=2), [0, 1]
          )
      grad_b = tape.gradient(b, x)
  
      # We make sure that the representation of the shapes are correct; the shape
      # equality check will always eval to false due to the shapes being partial.
      grad_a.shape.assert_is_compatible_with([None, None, 10])
      grad_b.shape.assert_is_compatible_with([4, None, 10])
  
imports: from tensorflow.core.config import flags
  from tensorflow.python.eager import backprop
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 1 for calling the ArrayOpTest obj's underlying member method code with example usage: obj.testGatherGradHasPartialStaticShape() without return types