Module: Informers::Backends::Onnx

Defined in:
lib/informers/backends/onnx.rb

Class Method Summary collapse

Class Method Details

.device_to_execution_providers(device) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/informers/backends/onnx.rb', line 4

def self.device_to_execution_providers(device)
  case device&.to_s
  when "cpu", nil
    []
  when "cuda"
    ["CUDAExecutionProvider"]
  when "coreml"
    ["CoreMLExecutionProvider"]
  else
    supported_devices = ["cpu", "cuda", "coreml"]
    raise ArgumentError, "Unsupported device: #{device}. Should be one of: #{supported_devices.join(", ")}"
  end
end