class_docstr: Implements the TF backend ops for a PC auto-batching VM.
docstr: Asserts that the dtype of `value` matches `expected_dtype`.
  
  Args:
    expected_dtype: A numpy dtype
    value: `Tensor` or convertible.
    message: Optional diagnostic message.
  
  Raises:
    ValueError: If dtype does not match.
docstr_tok: ["Asserts","that","the","dtype","of","`","value","`","matches","`","expected_dtype","`",".","Args",":","expected_dtype",":","A","numpy","dtype","value",":","`","Tensor","`","or","convertible",".","message",":","Optional","diagnostic","message",".","Raises",":","ValueError",":","If","dtype","does","not","match","."]
code: def assert_matching_dtype(self, expected_dtype, value, message=""):
      """Asserts that the dtype of `value` matches `expected_dtype`.
  
      Args:
        expected_dtype: A numpy dtype
        value: `Tensor` or convertible.
        message: Optional diagnostic message.
  
      Raises:
        ValueError: If dtype does not match.
      """
      with tf.name_scope("VM.assert_matching_dtype"):
          value = tf.convert_to_tensor(
              value=value, name="value", dtype=expected_dtype
          )
          if value.dtype.base_dtype.as_numpy_dtype != expected_dtype:
              raise ValueError(
                  "Mismatched dtype: expected {} found {}. {}".format(
                      expected_dtype,
                      value.dtype.base_dtype.as_numpy_dtype,
                      message,
                  )
              )
  
imports: import collections
  import contextlib
  import six
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.experimental.auto_batching import instructions
  from tensorflow_probability.python.experimental.auto_batching import xla
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow.python.ops import control_flow_util
label_desc: Use image node_id 7 for calling the TensorFlowBackend obj's underlying member method code with example usage: obj.assert_matching_dtype(expected_dtype, value, message) without return types