Module: OnnxRuby

Defined in:
lib/onnx_ruby.rb,
lib/onnx_ruby.rb,
lib/onnx_ruby/hub.rb,
lib/onnx_ruby/model.rb,
lib/onnx_ruby/tensor.rb,
lib/onnx_ruby/session.rb,
lib/onnx_ruby/version.rb,
lib/onnx_ruby/embedder.rb,
lib/onnx_ruby/reranker.rb,
lib/onnx_ruby/classifier.rb,
lib/onnx_ruby/lazy_session.rb,
lib/onnx_ruby/session_pool.rb,
lib/onnx_ruby/configuration.rb,
lib/onnx_ruby/tokenizer_support.rb

Defined Under Namespace

Modules: Hub, Model, TokenizerSupport Classes: Classifier, Configuration, Embedder, Error, InferenceError, LazySession, ModelError, Reranker, Session, SessionPool, Tensor, TensorError

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.available_providersObject



43
44
45
# File 'lib/onnx_ruby.rb', line 43

def self.available_providers
  Ext.available_providers
end

.configurationObject



27
28
29
# File 'lib/onnx_ruby.rb', line 27

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



31
32
33
# File 'lib/onnx_ruby.rb', line 31

def configure
  yield configuration
end

.optimize(input_path, output_path, level: :all) ⇒ Object

Raises:



36
37
38
39
40
41
# File 'lib/onnx_ruby.rb', line 36

def self.optimize(input_path, output_path, level: :all)
  input_path = File.expand_path(input_path)
  raise ModelError, "model file not found: #{input_path}" unless File.exist?(input_path)

  Ext.optimize_model(input_path, output_path, level.to_s)
end