ort.session(
model as Node,
[options as Object]
) as Object
Summary
Load an ONNX model from the database, as an inference session. The user can
then perform "run"s of this session, with different input values/settings.
Parameters
model
The binary node representing the ONNX model.
options
Options used to create the session. Possible values are:
Key Name
Value Type
Possible
Values
Details
graphOptimizationLevel
integer
0,1,2,99
0
means disable all optimizations; 1 means enable basic optimizations; 2 means
enable an extended set of optimizations; 99 means enable all
optimizations.
logId
string
Any
string.
The log-id will be appended to the front of logs produced by any
run of this session.
logVerbosityLevel
string
VERBOSE, INFO,
WARNING, ERROR, FATAL
VERBOSE level logs of ort session will be logged
when MarkLogic's log level is Fine or higher. WARNING level logs of ort session
will be logged when MarkLogic's log level is Debug or higher. INFO level logs of
ort session will be logged when MarkLogic's log level is Info or higher. ERROR
level logs of ort session will be logged when MarkLogic's log level is Error or
higher. FATAL level logs of ort session will be logged when MarkLogic's log
level is Emergency or higher.
device
xs:string
cpu,gpu#
"cpu" means the
session will be loaded on CPU memory, while "gpu#" means the session will be
loaded on GPU memory, where # means the device ID of the GPU, which typically
starts from 0. Defaults to "gpu0" if the host has an NVIDIA GPU with driver
installed; to "cpu" otherwise.
Example
(:after loading an ONNX model into the database as "testmodel.onnx" :)
ort.session(cts.doc("testmodel.onnx"), {"logId":"testSessionLogId"})
=> an ort:session, possibly described as follows:
OrtSession(Inputs:["input_0"]=>Outputs:["output_0"])
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.