code: def testReshapeShapeInference(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])
      a = array_ops.reshape(x, array_ops.shape(x))
      a.shape.assert_is_compatible_with([4, None, 10])
      b = array_ops.reshape(
          x, math_ops.cast(array_ops.shape(x), dtypes.int64)
      )
      b.shape.assert_is_compatible_with([4, None, 10])
  
      # We do not shape-infer across a tf.cast into anything that's not tf.int32
      # or tf.int64, since they might end up mangling the shape.
      c = array_ops.reshape(
          x,
          math_ops.cast(
              math_ops.cast(array_ops.shape(x), dtypes.float32),
              dtypes.int32,
          ),
      )
      c.shape.assert_is_compatible_with([None, None, None])
  
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 2 for calling the ArrayOpTest obj's underlying member method code with example usage: obj.testReshapeShapeInference() without return types