code: def multiclass_probability(k, R):
      max_iter = max(100, k)
      Q = np.empty((k, k), dtype=R.dtype)
      Qp = np.empty((k,), dtype=R.dtype)
      P = np.empty((k,), dtype=R.dtype)
      eps = 0.005 / k
  
      for t in range(0, k):
          P[t] = 1.0 / k
          Q[t, t] = (R[:t, t] ** 2).sum()
          Q[t, :t] = Q[:t, t]
  
          Q[t, t] += (R[t + 1 :, t] ** 2).sum()
          Q[t, t + 1 :] = -R[t + 1 :, t] @ R[t, t + 1 :]
  
      for _ in range(max_iter):
          # stopping condition, recalculate QP,pQP for numerical accuracy
          Qp[:] = Q @ P
          pQp = (P * Qp).sum()
  
          max_error = 0
          for t in range(0, k):
              error = np.abs(Qp[t] - pQp)
              if error > max_error:
                  max_error = error
          if max_error < eps:
              break
  
          for t in range(k):
              diff = (-Qp[t] + pQp) / Q[t, t]
              P[t] += diff
              pQp = (pQp + diff * (diff * Q[t, t] + 2 * Qp[t])) / (
                  1 + diff
              ) ** 2
              P /= 1 + diff
              Qp[:] = (Qp + diff * Q[t, :]) / (1 + diff)
  
      return P
  
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 1 for calling a global function with example usage: multiclass_probability(k, R) and returns: P