code: def _one_hot_like(x, indices, on_value=None):
      output_dtype = x.dtype.base_dtype
      if tf.compat.dimension_value(x.shape[-1]) is None:
          depth = tf.shape(x)[-1]
      else:
          depth = tf.compat.dimension_value(x.shape[-1])
      if on_value is not None:
          on_value = tf.cast(on_value, output_dtype)
      return tf.one_hot(
          indices, depth=depth, on_value=on_value, dtype=output_dtype
      )
  
file_path: probability/tensorflow_probability/python/optimizer/proximal_hessian_sparse.py
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.math.generic import soft_threshold
  from tensorflow_probability.python.math.linalg import sparse_or_dense_matvecmul
label_desc: Use image node_id 8 for calling a global function with example usage: _one_hot_like(x, indices, on_value) and returns: tf