code: def _run(  # type: ignore
      self,
      X,
      classlabels_ints=None,
      classlabels_strings=None,
      coefficients=None,
      kernel_params=None,
      kernel_type=None,
      post_transform=None,
      prob_a=None,
      prob_b=None,
      rho=None,
      support_vectors=None,
      vectors_per_class=None,
  ):
      svm = SVMCommon(
          coefficients=coefficients,
          kernel_params=kernel_params,
          kernel_type=kernel_type,
          post_transform=post_transform,
          prob_a=prob_a,
          prob_b=prob_b,
          rho=rho,
          support_vectors=support_vectors,
          vectors_per_class=vectors_per_class,
      )
      # unused unless for debugging purposes
      self._svm = svm
  
      vector_count_ = 0
      class_count_ = max(
          len(classlabels_ints or classlabels_strings or []), 1
      )
      starting_vector_ = []
      if svm.atts.vectors_per_class is not None:  # type: ignore
          for vc in svm.atts.vectors_per_class:  # type: ignore
              starting_vector_.append(vector_count_)
              vector_count_ += vc
  
      if vector_count_ > 0:
          # length of each support vector
          mode = "SVM_SVC"
          sv = svm.atts.support_vectors.reshape((vector_count_, -1))  # type: ignore
          kernel_type_ = svm.atts.kernel_type  # type: ignore
          coefs = svm.atts.coefficients.reshape((-1, vector_count_))  # type: ignore
      else:
          # liblinear mode
          mode = "SVM_LINEAR"
          kernel_type_ = "LINEAR"
          coefs = svm.atts.coefficients.reshape((class_count_, -1))  # type: ignore
  
      weights_are_all_positive_ = min(svm.atts.coefficients) >= 0  # type: ignore
  
      # SVM part
      if vector_count_ == 0 and mode == "SVM_LINEAR":
          res = np.empty((X.shape[0], class_count_), dtype=X.dtype)
          for n in range(X.shape[0]):
              scores = self._run_linear(
                  X[n], coefs, class_count_, kernel_type_
              )
              res[n, :] = scores
          votes = None
      else:
          res = np.empty(
              (X.shape[0], class_count_ * (class_count_ - 1) // 2),
              dtype=X.dtype,
          )
          votes = np.empty((X.shape[0], class_count_), dtype=X.dtype)
          for n in range(X.shape[0]):
              vote, scores = self._run_svm(
                  X[n],
                  sv,
                  vector_count_,
                  kernel_type_,
                  class_count_,
                  starting_vector_,
                  coefs,
              )
              res[n, :] = scores
              votes[n, :] = vote
  
      # proba
      if (
          svm.atts.prob_a is not None  # type: ignore
          and len(svm.atts.prob_a) > 0  # type: ignore
          and mode == "SVM_SVC"
      ):
          scores = np.empty((res.shape[0], class_count_), dtype=X.dtype)
          for n in range(scores.shape[0]):
              s = self._probabilities(res[n], class_count_)
              scores[n, :] = s
          has_proba = True
      else:
          scores = res
          has_proba = False
  
      # finalization
      final_scores = None
      labels = []
      for n in range(scores.shape[0]):
          label, new_scores = self._compute_final_scores(
              None if votes is None else votes[n],
              scores[n],
              weights_are_all_positive_,
              has_proba,
              classlabels_ints,
          )
          if final_scores is None:
              final_scores = np.empty(
                  (X.shape[0], new_scores.size), dtype=X.dtype
              )
          final_scores[n, :] = new_scores
          labels.append(label)
  
      # labels
      if (
          classlabels_strings is not None
          and len(classlabels_strings) > 0
      ):
          return (
              np.array([classlabels_strings[i] for i in labels]),
              final_scores,
          )
      return (np.array(labels, dtype=np.int64), final_scores)
  
file_path: onnx/onnx/reference/ops/aionnxml/op_svm_classifier.py
imports: import numpy
  from onnx.reference.ops.aionnxml._common_classifier import compute_logistic, compute_probit, compute_softmax_zero, logistic, softmax, softmax_zero
  from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
  from onnx.reference.ops.aionnxml.op_svm_helper import SVMCommon
label_desc: Use image node_id 5 for calling the SVMClassifier obj's underlying member method code with example usage: obj._run(X, classlabels_ints, classlabels_strings, coefficients, kernel_params, kernel_type, post_transform, prob_a, prob_b, rho, support_vectors, vectors_per_class) and returns: np,  final_scores, np,  final_scores