code: def testUnaryElementwiseOp(
      self, x, op=math_ops.abs, expected_dtype=None, **extra_args
  ):
      x = ragged_tensor.convert_to_tensor_or_ragged_tensor(x)
      random_seed.set_random_seed(1234)
      result = op(x, **extra_args)
  
      # Run the wrapped op on the dense values, for comparison.
      dense_x = x.flat_values if ragged_tensor.is_ragged(x) else x
      random_seed.set_random_seed(1234)
      expected_flat_values = array_ops.reshape(
          op(dense_x, **extra_args), [-1]
      )
  
      # Check that the result has the expected shape.
      self.assertSameShape(x, result)
  
      # Check that the result has the expected (flattened) values.
      if ragged_tensor.is_ragged(result):
          result_flat_values = array_ops.reshape(
              result.flat_values, [-1]
          )
      else:
          result_flat_values = array_ops.reshape(result, [-1])
      self.assertAllEqual(expected_flat_values, result_flat_values)
  
      if expected_dtype is not None:
          self.assertEqual(result.dtype, expected_dtype)
  
imports: from absl.testing import parameterized
  import numpy
  from tensorflow.python import tf2
  from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import random_seed
  from tensorflow.python.framework import sparse_tensor
  from tensorflow.python.framework import tensor
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import array_ops_stack
  from tensorflow.python.ops import check_ops
  from tensorflow.python.ops import clip_ops
  from tensorflow.python.ops import data_flow_ops
  from tensorflow.python.ops import image_ops_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_impl
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops import string_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.ops.ragged import ragged_dispatch
  from tensorflow.python.ops.ragged import ragged_factory_ops
  from tensorflow.python.ops.ragged import ragged_tensor
  from tensorflow.python.ops.ragged import ragged_tensor_test_ops
  from tensorflow.python.ops.ragged.dynamic_ragged_shape import DynamicRaggedShape
  from tensorflow.python.platform import googletest
  from tensorflow.python.util import dispatch
  from tensorflow.python.util import nest
label_desc: Use image node_id 2 for calling the RaggedDispatchTest obj's underlying member method code with example usage: obj.testUnaryElementwiseOp(x, op, expected_dtype) without return types