code: def _sparse_categorical_matches(y_true, y_pred):
      reshape = False
      y_true = ivy.array(y_true)
      y_pred = ivy.array(y_pred)
      y_true_org_shape = ivy.shape(y_true)
      y_true_rank = y_true.ndim
      y_pred_rank = y_pred.ndim
      # y_true shape to (num_samples,)
      if (
          (y_true_rank is not None)
          and (y_pred_rank is not None)
          and (len(ivy.shape(y_true)) == len(ivy.shape(y_pred)))
      ):
          y_true = ivy.squeeze(y_true, axis=-1)
          reshape = True
      y_pred = ivy.argmax(y_pred, axis=-1)
      # cast prediction type to be the same as ground truth
      y_pred = ivy.astype(y_pred, y_true.dtype, copy=False)
      matches = ivy.astype(ivy.equal(y_true, y_pred), ivy.float32)
      if reshape:
          matches = ivy.reshape(matches, shape=y_true_org_shape)
      return matches
  
imports: import ivy
  from ivy.functional.frontends.tensorflow.func_wrapper import to_ivy_arrays_and_back
label_desc: Use image node_id 3 for calling a global function with example usage: _sparse_categorical_matches(y_true, y_pred) and returns: matches