createSession method
Pointer<OrtStatus>
createSession({
- required Pointer<
OrtEnv> env, - required String modelPath,
- required Pointer<
OrtSessionOptions> sessionOptions, - required Pointer<
Pointer< session,OrtSession> >
Implementation
Pointer<OrtStatus> createSession({
required Pointer<OrtEnv> env,
required String modelPath,
required Pointer<OrtSessionOptions> sessionOptions,
required Pointer<Pointer<OrtSession>> session,
}) {
final createSessionFn =
CreateSession.asFunction<
Pointer<OrtStatus> Function(
Pointer<OrtEnv>,
Pointer<Char>,
Pointer<OrtSessionOptions>,
Pointer<Pointer<OrtSession>>,
)
>();
final modelPathChars = Platform.isWindows
? modelPath.toNativeUtf16().cast<Char>()
: modelPath.toNativeUtf8().cast<Char>();
try {
final status = createSessionFn(
env,
modelPathChars,
sessionOptions,
session,
);
return status;
} finally {
malloc.free(modelPathChars);
}
}