onnxruntime 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/lib/onnxruntime.rb +1 -1
- data/lib/onnxruntime/ffi.rb +2 -2
- data/lib/onnxruntime/inference_session.rb +10 -11
- data/lib/onnxruntime/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0b017fa8896c64bbeeda0ba6582ca9bfa626de3f13023ec9f3f91000031e88b8
|
4
|
+
data.tar.gz: 16344db9151ca3f388539e05772a7172129613f949dbff77d89bfb9c307d0de2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21011ae8d875230858ff148a27ff29caf005210aae6f6e6a347ed9a02dfb85bceac6714957718d3f17872f07f0ace21c3ba7d7ba8884c1dff4b79fd08b43e40b
|
7
|
+
data.tar.gz: 000f4575890f92c2b1de308e052977f159ead243aef3984cd4190a5a873ecbe2868fe586fdbe14f2963f0518a75d8c4600d47ba2fbdd6a77c84cf3da1fc84292
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -63,8 +63,8 @@ OnnxRuntime::Model.new(path_or_bytes, {
|
|
63
63
|
enable_cpu_mem_arena: true,
|
64
64
|
enable_mem_pattern: true,
|
65
65
|
enable_profiling: false,
|
66
|
-
execution_mode: :sequential,
|
67
|
-
graph_optimization_level: nil,
|
66
|
+
execution_mode: :sequential, # :sequential or :parallel
|
67
|
+
graph_optimization_level: nil, # :none, :basic, :extended, or :all
|
68
68
|
inter_op_num_threads: nil,
|
69
69
|
intra_op_num_threads: nil,
|
70
70
|
log_severity_level: 2,
|
data/lib/onnxruntime.rb
CHANGED
data/lib/onnxruntime/ffi.rb
CHANGED
@@ -20,7 +20,7 @@ module OnnxRuntime
|
|
20
20
|
layout \
|
21
21
|
:CreateStatus, callback(%i[int string], :pointer),
|
22
22
|
:GetErrorCode, callback(%i[pointer], :pointer),
|
23
|
-
:GetErrorMessage, callback(%i[pointer], :
|
23
|
+
:GetErrorMessage, callback(%i[pointer], :pointer),
|
24
24
|
:CreateEnv, callback(%i[int string pointer], :pointer),
|
25
25
|
:CreateEnvWithCustomLogger, callback(%i[], :pointer),
|
26
26
|
:EnableTelemetryEvents, callback(%i[pointer], :pointer),
|
@@ -150,7 +150,7 @@ module OnnxRuntime
|
|
150
150
|
# to prevent "unable to resolve type" error on Ubuntu
|
151
151
|
layout \
|
152
152
|
:GetApi, callback(%i[uint32], Api.by_ref),
|
153
|
-
:GetVersionString, callback(%i[], :
|
153
|
+
:GetVersionString, callback(%i[], :pointer)
|
154
154
|
end
|
155
155
|
|
156
156
|
attach_function :OrtGetApiBase, %i[], ApiBase.by_ref
|
@@ -10,18 +10,17 @@ module OnnxRuntime
|
|
10
10
|
check_status api[:EnableMemPattern].call(session_options.read_pointer) if enable_mem_pattern
|
11
11
|
check_status api[:EnableProfiling].call(session_options.read_pointer, "onnxruntime_profile_") if enable_profiling
|
12
12
|
if execution_mode
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
0
|
17
|
-
when :parallel
|
18
|
-
1
|
19
|
-
else
|
20
|
-
raise ArgumentError, "Invalid execution mode"
|
21
|
-
end
|
13
|
+
execution_modes = {sequential: 0, parallel: 1}
|
14
|
+
mode = execution_modes[execution_mode]
|
15
|
+
raise ArgumentError, "Invalid execution mode" unless mode
|
22
16
|
check_status api[:SetSessionExecutionMode].call(session_options.read_pointer, mode)
|
23
17
|
end
|
24
|
-
|
18
|
+
if graph_optimization_level
|
19
|
+
optimization_levels = {none: 0, basic: 1, extended: 2, all: 99}
|
20
|
+
# TODO raise error in 0.4.0
|
21
|
+
level = optimization_levels[graph_optimization_level] || graph_optimization_level
|
22
|
+
check_status api[:SetSessionGraphOptimizationLevel].call(session_options.read_pointer, level)
|
23
|
+
end
|
25
24
|
check_status api[:SetInterOpNumThreads].call(session_options.read_pointer, inter_op_num_threads) if inter_op_num_threads
|
26
25
|
check_status api[:SetIntraOpNumThreads].call(session_options.read_pointer, intra_op_num_threads) if intra_op_num_threads
|
27
26
|
check_status api[:SetSessionLogSeverityLevel].call(session_options.read_pointer, log_severity_level) if log_severity_level
|
@@ -291,7 +290,7 @@ module OnnxRuntime
|
|
291
290
|
|
292
291
|
def check_status(status)
|
293
292
|
unless status.null?
|
294
|
-
message = api[:GetErrorMessage].call(status)
|
293
|
+
message = api[:GetErrorMessage].call(status).read_string
|
295
294
|
api[:ReleaseStatus].call(status)
|
296
295
|
raise OnnxRuntime::Error, message
|
297
296
|
end
|
data/lib/onnxruntime/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onnxruntime
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|