code: def testPartialShapes(
      self, tensor, tensor_shape, shape=None, expected=None
  ):
      if expected is None:
          expected = tensor
  
      if context.executing_eagerly():
          return  # static shapes are always fully defined in eager mode.
  
      dt = constant_op.constant(tensor)
      for ragged_rank in range(1, len(dt.shape) - 1):
          dt_placeholder = array_ops.placeholder_with_default(
              tensor, tensor_shape
          )
          rt = RaggedTensor.from_tensor(
              dt_placeholder, ragged_rank=ragged_rank
          )
          self.assertIsInstance(rt, RaggedTensor)
          self.assertEqual(rt.ragged_rank, ragged_rank)
          self.assertTrue(
              dt.shape.is_compatible_with(rt.shape),
              "%s is incompatible with %s" % (dt.shape, rt.shape),
          )
          if shape is not None:
              self.assertEqual(rt.shape.as_list(), shape)
          self.assertAllEqual(rt, expected.tolist())
          self.assertAllEqual(
              rt,
              RaggedTensor.from_nested_row_splits(
                  rt.flat_values, rt.nested_row_splits, validate=True
              ),
          )
  
file_path: tensorflow-upstream/tensorflow/python/ops/ragged/ragged_from_tensor_op_test.py
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.python.eager import context
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops.ragged.ragged_tensor import RaggedTensor
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 5 for calling the RaggedTensorFromTensorOpTest obj's underlying member method code with example usage: obj.testPartialShapes(tensor, tensor_shape, shape, expected) without return types