code: def testReshapeShapeInference(self):
      # Create a tensor with an unknown dim 1.
      x = weak_tensor.WeakTensor(random_ops.random_normal([4, 10, 10]))
      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])
      self.assertIsInstance(c, weak_tensor.WeakTensor)
  
file_path: tensorflow/tensorflow/python/ops/weak_tensor_array_ops_test.py
imports: from tensorflow.python.eager import def_function
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_spec
  from tensorflow.python.framework import weak_tensor
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import weak_tensor_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.testReshapeShapeInference() without return types