code: def testShapeMismatchError2(self):
      rt = ragged_factory_ops.constant(
          [
              [[111, 112, 113, 114], [121]],  # row 0
              [],  # row 1
              [[], [321, 322], [331]],  # row 2
              [[411, 412]],  # row 3
          ]
      )  # pyformat: disable
      segment_ids = ragged_factory_ops.constant(
          [[1, 2], [1], [1, 1, 2], [2]]
      )
  
      # Error is raised at graph-building time if we can detect it then.
      self.assertRaisesRegex(
          errors.InvalidArgumentError,
          "segment_ids.shape must be a prefix of data.shape.*",
          ragged_math_ops.segment_sum,
          rt,
          segment_ids,
          3,
      )
  
      # Otherwise, error is raised when we run the graph.
      segment_ids2 = ragged_tensor.RaggedTensor.from_row_splits(
          array_ops.placeholder_with_default(segment_ids.values, None),
          array_ops.placeholder_with_default(
              segment_ids.row_splits, None
          ),
      )
      with self.assertRaisesRegex(
          errors.InvalidArgumentError,
          "segment_ids.shape must be a prefix of data.shape.*",
      ):
          self.evaluate(
              ragged_math_ops.segment_sum(rt, segment_ids2, 3)
          )
  
imports: import math
  from absl.testing import parameterized
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.ops.ragged import ragged_math_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.platform import googletest
label_desc: Use image node_id 7 for calling the RaggedSegmentOpsTest obj's underlying member method code with example usage: obj.testShapeMismatchError2() without return types