All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.onnxruntime.OrtProvider Maven / Gradle / Ivy

There is a newer version: 1.16.3-1.5.10
Show newest version
/*
 * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
 * Licensed under the MIT License.
 */
package ai.onnxruntime;

import java.util.HashMap;
import java.util.Map;

/** The execution providers available through the Java API. */
public enum OrtProvider {
  CPU("CPUExecutionProvider"),
  CUDA("CUDAExecutionProvider"),
  DNNL("DnnlExecutionProvider"),
  OPEN_VINO("OpenVINOExecutionProvider"),
  NUPHAR("NupharExecutionProvider"),
  VITIS_AI("VitisAIExecutionProvider"),
  TENSOR_RT("TensorrtExecutionProvider"),
  NNAPI("NnapiExecutionProvider"),
  RK_NPU("RknpuExecutionProvider"),
  DIRECT_ML("DmlExecutionProvider"),
  MI_GRAPH_X("MIGraphXExecutionProvider"),
  ACL("ACLExecutionProvider"),
  ARM_NN("ArmNNExecutionProvider");

  private static final Map valueMap = new HashMap<>(values().length);

  static {
    for (OrtProvider p : OrtProvider.values()) {
      valueMap.put(p.name, p);
    }
  }

  private final String name;

  OrtProvider(String name) {
    this.name = name;
  }

  /**
   * Accessor for the internal name of this provider.
   *
   * @return The internal provider name.
   */
  public String getName() {
    return name;
  }

  /**
   * Maps from the name string used by ONNX Runtime into the enum.
   *
   * @param name The provider name string.
   * @return The enum constant.
   */
  public static OrtProvider mapFromName(String name) {
    OrtProvider provider = valueMap.get(name);
    if (provider == null) {
      throw new IllegalArgumentException("Unknown execution provider - " + name);
    } else {
      return provider;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy