code: def testConvertToNestedTensorRaises(
      self, value, dtype=None, dtype_hint=None, error=None
  ):
      # Convert specs to tensors
      def maybe_spec_to_tensor(x):
          if isinstance(x, TensorSpec):
              return tf.zeros(x.shape, x.dtype, name="tensor")
          return x
  
      value = nest.map_structure(maybe_spec_to_tensor, value)
  
      # Structure must be exact.
      with self.assertRaisesRegex(*error):
          nest_util.convert_to_nested_tensor(
              value=value, dtype=dtype, dtype_hint=dtype_hint
          )
  
imports: import collections
  from absl.testing import parameterized
  import numpy
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import deterministic
  from tensorflow_probability.python.distributions import half_cauchy
  from tensorflow_probability.python.distributions import joint_distribution_auto_batched
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import nest_util
  from tensorflow_probability.python.internal import test_util
  from tensorflow.python.util import nest
label_desc: Use image node_id 10 for calling the NestUtilTest obj's underlying member method code with example usage: obj.testConvertToNestedTensorRaises(value, dtype, dtype_hint, error) and returns: x, tf