code: def _convert_dimension_to_tensor(value, dtype=None):
      dtype = dtype or np.int32
      if dtype not in (np.int32, np.int64):
          raise nptf.ops.TypeConversionError(value, dtype)
      return nptf.convert_to_tensor(
          tf.compat.dimension_value(value), dtype=dtype
      )
  
imports: import decorator
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.internal.backend import numpy
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.ops import control_flow_case
  from tensorflow.python.util import tf_inspect
label_desc: Use image node_id 1 for calling a global function with example usage: _convert_dimension_to_tensor(value, dtype) and returns: nptf