code: def _check_set_wise_labels(
      y_true,
      y_pred,
      average,
      labels,
      pos_label,
      session=None,
      run_kwargs=None,
  ):  # pragma: no cover
      """Validation associated with set-wise metrics
  
      Returns identified labels
      """
      exec_kwargs = dict(session=session, **(run_kwargs or dict()))
      average_options = (None, "micro", "macro", "weighted", "samples")
      if average not in average_options and average != "binary":
          raise ValueError(
              "average has to be one of " + str(average_options)
          )
  
      y_type, y_true, y_pred = _check_targets(y_true, y_pred)
      present_labels = unique_labels(y_true, y_pred)
      execute(y_type, y_true, y_pred, **exec_kwargs)
      y_type = y_type.fetch(**exec_kwargs)
  
      if average == "binary":
          if y_type == "binary":
              t_pos_in_labels = mt.any(
                  mt.isin(present_labels, pos_label)
              )
              execute(t_pos_in_labels, present_labels, **exec_kwargs)
              pos_in_labels = t_pos_in_labels.fetch(**exec_kwargs)
              if pos_in_labels:
                  if present_labels.shape[0] >= 2:
                      raise ValueError(
                          "pos_label=%r is not a valid label: "
                          "%r" % (pos_label, present_labels)
                      )
              labels = [pos_label]
          else:
              average_options = list(average_options)
              if y_type == "multiclass":
                  average_options.remove("samples")
              raise ValueError(
                  "Target is %s but average='binary'. Please "
                  "choose another average setting, one of %r."
                  % (y_type, average_options)
              )
      elif pos_label not in (None, 1):
          warnings.warn(
              "Note that pos_label (set to %r) is ignored when "
              "average != 'binary' (got %r). You may use "
              "labels=[pos_label] to specify a single positive class."
              % (pos_label, average),
              UserWarning,
          )
      return labels
  
imports: import warnings
  import numpy
  from sklearn.exceptions import UndefinedMetricWarning
  from ...None import execute, fetch
  from ...None import opcodes
  from ...None import tensor
  from ...core import ENTITY_TYPE, recursive_tile
  from ...core.context import get_context
  from ...serialization.serializables import AnyField, BoolField, KeyField
  from ...tensor.core import TensorOrder
  from ..operands import LearnOperand, LearnOperandMixin, OutputType
  from ..preprocessing import LabelBinarizer, LabelEncoder
  from ..utils import check_array, check_consistent_length, column_or_1d
  from ..utils.multiclass import unique_labels
  from ..utils.sparsefuncs import count_nonzero
  from ._check_targets import _check_targets
label_desc: Use image node_id 8 for calling a global function with example usage: _check_set_wise_labels(y_true, y_pred, average, labels, pos_label, session, run_kwargs) and returns: labels