code: def sparse_bincount(
      inputs, depth, binary_output, dtype, count_weights=None
  ):
      """Apply binary or count encoding to an input and return a sparse tensor."""
      result = tf.sparse.bincount(
          inputs,
          weights=count_weights,
          minlength=depth,
          maxlength=depth,
          axis=-1,
          binary_output=binary_output,
      )
      result = tf.cast(result, dtype)
      if inputs.shape.rank == 1:
          output_shape = (depth,)
      else:
          batch_size = tf.shape(result)[0]
          output_shape = (batch_size, depth)
      result = tf.SparseTensor(
          indices=result.indices,
          values=result.values,
          dense_shape=output_shape,
      )
      return result
  
imports: from keras.utils.module_utils import tensorflow
label_desc: Use image node_id 2 for calling a global function with example usage: sparse_bincount(inputs, depth, binary_output, dtype, count_weights) and returns: result