Method: OnnxRuntime::Model#predict

Defined in:
lib/onnxruntime/model.rb

#predict(input_feed, output_names: nil, **run_options) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/onnxruntime/model.rb', line 7

def predict(input_feed, output_names: nil, **run_options)
  predictions = @session.run(output_names, input_feed, **run_options)
  output_names ||= outputs.map { |o| o[:name] }

  result = {}
  output_names.zip(predictions).each do |k, v|
    result[k.to_s] = v
  end
  result
end