lib/onnxruntime/model.rb in onnxruntime-0.2.1 vs lib/onnxruntime/model.rb in onnxruntime-0.2.2
- old
+ new
@@ -1,12 +1,12 @@
module OnnxRuntime
class Model
- def initialize(path_or_bytes)
- @session = InferenceSession.new(path_or_bytes)
+ def initialize(path_or_bytes, **session_options)
+ @session = InferenceSession.new(path_or_bytes, **session_options)
end
- def predict(input_feed, output_names: nil)
- predictions = @session.run(output_names, input_feed)
+ 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