summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Bezerra <amelco.herman@gmail.com>2026-08-16 12:59:49 -0300
committerAndre Bezerra <amelco.herman@gmail.com>2026-08-16 13:16:16 -0300
commit6888ed0381c78cfeba0b2d6b471226bc47a2b3b1 (patch)
tree44f4eb1f7275de1f1db44dea59482842d323bd08
first version
-rw-r--r--.gitignore4
-rw-r--r--README.md72
-rwxr-xr-xbuild.sh4
-rw-r--r--main.c1988
-rw-r--r--models/README.md4
-rw-r--r--third_party/onnxruntime/LICENSE21
-rw-r--r--third_party/onnxruntime/ThirdPartyNotices.txt6082
-rw-r--r--third_party/onnxruntime/include/onnxruntime_c_api.h4952
l---------third_party/onnxruntime/lib/libonnxruntime.so1
l---------third_party/onnxruntime/lib/libonnxruntime.so.11
-rwxr-xr-xthird_party/onnxruntime/lib/libonnxruntime.so.1.21.0bin0 -> 20558800 bytes
11 files changed, 13129 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..da7f986
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+/stemsep
+/models/*.onnx
+/*_stems/
+tmp/ \ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7d50209
--- /dev/null
+++ b/README.md
@@ -0,0 +1,72 @@
+# stemsep
+
+`stemsep` is a Linux command-line program that separates an uncompressed WAV
+file into six stereo WAV stems using the HTDemucs six-source ONNX model:
+
+- `drums.wav`
+- `bass.wav`
+- `other.wav`
+- `vocals.wav`
+- `guitar.wav`
+- `piano.wav`
+
+All application code is in `main.c`. The bundled ONNX Runtime 1.21 binary is
+the official Linux x86-64 CPU release.
+
+## Model setup
+
+The model is not committed because it is 258,159,781 bytes. Download the pinned
+model before running the program:
+
+```sh
+mkdir -p models
+curl -fL -o models/htdemucs_6s.onnx \
+ https://huggingface.co/StemSplitio/htdemucs-6s-onnx/resolve/52c122c298c21fb0c74e7f04fe6e5d9c1f6dceef/htdemucs_6s.onnx
+printf '%s %s\n' \
+ 48f8e84945579f8ab340e083339e9221e03785dbe733a52c388200b6d3ca779a \
+ models/htdemucs_6s.onnx | sha256sum -c -
+```
+
+`STEMSEP_MODEL=/another/model.onnx` can override the model location without
+changing the command-line interface. The replacement model must have the same
+input/output contract.
+
+## Build and run
+
+```sh
+./build.sh
+./stemsep -wav /path/to/song.wav
+```
+
+With no parameters, a wrong flag, or extra parameters, the program prints:
+
+```text
+Usage: ./stemsep -wav <wav_file>
+```
+
+For `song.wav`, output is written to `song_stems/` beside the input file. Each
+stem is first written as a `.part` file and is published only after all six
+files finish successfully; normal errors and interruptions remove incomplete
+files. An existing output directory is never overwritten. A process crash or
+power loss can leave an incomplete directory that must be removed manually.
+
+## WAV support
+
+Input must be an uncompressed RIFF/WAVE file with one or two channels. The
+reader supports PCM 8/16/24/32-bit, IEEE float32, and the PCM/float
+`WAVE_FORMAT_EXTENSIBLE` variants. Mono is duplicated to stereo. Non-44.1-kHz
+input is converted by an adaptive Blackman-windowed sinc resampler.
+
+Outputs are stereo, 44.1-kHz, IEEE float32 WAV files. Standard RIFF limits each
+output to less than 4 GiB.
+
+The model runs in 7.8-second chunks with 25% overlap. Its publisher reports
+approximately 1.1 GiB of runtime memory on CPU. Separation is model-based and
+imperfect; guitar and piano can contain audible bleed from other sources.
+
+## Third-party components
+
+- ONNX Runtime 1.21: MIT license; see `third_party/onnxruntime/LICENSE` and
+ `third_party/onnxruntime/ThirdPartyNotices.txt`.
+- `htdemucs_6s.onnx`: distributed separately under the model repository's MIT
+ license and attribution terms.
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..da6ad4c
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+set -eu
+cd -- "$(dirname -- "$0")"
+gcc -std=c11 -O3 -DNDEBUG -Wall -Wextra -Wpedantic -Ithird_party/onnxruntime/include main.c -Lthird_party/onnxruntime/lib -Wl,-rpath,\$ORIGIN/third_party/onnxruntime/lib -Wl,--no-as-needed -lonnxruntime -lm -ldl -pthread -o stemsep
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..8f81a50
--- /dev/null
+++ b/main.c
@@ -0,0 +1,1988 @@
+#define _FILE_OFFSET_BITS 64
+#define _POSIX_C_SOURCE 200809L
+
+#include <errno.h>
+#include <fcntl.h>
+#include <float.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <math.h>
+#include <signal.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef STEMSEP_TEST_FAKE_MODEL
+#include "onnxruntime_c_api.h"
+#endif
+
+#define APP_NAME "stemsep"
+#define MODEL_RELATIVE_PATH "models/htdemucs_6s.onnx"
+#define MODEL_INPUT_NAME "mix"
+#define MODEL_OUTPUT_NAME "stems"
+#define MODEL_SAMPLE_RATE UINT32_C(44100)
+#define MODEL_CHANNELS 2U
+#define MODEL_STEMS 6U
+#define MODEL_SEGMENT_FRAMES UINT64_C(343980)
+#define MODEL_OVERLAP_FRAMES UINT64_C(85995)
+#define MODEL_STRIDE_FRAMES UINT64_C(257985)
+
+#define RESAMPLE_PHASES 1024U
+#define RESAMPLE_BASE_TAPS 64U
+#define RESAMPLE_DOWNSAMPLE_TAPS_AT_48K 96U
+#define SOURCE_RING_FRAMES 4096U
+#define WAV_RAW_BUFFER_BYTES 65536U
+#define WAV_WRITE_BLOCK_FRAMES 4096U
+#define MIN_TRANSITION_WEIGHT 1.0e-8F
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846264338327950288
+#endif
+
+_Static_assert(CHAR_BIT == 8, "stemsep requires 8-bit bytes");
+_Static_assert(sizeof(float) == 4, "stemsep requires 32-bit float");
+_Static_assert(FLT_RADIX == 2 && FLT_MANT_DIG == 24 && FLT_MAX_EXP == 128,
+ "stemsep requires IEEE-754 binary32 float");
+
+enum {
+ EXIT_OK = 0,
+ EXIT_FAILURE_GENERIC = 1,
+ EXIT_USAGE = 2,
+ EXIT_INPUT = 3,
+ EXIT_MODEL = 4,
+ EXIT_OUTPUT = 5,
+ EXIT_INTERNAL = 6,
+ EXIT_INTERRUPTED = 130
+};
+
+typedef struct {
+ char message[768];
+} Error;
+
+static volatile sig_atomic_t g_interrupted = 0;
+
+static void signal_handler(int signal_number)
+{
+ (void)signal_number;
+ g_interrupted = 1;
+}
+
+#if defined(__GNUC__) || defined(__clang__)
+__attribute__((format(printf, 2, 3)))
+#endif
+static bool set_error(Error *error, const char *format, ...)
+{
+ va_list args;
+
+ if (error != NULL) {
+ va_start(args, format);
+ (void)vsnprintf(error->message, sizeof(error->message), format, args);
+ va_end(args);
+ }
+ return false;
+}
+
+static bool checked_add_u64(uint64_t left, uint64_t right, uint64_t *result)
+{
+ if (UINT64_MAX - left < right) {
+ return false;
+ }
+ *result = left + right;
+ return true;
+}
+
+static bool checked_mul_u64(uint64_t left, uint64_t right, uint64_t *result)
+{
+ if (left != 0U && right > UINT64_MAX / left) {
+ return false;
+ }
+ *result = left * right;
+ return true;
+}
+
+static bool checked_mul_size(size_t left, size_t right, size_t *result)
+{
+ if (left != 0U && right > SIZE_MAX / left) {
+ return false;
+ }
+ *result = left * right;
+ return true;
+}
+
+static void *calloc_array(size_t count, size_t size, Error *error,
+ const char *description)
+{
+ size_t bytes;
+ void *allocation;
+
+ if (!checked_mul_size(count, size, &bytes)) {
+ (void)set_error(error, "%s is too large", description);
+ return NULL;
+ }
+ allocation = calloc(1U, bytes);
+ if (allocation == NULL) {
+ (void)set_error(error, "cannot allocate %zu bytes for %s: %s", bytes,
+ description, strerror(errno));
+ }
+ return allocation;
+}
+
+static char *duplicate_string(const char *source, Error *error)
+{
+ size_t length = strlen(source);
+ char *copy;
+
+ if (length == SIZE_MAX) {
+ (void)set_error(error, "path is too long");
+ return NULL;
+ }
+ copy = malloc(length + 1U);
+ if (copy == NULL) {
+ (void)set_error(error, "cannot allocate a path: %s", strerror(errno));
+ return NULL;
+ }
+ memcpy(copy, source, length + 1U);
+ return copy;
+}
+
+static char *join_path(const char *directory, const char *name, Error *error)
+{
+ size_t directory_length = strlen(directory);
+ size_t name_length = strlen(name);
+ bool needs_separator = directory_length > 0U && directory[directory_length - 1U] != '/';
+ size_t total;
+ char *path;
+
+ if (directory_length > SIZE_MAX - name_length - 2U) {
+ (void)set_error(error, "path is too long");
+ return NULL;
+ }
+ total = directory_length + (needs_separator ? 1U : 0U) + name_length + 1U;
+ path = malloc(total);
+ if (path == NULL) {
+ (void)set_error(error, "cannot allocate a path: %s", strerror(errno));
+ return NULL;
+ }
+
+ memcpy(path, directory, directory_length);
+ if (needs_separator) {
+ path[directory_length++] = '/';
+ }
+ memcpy(path + directory_length, name, name_length);
+ path[directory_length + name_length] = '\0';
+ return path;
+}
+
+static char *path_directory(const char *path, Error *error)
+{
+ const char *slash = strrchr(path, '/');
+ size_t length;
+ char *directory;
+
+ if (slash == NULL) {
+ return duplicate_string(".", error);
+ }
+ if (slash == path) {
+ return duplicate_string("/", error);
+ }
+ length = (size_t)(slash - path);
+ directory = malloc(length + 1U);
+ if (directory == NULL) {
+ (void)set_error(error, "cannot allocate an output path: %s", strerror(errno));
+ return NULL;
+ }
+ memcpy(directory, path, length);
+ directory[length] = '\0';
+ return directory;
+}
+
+static char *input_stem_name(const char *path, Error *error)
+{
+ const char *slash = strrchr(path, '/');
+ const char *base = slash == NULL ? path : slash + 1;
+ size_t length = strlen(base);
+ char *stem;
+
+ if (length == 0U) {
+ (void)set_error(error, "input path does not name a file");
+ return NULL;
+ }
+ if (length > 4U && strcasecmp(base + length - 4U, ".wav") == 0) {
+ length -= 4U;
+ }
+ if (length > SIZE_MAX - 7U) {
+ (void)set_error(error, "input filename is too long");
+ return NULL;
+ }
+ stem = malloc(length + sizeof("_stems"));
+ if (stem == NULL) {
+ (void)set_error(error, "cannot allocate an output name: %s", strerror(errno));
+ return NULL;
+ }
+ memcpy(stem, base, length);
+ memcpy(stem + length, "_stems", sizeof("_stems"));
+ return stem;
+}
+
+static char *read_executable_path(Error *error)
+{
+ size_t capacity = 256U;
+
+ while (capacity <= (1U << 20)) {
+ char *buffer = malloc(capacity);
+ ssize_t length;
+
+ if (buffer == NULL) {
+ (void)set_error(error, "cannot allocate executable path: %s", strerror(errno));
+ return NULL;
+ }
+ length = readlink("/proc/self/exe", buffer, capacity - 1U);
+ if (length < 0) {
+ free(buffer);
+ return NULL;
+ }
+ if ((size_t)length < capacity - 1U) {
+ buffer[length] = '\0';
+ return buffer;
+ }
+ free(buffer);
+ capacity *= 2U;
+ }
+ (void)set_error(error, "executable path is too long");
+ return NULL;
+}
+
+static char *model_path_from_executable(const char *argv0, Error *error)
+{
+ const char *override = getenv("STEMSEP_MODEL");
+ char *executable = NULL;
+ char *directory = NULL;
+ char *model_path = NULL;
+
+ if (override != NULL && override[0] != '\0') {
+ return duplicate_string(override, error);
+ }
+
+ executable = read_executable_path(error);
+ if (executable == NULL) {
+ error->message[0] = '\0';
+ executable = duplicate_string(argv0, error);
+ if (executable == NULL) {
+ return NULL;
+ }
+ }
+ directory = path_directory(executable, error);
+ free(executable);
+ if (directory == NULL) {
+ return NULL;
+ }
+ model_path = join_path(directory, MODEL_RELATIVE_PATH, error);
+ free(directory);
+ return model_path;
+}
+
+static bool regular_readable_file(const char *path, Error *error, const char *description)
+{
+ struct stat status;
+
+ if (stat(path, &status) != 0) {
+ return set_error(error, "cannot access %s '%s': %s", description, path,
+ strerror(errno));
+ }
+ if (!S_ISREG(status.st_mode)) {
+ return set_error(error, "%s '%s' is not a regular file", description, path);
+ }
+ if (access(path, R_OK) != 0) {
+ return set_error(error, "cannot read %s '%s': %s", description, path,
+ strerror(errno));
+ }
+ return true;
+}
+
+static uint16_t read_u16_le(const uint8_t *bytes)
+{
+ return (uint16_t)((uint16_t)bytes[0] | ((uint16_t)bytes[1] << 8U));
+}
+
+static uint32_t read_u32_le(const uint8_t *bytes)
+{
+ return (uint32_t)bytes[0] | ((uint32_t)bytes[1] << 8U) |
+ ((uint32_t)bytes[2] << 16U) | ((uint32_t)bytes[3] << 24U);
+}
+
+static void store_u16_le(uint8_t *bytes, uint16_t value)
+{
+ bytes[0] = (uint8_t)value;
+ bytes[1] = (uint8_t)(value >> 8U);
+}
+
+static void store_u32_le(uint8_t *bytes, uint32_t value)
+{
+ bytes[0] = (uint8_t)value;
+ bytes[1] = (uint8_t)(value >> 8U);
+ bytes[2] = (uint8_t)(value >> 16U);
+ bytes[3] = (uint8_t)(value >> 24U);
+}
+
+typedef enum {
+ SAMPLE_FORMAT_PCM,
+ SAMPLE_FORMAT_FLOAT
+} SampleFormat;
+
+typedef struct {
+ FILE *file;
+ SampleFormat format;
+ uint16_t channels;
+ uint16_t container_bits;
+ uint16_t valid_bits;
+ uint16_t block_align;
+ uint32_t sample_rate;
+ uint64_t data_offset;
+ uint64_t data_size;
+ uint64_t total_frames;
+ uint64_t frames_read;
+ uint8_t raw[WAV_RAW_BUFFER_BYTES];
+} WavReader;
+
+static const uint8_t GUID_TAIL[12] = {
+ 0x00U, 0x00U, 0x10U, 0x00U, 0x80U, 0x00U,
+ 0x00U, 0xAAU, 0x00U, 0x38U, 0x9BU, 0x71U
+};
+
+static bool seek_file(FILE *file, uint64_t offset, Error *error, const char *description)
+{
+ if (offset > (uint64_t)INT64_MAX) {
+ return set_error(error, "%s offset is too large", description);
+ }
+ if (fseeko(file, (off_t)offset, SEEK_SET) != 0) {
+ return set_error(error, "cannot seek to %s: %s", description, strerror(errno));
+ }
+ return true;
+}
+
+static bool read_exact(FILE *file, void *buffer, size_t bytes, Error *error,
+ const char *description)
+{
+ if (bytes == 0U) {
+ return true;
+ }
+ if (fread(buffer, 1U, bytes, file) != bytes) {
+ if (ferror(file)) {
+ return set_error(error, "cannot read %s: %s", description, strerror(errno));
+ }
+ return set_error(error, "unexpected end of file while reading %s", description);
+ }
+ return true;
+}
+
+static bool parse_wave_format(WavReader *reader, const uint8_t *format_data,
+ uint32_t format_size, Error *error)
+{
+ uint16_t format_tag;
+ uint16_t channels;
+ uint32_t sample_rate;
+ uint32_t byte_rate;
+ uint16_t block_align;
+ uint16_t bits;
+ uint16_t valid_bits;
+ uint32_t channel_mask = 0U;
+
+ if (format_size < 16U) {
+ return set_error(error, "WAV fmt chunk is smaller than 16 bytes");
+ }
+ format_tag = read_u16_le(format_data);
+ channels = read_u16_le(format_data + 2U);
+ sample_rate = read_u32_le(format_data + 4U);
+ byte_rate = read_u32_le(format_data + 8U);
+ block_align = read_u16_le(format_data + 12U);
+ bits = read_u16_le(format_data + 14U);
+ valid_bits = bits;
+
+ if (format_tag == UINT16_C(0xFFFE)) {
+ uint16_t extension_size;
+ uint32_t subtype;
+
+ if (format_size < 40U) {
+ return set_error(error, "WAVE_FORMAT_EXTENSIBLE fmt chunk is smaller than 40 bytes");
+ }
+ extension_size = read_u16_le(format_data + 16U);
+ if (extension_size < 22U || (uint32_t)extension_size + 18U > format_size) {
+ return set_error(error, "invalid WAVE_FORMAT_EXTENSIBLE extension size");
+ }
+ valid_bits = read_u16_le(format_data + 18U);
+ channel_mask = read_u32_le(format_data + 20U);
+ subtype = read_u32_le(format_data + 24U);
+ if (memcmp(format_data + 28U, GUID_TAIL, sizeof(GUID_TAIL)) != 0 ||
+ (subtype != 1U && subtype != 3U)) {
+ return set_error(error, "unsupported WAVE_FORMAT_EXTENSIBLE subtype");
+ }
+ format_tag = (uint16_t)subtype;
+ }
+
+ if (channels != 1U && channels != 2U) {
+ return set_error(error, "WAV must contain one or two channels (found %u)",
+ (unsigned)channels);
+ }
+ if (sample_rate < 8000U || sample_rate > 768000U) {
+ return set_error(error, "unsupported WAV sample rate: %" PRIu32, sample_rate);
+ }
+ if (bits == 0U || (bits % 8U) != 0U) {
+ return set_error(error, "unsupported WAV container bit depth: %u", (unsigned)bits);
+ }
+ if (valid_bits == 0U || valid_bits > bits) {
+ return set_error(error, "invalid WAV valid bit depth: %u in a %u-bit container",
+ (unsigned)valid_bits, (unsigned)bits);
+ }
+ if ((uint32_t)block_align != (uint32_t)channels * ((uint32_t)bits / 8U)) {
+ return set_error(error, "invalid WAV block alignment");
+ }
+ if (byte_rate != sample_rate * (uint32_t)block_align) {
+ fprintf(stderr, "warning: WAV byte rate is inconsistent; decoding by block alignment\n");
+ }
+ if (channel_mask != 0U) {
+ unsigned set_bits = 0U;
+ uint32_t mask = channel_mask;
+ while (mask != 0U) {
+ set_bits += mask & 1U;
+ mask >>= 1U;
+ }
+ if (set_bits != channels) {
+ return set_error(error, "WAV channel mask does not match its channel count");
+ }
+ if (channels == 2U && channel_mask != UINT32_C(0x00000003)) {
+ return set_error(error,
+ "unsupported stereo WAV channel mask: expected front-left/front-right");
+ }
+ }
+
+ if (format_tag == 1U) {
+ if (bits != 8U && bits != 16U && bits != 24U && bits != 32U) {
+ return set_error(error, "unsupported PCM WAV bit depth: %u", (unsigned)bits);
+ }
+ reader->format = SAMPLE_FORMAT_PCM;
+ } else if (format_tag == 3U) {
+ if (bits != 32U || valid_bits != 32U) {
+ return set_error(error, "IEEE-float WAV must use 32-bit samples");
+ }
+ reader->format = SAMPLE_FORMAT_FLOAT;
+ } else {
+ return set_error(error, "unsupported compressed WAV format tag: 0x%04x",
+ (unsigned)format_tag);
+ }
+
+ reader->channels = channels;
+ reader->sample_rate = sample_rate;
+ reader->block_align = block_align;
+ reader->container_bits = bits;
+ reader->valid_bits = valid_bits;
+ return true;
+}
+
+static bool wav_reader_open(WavReader *reader, const char *path, Error *error)
+{
+ uint8_t header[12];
+ uint64_t file_size;
+ uint64_t riff_end;
+ uint64_t position = 12U;
+ bool found_format = false;
+ bool found_data = false;
+
+ memset(reader, 0, sizeof(*reader));
+ reader->file = fopen(path, "rb");
+ if (reader->file == NULL) {
+ return set_error(error, "cannot open input WAV '%s': %s", path, strerror(errno));
+ }
+ if (fseeko(reader->file, 0, SEEK_END) != 0) {
+ return set_error(error, "cannot inspect input WAV '%s': %s", path, strerror(errno));
+ }
+ {
+ off_t end = ftello(reader->file);
+ if (end < 0) {
+ return set_error(error, "cannot determine input WAV size: %s", strerror(errno));
+ }
+ file_size = (uint64_t)end;
+ }
+ if (!seek_file(reader->file, 0U, error, "WAV header") ||
+ !read_exact(reader->file, header, sizeof(header), error, "WAV header")) {
+ return false;
+ }
+ if (memcmp(header, "RIFF", 4U) != 0) {
+ if (memcmp(header, "RF64", 4U) == 0) {
+ return set_error(error, "RF64 input is not supported");
+ }
+ if (memcmp(header, "RIFX", 4U) == 0) {
+ return set_error(error, "big-endian RIFX input is not supported");
+ }
+ return set_error(error, "input is not a RIFF WAV file");
+ }
+ if (memcmp(header + 8U, "WAVE", 4U) != 0) {
+ return set_error(error, "RIFF file is not a WAVE file");
+ }
+ if (!checked_add_u64(8U, read_u32_le(header + 4U), &riff_end) ||
+ riff_end < 12U || riff_end > file_size) {
+ return set_error(error, "WAV RIFF size extends beyond the physical file");
+ }
+
+ while (position + 8U <= riff_end) {
+ uint8_t chunk_header[8];
+ uint32_t chunk_size;
+ uint64_t payload;
+ uint64_t next;
+
+ if (!seek_file(reader->file, position, error, "WAV chunk header") ||
+ !read_exact(reader->file, chunk_header, sizeof(chunk_header), error,
+ "WAV chunk header")) {
+ return false;
+ }
+ chunk_size = read_u32_le(chunk_header + 4U);
+ if (!checked_add_u64(position, 8U, &payload) ||
+ !checked_add_u64(payload, chunk_size, &next) ||
+ !checked_add_u64(next, chunk_size & 1U, &next) || next > riff_end) {
+ return set_error(error, "WAV chunk extends beyond the RIFF boundary");
+ }
+
+ if (memcmp(chunk_header, "fmt ", 4U) == 0) {
+ uint8_t format_data[64];
+ size_t to_read;
+
+ if (found_format) {
+ return set_error(error, "WAV contains multiple fmt chunks");
+ }
+ if (chunk_size > sizeof(format_data)) {
+ to_read = sizeof(format_data);
+ } else {
+ to_read = (size_t)chunk_size;
+ }
+ if (!seek_file(reader->file, payload, error, "WAV fmt chunk") ||
+ !read_exact(reader->file, format_data, to_read, error, "WAV fmt chunk") ||
+ !parse_wave_format(reader, format_data, chunk_size, error)) {
+ return false;
+ }
+ found_format = true;
+ } else if (memcmp(chunk_header, "data", 4U) == 0) {
+ if (found_data) {
+ return set_error(error, "WAV contains multiple data chunks");
+ }
+ reader->data_offset = payload;
+ reader->data_size = chunk_size;
+ found_data = true;
+ }
+ position = next;
+ }
+
+ if (position != riff_end) {
+ return set_error(error, "WAV ends with an incomplete chunk header");
+ }
+
+ if (!found_format) {
+ return set_error(error, "WAV has no fmt chunk");
+ }
+ if (!found_data) {
+ return set_error(error, "WAV has no data chunk");
+ }
+ if (reader->data_size == 0U) {
+ return set_error(error, "WAV data chunk is empty");
+ }
+ if ((reader->data_size % reader->block_align) != 0U) {
+ return set_error(error, "WAV data chunk ends with a partial audio frame");
+ }
+ reader->total_frames = reader->data_size / reader->block_align;
+ if (!seek_file(reader->file, reader->data_offset, error, "WAV audio data")) {
+ return false;
+ }
+ return true;
+}
+
+static void wav_reader_close(WavReader *reader)
+{
+ if (reader->file != NULL) {
+ (void)fclose(reader->file);
+ reader->file = NULL;
+ }
+}
+
+static bool decode_pcm_sample(const WavReader *reader, const uint8_t *bytes,
+ float *sample, Error *error)
+{
+ unsigned byte_count = reader->container_bits / 8U;
+ uint64_t encoded = 0U;
+ unsigned index;
+
+ if (reader->container_bits == 8U) {
+ uint8_t value = bytes[0];
+ if (reader->valid_bits < 8U) {
+ unsigned unused = 8U - reader->valid_bits;
+ value = (uint8_t)(value & (uint8_t)(0xFFU << unused));
+ }
+ *sample = ((float)(int)value - 128.0F) / 128.0F;
+ return true;
+ }
+
+ for (index = 0U; index < byte_count; ++index) {
+ encoded |= (uint64_t)bytes[index] << (index * 8U);
+ }
+ if (reader->valid_bits < reader->container_bits) {
+ unsigned unused = reader->container_bits - reader->valid_bits;
+ encoded &= ~((UINT64_C(1) << unused) - 1U);
+ }
+ {
+ uint64_t sign = UINT64_C(1) << (reader->container_bits - 1U);
+ int64_t signed_value;
+ if ((encoded & sign) != 0U) {
+ signed_value = (int64_t)encoded -
+ (int64_t)(UINT64_C(1) << reader->container_bits);
+ } else {
+ signed_value = (int64_t)encoded;
+ }
+ *sample = (float)ldexp((double)signed_value,
+ -(int)(reader->container_bits - 1U));
+ }
+ if (!isfinite(*sample)) {
+ return set_error(error, "non-finite PCM sample encountered");
+ }
+ return true;
+}
+
+static bool decode_float_sample(const uint8_t *bytes, float *sample, Error *error)
+{
+ uint32_t bits = read_u32_le(bytes);
+ memcpy(sample, &bits, sizeof(bits));
+ if (!isfinite(*sample)) {
+ return set_error(error, "WAV contains a NaN or infinite float sample");
+ }
+ return true;
+}
+
+static bool wav_reader_read_frames(WavReader *reader, float *stereo,
+ size_t requested, size_t *frames_read,
+ Error *error)
+{
+ uint64_t remaining = reader->total_frames - reader->frames_read;
+ size_t capacity = sizeof(reader->raw) / reader->block_align;
+ size_t count = requested;
+ size_t frame;
+ unsigned sample_bytes = reader->container_bits / 8U;
+
+ if ((uint64_t)count > remaining) {
+ count = (size_t)remaining;
+ }
+ if (count > capacity) {
+ count = capacity;
+ }
+ if (count == 0U) {
+ *frames_read = 0U;
+ return true;
+ }
+ if (fread(reader->raw, reader->block_align, count, reader->file) != count) {
+ if (ferror(reader->file)) {
+ return set_error(error, "cannot read WAV audio data: %s", strerror(errno));
+ }
+ return set_error(error, "unexpected end of WAV audio data");
+ }
+
+ for (frame = 0U; frame < count; ++frame) {
+ const uint8_t *source = reader->raw + frame * reader->block_align;
+ float left;
+ float right;
+ bool ok;
+
+ if (reader->format == SAMPLE_FORMAT_PCM) {
+ ok = decode_pcm_sample(reader, source, &left, error);
+ if (ok && reader->channels == 2U) {
+ ok = decode_pcm_sample(reader, source + sample_bytes, &right, error);
+ } else {
+ right = left;
+ }
+ } else {
+ ok = decode_float_sample(source, &left, error);
+ if (ok && reader->channels == 2U) {
+ ok = decode_float_sample(source + sample_bytes, &right, error);
+ } else {
+ right = left;
+ }
+ }
+ if (!ok) {
+ return false;
+ }
+ stereo[frame * 2U] = left;
+ stereo[frame * 2U + 1U] = right;
+ }
+ reader->frames_read += count;
+ *frames_read = count;
+ return true;
+}
+
+typedef struct {
+ WavReader *reader;
+ float *frames;
+ size_t capacity;
+ size_t head;
+ size_t count;
+ uint64_t base_index;
+} SourceRing;
+
+static bool source_ring_init(SourceRing *ring, WavReader *reader, Error *error)
+{
+ memset(ring, 0, sizeof(*ring));
+ ring->reader = reader;
+ ring->capacity = SOURCE_RING_FRAMES;
+ ring->frames = calloc_array(ring->capacity * 2U, sizeof(float), error,
+ "source audio ring");
+ return ring->frames != NULL;
+}
+
+static void source_ring_destroy(SourceRing *ring)
+{
+ free(ring->frames);
+ memset(ring, 0, sizeof(*ring));
+}
+
+static void source_ring_discard_before(SourceRing *ring, uint64_t index)
+{
+ while (ring->count > 0U && ring->base_index < index) {
+ ring->head = (ring->head + 1U) % ring->capacity;
+ --ring->count;
+ ++ring->base_index;
+ }
+}
+
+static bool source_ring_fill_until(SourceRing *ring, uint64_t wanted, Error *error)
+{
+ while (ring->base_index + ring->count <= wanted) {
+ size_t tail;
+ size_t contiguous;
+ size_t read_count = 0U;
+
+ if (ring->base_index + ring->count >= ring->reader->total_frames) {
+ return set_error(error, "resampler requested audio beyond the WAV data");
+ }
+ if (ring->count == ring->capacity) {
+ return set_error(error, "internal source audio ring overflow");
+ }
+ tail = (ring->head + ring->count) % ring->capacity;
+ contiguous = ring->capacity - tail;
+ if (contiguous > ring->capacity - ring->count) {
+ contiguous = ring->capacity - ring->count;
+ }
+ if (!wav_reader_read_frames(ring->reader, ring->frames + tail * 2U,
+ contiguous, &read_count, error)) {
+ return false;
+ }
+ if (read_count == 0U) {
+ return set_error(error, "unexpected end of decoded WAV audio");
+ }
+ ring->count += read_count;
+ }
+ return true;
+}
+
+static bool source_ring_get(const SourceRing *ring, uint64_t index,
+ float sample[2], Error *error)
+{
+ uint64_t offset;
+ size_t slot;
+
+ if (index < ring->base_index) {
+ return set_error(error, "internal resampler history underflow");
+ }
+ offset = index - ring->base_index;
+ if (offset >= ring->count) {
+ return set_error(error, "internal resampler look-ahead underflow");
+ }
+ slot = (ring->head + (size_t)offset) % ring->capacity;
+ sample[0] = ring->frames[slot * 2U];
+ sample[1] = ring->frames[slot * 2U + 1U];
+ return true;
+}
+
+typedef struct {
+ SourceRing source;
+ uint32_t input_rate;
+ uint64_t input_frames;
+ uint64_t output_frames;
+ uint64_t output_index;
+ unsigned taps;
+ unsigned radius;
+ bool bypass;
+ float *coefficients;
+} Resampler;
+
+static uint64_t reflect_frame_index(int64_t index, uint64_t frame_count)
+{
+ int64_t period;
+ int64_t reflected;
+
+ if (frame_count <= 1U) {
+ return 0U;
+ }
+ period = (int64_t)(2U * (frame_count - 1U));
+ reflected = index % period;
+ if (reflected < 0) {
+ reflected += period;
+ }
+ if ((uint64_t)reflected >= frame_count) {
+ reflected = period - reflected;
+ }
+ return (uint64_t)reflected;
+}
+
+static double sinc_value(double value)
+{
+ if (fabs(value) < 1.0e-12) {
+ return 1.0;
+ }
+ return sin(M_PI * value) / (M_PI * value);
+}
+
+static bool resampler_build_coefficients(Resampler *resampler, Error *error)
+{
+ unsigned phase;
+ double rate_ratio = (double)MODEL_SAMPLE_RATE / (double)resampler->input_rate;
+ double cutoff = 0.94 * (rate_ratio < 1.0 ? rate_ratio : 1.0);
+
+ resampler->coefficients = calloc_array((size_t)RESAMPLE_PHASES * resampler->taps,
+ sizeof(float), error,
+ "resampling filter");
+ if (resampler->coefficients == NULL) {
+ return false;
+ }
+ for (phase = 0U; phase < RESAMPLE_PHASES; ++phase) {
+ double fraction = (double)phase / (double)RESAMPLE_PHASES;
+ double sum = 0.0;
+ unsigned tap;
+
+ for (tap = 0U; tap < resampler->taps; ++tap) {
+ int offset = (int)tap - ((int)resampler->radius - 1);
+ double x = (double)offset - fraction;
+ double window;
+ double weight;
+
+ if (fabs(x) >= (double)resampler->radius) {
+ window = 0.0;
+ } else {
+ window = 0.42 + 0.5 * cos(M_PI * x / (double)resampler->radius) +
+ 0.08 * cos(2.0 * M_PI * x / (double)resampler->radius);
+ }
+ weight = cutoff * sinc_value(cutoff * x) * window;
+ resampler->coefficients[(size_t)phase * resampler->taps + tap] =
+ (float)weight;
+ sum += weight;
+ }
+ if (fabs(sum) < 1.0e-12) {
+ return set_error(error, "cannot normalize the resampling filter");
+ }
+ for (tap = 0U; tap < resampler->taps; ++tap) {
+ size_t index = (size_t)phase * resampler->taps + tap;
+ resampler->coefficients[index] =
+ (float)(resampler->coefficients[index] / sum);
+ }
+ }
+ return true;
+}
+
+static bool resampler_init(Resampler *resampler, WavReader *reader, Error *error)
+{
+ uint64_t scaled;
+ uint64_t rounded;
+
+ memset(resampler, 0, sizeof(*resampler));
+ resampler->input_rate = reader->sample_rate;
+ resampler->input_frames = reader->total_frames;
+ resampler->bypass = reader->sample_rate == MODEL_SAMPLE_RATE;
+ resampler->taps = RESAMPLE_BASE_TAPS;
+ if (reader->sample_rate > MODEL_SAMPLE_RATE) {
+ uint64_t scaled_taps =
+ (uint64_t)RESAMPLE_DOWNSAMPLE_TAPS_AT_48K * reader->sample_rate;
+ uint64_t rounded_taps = (scaled_taps + UINT64_C(47999)) / UINT64_C(48000);
+ if ((rounded_taps & 1U) != 0U) {
+ ++rounded_taps;
+ }
+ if (rounded_taps > UINT_MAX || rounded_taps + 1U > SOURCE_RING_FRAMES) {
+ return set_error(error, "unsupported resampling filter size");
+ }
+ resampler->taps = (unsigned)rounded_taps;
+ }
+ resampler->radius = resampler->taps / 2U;
+ if (!checked_mul_u64(reader->total_frames, MODEL_SAMPLE_RATE, &scaled) ||
+ !checked_add_u64(scaled, reader->sample_rate / 2U, &rounded)) {
+ return set_error(error, "resampled WAV duration is too large");
+ }
+ resampler->output_frames = rounded / reader->sample_rate;
+ if (resampler->output_frames == 0U) {
+ resampler->output_frames = 1U;
+ }
+ if (!source_ring_init(&resampler->source, reader, error)) {
+ return false;
+ }
+ if (!resampler->bypass && !resampler_build_coefficients(resampler, error)) {
+ source_ring_destroy(&resampler->source);
+ return false;
+ }
+ return true;
+}
+
+static void resampler_destroy(Resampler *resampler)
+{
+ source_ring_destroy(&resampler->source);
+ free(resampler->coefficients);
+ memset(resampler, 0, sizeof(*resampler));
+}
+
+static bool resampler_next(Resampler *resampler, float output[2], Error *error)
+{
+ uint64_t source_numerator;
+ uint64_t base;
+ uint64_t remainder;
+ uint64_t phase_numerator;
+ unsigned phase;
+
+ if (resampler->output_index >= resampler->output_frames) {
+ return set_error(error, "internal resampler output overrun");
+ }
+ if (resampler->bypass) {
+ uint64_t index = resampler->output_index;
+ source_ring_discard_before(&resampler->source, index);
+ if (!source_ring_fill_until(&resampler->source, index, error) ||
+ !source_ring_get(&resampler->source, index, output, error)) {
+ return false;
+ }
+ ++resampler->output_index;
+ return true;
+ }
+
+ if (!checked_mul_u64(resampler->output_index, resampler->input_rate,
+ &source_numerator)) {
+ return set_error(error, "resampler position overflow");
+ }
+ base = source_numerator / MODEL_SAMPLE_RATE;
+ remainder = source_numerator % MODEL_SAMPLE_RATE;
+ phase_numerator = remainder * RESAMPLE_PHASES + MODEL_SAMPLE_RATE / 2U;
+ phase = (unsigned)(phase_numerator / MODEL_SAMPLE_RATE);
+ if (phase == RESAMPLE_PHASES) {
+ phase = 0U;
+ ++base;
+ }
+ if (base >= resampler->input_frames) {
+ base = resampler->input_frames - 1U;
+ phase = 0U;
+ }
+
+ {
+ uint64_t keep_from = base > resampler->radius ?
+ base - resampler->radius : 0U;
+ uint64_t need_until = base + resampler->radius;
+ double left = 0.0;
+ double right = 0.0;
+ unsigned tap;
+
+ if (need_until >= resampler->input_frames) {
+ need_until = resampler->input_frames - 1U;
+ }
+ source_ring_discard_before(&resampler->source, keep_from);
+ if (!source_ring_fill_until(&resampler->source, need_until, error)) {
+ return false;
+ }
+ for (tap = 0U; tap < resampler->taps; ++tap) {
+ int offset = (int)tap - ((int)resampler->radius - 1);
+ uint64_t source_index = reflect_frame_index((int64_t)base + offset,
+ resampler->input_frames);
+ float sample[2];
+ float coefficient =
+ resampler->coefficients[(size_t)phase * resampler->taps + tap];
+ if (!source_ring_get(&resampler->source, source_index, sample, error)) {
+ return false;
+ }
+ left += (double)sample[0] * coefficient;
+ right += (double)sample[1] * coefficient;
+ }
+ output[0] = (float)left;
+ output[1] = (float)right;
+ }
+ if (!isfinite(output[0]) || !isfinite(output[1])) {
+ return set_error(error, "resampler produced a non-finite sample");
+ }
+ ++resampler->output_index;
+ return true;
+}
+
+typedef struct {
+ FILE *file;
+ char *partial_path;
+ char *final_path;
+ uint64_t frames_written;
+ bool partial_created;
+ bool renamed;
+} WavWriter;
+
+typedef struct {
+ char *directory;
+ WavWriter writers[MODEL_STEMS];
+ bool directory_created;
+ bool committed;
+} OutputSet;
+
+static const char *const STEM_NAMES[MODEL_STEMS] = {
+ "drums", "bass", "other", "vocals", "guitar", "piano"
+};
+
+static bool write_exact(FILE *file, const void *buffer, size_t bytes,
+ Error *error, const char *description)
+{
+ if (bytes != 0U) {
+ size_t written = fwrite(buffer, 1U, bytes, file);
+ if (written != bytes) {
+ if (ferror(file)) {
+ return set_error(error, "cannot write %s: %s", description,
+ errno != 0 ? strerror(errno) : "I/O error");
+ }
+ return set_error(error, "short write while writing %s", description);
+ }
+ }
+ return true;
+}
+
+static bool wav_writer_write_placeholder(WavWriter *writer, Error *error)
+{
+ uint8_t header[56];
+
+ memset(header, 0, sizeof(header));
+ memcpy(header, "RIFF", 4U);
+ memcpy(header + 8U, "WAVE", 4U);
+ memcpy(header + 12U, "fmt ", 4U);
+ store_u32_le(header + 16U, 16U);
+ store_u16_le(header + 20U, 3U);
+ store_u16_le(header + 22U, MODEL_CHANNELS);
+ store_u32_le(header + 24U, MODEL_SAMPLE_RATE);
+ store_u32_le(header + 28U, MODEL_SAMPLE_RATE * MODEL_CHANNELS * 4U);
+ store_u16_le(header + 32U, MODEL_CHANNELS * 4U);
+ store_u16_le(header + 34U, 32U);
+ memcpy(header + 36U, "fact", 4U);
+ store_u32_le(header + 40U, 4U);
+ memcpy(header + 48U, "data", 4U);
+ return write_exact(writer->file, header, sizeof(header), error, "WAV header");
+}
+
+static bool wav_writer_open(WavWriter *writer, const char *directory,
+ const char *stem_name, Error *error)
+{
+ size_t name_length = strlen(stem_name);
+ char *final_name = NULL;
+ char *partial_name = NULL;
+ int descriptor;
+ int flags = O_RDWR | O_CREAT | O_EXCL;
+
+ memset(writer, 0, sizeof(*writer));
+ if (name_length > SIZE_MAX - sizeof(".wav.part")) {
+ return set_error(error, "output filename is too long");
+ }
+ final_name = malloc(name_length + sizeof(".wav"));
+ partial_name = malloc(name_length + sizeof(".wav.part"));
+ if (final_name == NULL || partial_name == NULL) {
+ free(final_name);
+ free(partial_name);
+ return set_error(error, "cannot allocate an output filename: %s", strerror(errno));
+ }
+ (void)snprintf(final_name, name_length + sizeof(".wav"), "%s.wav", stem_name);
+ (void)snprintf(partial_name, name_length + sizeof(".wav.part"), "%s.wav.part",
+ stem_name);
+ writer->final_path = join_path(directory, final_name, error);
+ writer->partial_path = join_path(directory, partial_name, error);
+ free(final_name);
+ free(partial_name);
+ if (writer->final_path == NULL || writer->partial_path == NULL) {
+ return false;
+ }
+
+#ifdef O_CLOEXEC
+ flags |= O_CLOEXEC;
+#endif
+#ifdef O_NOFOLLOW
+ flags |= O_NOFOLLOW;
+#endif
+ descriptor = open(writer->partial_path, flags, 0644);
+ if (descriptor < 0) {
+ return set_error(error, "cannot create output '%s': %s", writer->partial_path,
+ strerror(errno));
+ }
+ writer->partial_created = true;
+ writer->file = fdopen(descriptor, "wb+");
+ if (writer->file == NULL) {
+ int saved_errno = errno;
+ (void)close(descriptor);
+ (void)unlink(writer->partial_path);
+ writer->partial_created = false;
+ return set_error(error, "cannot open output stream '%s': %s",
+ writer->partial_path, strerror(saved_errno));
+ }
+ if (!wav_writer_write_placeholder(writer, error)) {
+ return false;
+ }
+ return true;
+}
+
+static bool wav_writer_write_frames(WavWriter *writer, const float *interleaved,
+ size_t frame_count, Error *error)
+{
+ uint8_t bytes[WAV_WRITE_BLOCK_FRAMES * MODEL_CHANNELS * sizeof(float)];
+ size_t offset = 0U;
+
+ while (offset < frame_count) {
+ size_t block = frame_count - offset;
+ size_t sample;
+ if (block > WAV_WRITE_BLOCK_FRAMES) {
+ block = WAV_WRITE_BLOCK_FRAMES;
+ }
+ for (sample = 0U; sample < block * MODEL_CHANNELS; ++sample) {
+ float value = interleaved[(offset * MODEL_CHANNELS) + sample];
+ uint32_t encoded;
+ if (!isfinite(value)) {
+ return set_error(error, "model produced a NaN or infinite sample for %s",
+ writer->final_path);
+ }
+ memcpy(&encoded, &value, sizeof(encoded));
+ store_u32_le(bytes + sample * sizeof(float), encoded);
+ }
+ if (!write_exact(writer->file, bytes,
+ block * MODEL_CHANNELS * sizeof(float), error,
+ writer->partial_path)) {
+ return false;
+ }
+ writer->frames_written += block;
+ offset += block;
+ }
+ return true;
+}
+
+static bool wav_writer_finish(WavWriter *writer, uint64_t expected_frames,
+ Error *error)
+{
+ uint64_t data_bytes_64;
+ uint32_t data_bytes;
+ uint8_t value[4];
+ int close_result;
+
+ if (writer->frames_written != expected_frames) {
+ return set_error(error, "internal output duration mismatch for '%s'",
+ writer->final_path);
+ }
+ if (!checked_mul_u64(writer->frames_written, MODEL_CHANNELS * sizeof(float),
+ &data_bytes_64) || data_bytes_64 > UINT32_MAX - 48U) {
+ return set_error(error, "output '%s' exceeds the standard RIFF 4 GiB limit",
+ writer->final_path);
+ }
+ data_bytes = (uint32_t)data_bytes_64;
+
+ if (!seek_file(writer->file, 4U, error, "RIFF size field")) {
+ return false;
+ }
+ store_u32_le(value, data_bytes + 48U);
+ if (!write_exact(writer->file, value, sizeof(value), error, "RIFF size")) {
+ return false;
+ }
+ if (!seek_file(writer->file, 44U, error, "WAV fact sample count")) {
+ return false;
+ }
+ store_u32_le(value, (uint32_t)writer->frames_written);
+ if (!write_exact(writer->file, value, sizeof(value), error, "WAV fact sample count")) {
+ return false;
+ }
+ if (!seek_file(writer->file, 52U, error, "WAV data size")) {
+ return false;
+ }
+ store_u32_le(value, data_bytes);
+ if (!write_exact(writer->file, value, sizeof(value), error, "WAV data size")) {
+ return false;
+ }
+ if (fflush(writer->file) != 0) {
+ return set_error(error, "cannot flush output '%s': %s", writer->partial_path,
+ strerror(errno));
+ }
+ close_result = fclose(writer->file);
+ writer->file = NULL;
+ if (close_result != 0) {
+ return set_error(error, "cannot close output '%s': %s", writer->partial_path,
+ strerror(errno));
+ }
+ return true;
+}
+
+static void wav_writer_cleanup(WavWriter *writer, bool remove_files)
+{
+ if (writer->file != NULL) {
+ (void)fclose(writer->file);
+ writer->file = NULL;
+ }
+ if (remove_files) {
+ if (writer->partial_created && writer->partial_path != NULL) {
+ (void)unlink(writer->partial_path);
+ }
+ if (writer->renamed && writer->final_path != NULL) {
+ (void)unlink(writer->final_path);
+ }
+ }
+ free(writer->partial_path);
+ free(writer->final_path);
+ memset(writer, 0, sizeof(*writer));
+}
+
+static bool output_set_create(OutputSet *outputs, const char *directory,
+ Error *error)
+{
+ unsigned stem;
+
+ memset(outputs, 0, sizeof(*outputs));
+ outputs->directory = duplicate_string(directory, error);
+ if (outputs->directory == NULL) {
+ return false;
+ }
+ if (mkdir(directory, 0755) != 0) {
+ if (errno == EEXIST) {
+ return set_error(error, "output directory '%s' already exists", directory);
+ }
+ return set_error(error, "cannot create output directory '%s': %s", directory,
+ strerror(errno));
+ }
+ outputs->directory_created = true;
+ for (stem = 0U; stem < MODEL_STEMS; ++stem) {
+ if (!wav_writer_open(&outputs->writers[stem], directory, STEM_NAMES[stem], error)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+static bool output_set_commit(OutputSet *outputs, uint64_t expected_frames,
+ Error *error)
+{
+ unsigned stem;
+
+ for (stem = 0U; stem < MODEL_STEMS; ++stem) {
+ if (!wav_writer_finish(&outputs->writers[stem], expected_frames, error)) {
+ return false;
+ }
+ }
+ for (stem = 0U; stem < MODEL_STEMS; ++stem) {
+ if (rename(outputs->writers[stem].partial_path,
+ outputs->writers[stem].final_path) != 0) {
+ return set_error(error, "cannot finalize output '%s': %s",
+ outputs->writers[stem].final_path, strerror(errno));
+ }
+ outputs->writers[stem].partial_created = false;
+ outputs->writers[stem].renamed = true;
+ }
+ outputs->committed = true;
+ return true;
+}
+
+static void output_set_cleanup(OutputSet *outputs)
+{
+ unsigned stem;
+ bool remove_files = !outputs->committed;
+
+ for (stem = 0U; stem < MODEL_STEMS; ++stem) {
+ wav_writer_cleanup(&outputs->writers[stem], remove_files);
+ }
+ if (remove_files && outputs->directory_created && outputs->directory != NULL) {
+ (void)rmdir(outputs->directory);
+ }
+ free(outputs->directory);
+ memset(outputs, 0, sizeof(*outputs));
+}
+
+typedef struct {
+#ifndef STEMSEP_TEST_FAKE_MODEL
+ const OrtApi *api;
+ OrtEnv *environment;
+ OrtSessionOptions *session_options;
+ OrtSession *session;
+ OrtMemoryInfo *memory_info;
+ OrtValue *input_value;
+#else
+ float *fake_output;
+#endif
+} Model;
+
+typedef struct {
+ const float *samples;
+#ifndef STEMSEP_TEST_FAKE_MODEL
+ OrtValue *owned_value;
+#endif
+} ModelResult;
+
+#ifndef STEMSEP_TEST_FAKE_MODEL
+static bool ort_ok(Model *model, OrtStatus *status, Error *error,
+ const char *operation)
+{
+ const char *message;
+
+ if (status == NULL) {
+ return true;
+ }
+ message = model->api->GetErrorMessage(status);
+ (void)set_error(error, "ONNX Runtime %s failed: %s", operation,
+ message != NULL ? message : "unknown error");
+ model->api->ReleaseStatus(status);
+ return false;
+}
+
+static bool model_validate_contract(Model *model, bool input,
+ const int64_t *expected_dimensions,
+ size_t expected_rank, Error *error)
+{
+ OrtTypeInfo *type_info = NULL;
+ const OrtTensorTypeAndShapeInfo *tensor_info = NULL;
+ enum ONNXTensorElementDataType element_type;
+ int64_t dimensions[4] = {0, 0, 0, 0};
+ size_t rank = 0U;
+ size_t index;
+ OrtStatus *status;
+ bool ok = false;
+
+ status = input ?
+ model->api->SessionGetInputTypeInfo(model->session, 0U, &type_info) :
+ model->api->SessionGetOutputTypeInfo(model->session, 0U, &type_info);
+ if (!ort_ok(model, status, error, input ? "input inspection" : "output inspection")) {
+ goto cleanup;
+ }
+ if (!ort_ok(model, model->api->CastTypeInfoToTensorInfo(type_info, &tensor_info),
+ error, "tensor type inspection") || tensor_info == NULL) {
+ if (tensor_info == NULL && error->message[0] == '\0') {
+ (void)set_error(error, "model %s is not a tensor", input ? "input" : "output");
+ }
+ goto cleanup;
+ }
+ if (!ort_ok(model, model->api->GetTensorElementType(tensor_info, &element_type),
+ error, "tensor element type inspection") ||
+ !ort_ok(model, model->api->GetDimensionsCount(tensor_info, &rank),
+ error, "tensor rank inspection")) {
+ goto cleanup;
+ }
+ if (element_type != ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT || rank != expected_rank ||
+ rank > sizeof(dimensions) / sizeof(dimensions[0])) {
+ (void)set_error(error, "model %s contract is incompatible: expected float32 rank %zu",
+ input ? "input" : "output", expected_rank);
+ goto cleanup;
+ }
+ if (!ort_ok(model, model->api->GetDimensions(tensor_info, dimensions, rank),
+ error, "tensor dimension inspection")) {
+ goto cleanup;
+ }
+ for (index = 0U; index < rank; ++index) {
+ if (dimensions[index] != expected_dimensions[index]) {
+ (void)set_error(error,
+ "model %s dimension %zu is incompatible: expected %" PRId64
+ ", found %" PRId64,
+ input ? "input" : "output", index,
+ expected_dimensions[index], dimensions[index]);
+ goto cleanup;
+ }
+ }
+ ok = true;
+
+cleanup:
+ if (type_info != NULL) {
+ model->api->ReleaseTypeInfo(type_info);
+ }
+ return ok;
+}
+
+static bool model_validate_name(Model *model, bool input,
+ const char *expected_name, Error *error)
+{
+ OrtAllocator *allocator = NULL;
+ char *actual_name = NULL;
+ OrtStatus *status;
+ bool ok = false;
+
+ if (!ort_ok(model, model->api->GetAllocatorWithDefaultOptions(&allocator),
+ error, "default-allocator access") || allocator == NULL) {
+ if (allocator == NULL && error->message[0] == '\0') {
+ (void)set_error(error, "ONNX Runtime returned no default allocator");
+ }
+ return false;
+ }
+ status = input ?
+ model->api->SessionGetInputName(model->session, 0U, allocator, &actual_name) :
+ model->api->SessionGetOutputName(model->session, 0U, allocator, &actual_name);
+ if (!ort_ok(model, status, error,
+ input ? "input-name inspection" : "output-name inspection")) {
+ goto cleanup;
+ }
+ if (actual_name == NULL || strcmp(actual_name, expected_name) != 0) {
+ (void)set_error(error,
+ "model %s name is incompatible: expected '%s', found '%s'",
+ input ? "input" : "output", expected_name,
+ actual_name != NULL ? actual_name : "(null)");
+ goto cleanup;
+ }
+ ok = true;
+
+cleanup:
+ if (actual_name != NULL) {
+ allocator->Free(allocator, actual_name);
+ }
+ return ok;
+}
+#endif
+
+static bool model_init(Model *model, const char *model_path, float *input_buffer,
+ Error *error)
+{
+ memset(model, 0, sizeof(*model));
+#ifdef STEMSEP_TEST_FAKE_MODEL
+ (void)model_path;
+ (void)input_buffer;
+ model->fake_output = calloc_array((size_t)(MODEL_STEMS * MODEL_CHANNELS *
+ MODEL_SEGMENT_FRAMES),
+ sizeof(float), error, "fake model output");
+ return model->fake_output != NULL;
+#else
+ const OrtApiBase *base = OrtGetApiBase();
+ int64_t input_dimensions[3] = {
+ 1, (int64_t)MODEL_CHANNELS, (int64_t)MODEL_SEGMENT_FRAMES
+ };
+ int64_t output_dimensions[4] = {
+ 1, (int64_t)MODEL_STEMS, (int64_t)MODEL_CHANNELS,
+ (int64_t)MODEL_SEGMENT_FRAMES
+ };
+ size_t input_count = 0U;
+ size_t output_count = 0U;
+ size_t input_bytes = (size_t)(MODEL_CHANNELS * MODEL_SEGMENT_FRAMES) * sizeof(float);
+
+ if (base == NULL) {
+ return set_error(error, "ONNX Runtime returned no API base");
+ }
+ model->api = base->GetApi(ORT_API_VERSION);
+ if (model->api == NULL) {
+ return set_error(error,
+ "ONNX Runtime API %d is unavailable (runtime reports %s)",
+ ORT_API_VERSION, base->GetVersionString());
+ }
+ if (!ort_ok(model,
+ model->api->CreateEnv(ORT_LOGGING_LEVEL_WARNING, APP_NAME,
+ &model->environment),
+ error, "environment creation") ||
+ !ort_ok(model, model->api->CreateSessionOptions(&model->session_options),
+ error, "session-options creation") ||
+ !ort_ok(model,
+ model->api->SetSessionGraphOptimizationLevel(model->session_options,
+ ORT_ENABLE_ALL),
+ error, "graph optimization setup") ||
+ !ort_ok(model,
+ model->api->CreateSession(model->environment, model_path,
+ model->session_options, &model->session),
+ error, "model loading") ||
+ !ort_ok(model, model->api->SessionGetInputCount(model->session, &input_count),
+ error, "input-count inspection") ||
+ !ort_ok(model, model->api->SessionGetOutputCount(model->session, &output_count),
+ error, "output-count inspection")) {
+ return false;
+ }
+ if (input_count != 1U || output_count != 1U) {
+ return set_error(error,
+ "model contract is incompatible: expected one input and one output");
+ }
+ if (!model_validate_name(model, true, MODEL_INPUT_NAME, error) ||
+ !model_validate_name(model, false, MODEL_OUTPUT_NAME, error) ||
+ !model_validate_contract(model, true, input_dimensions, 3U, error) ||
+ !model_validate_contract(model, false, output_dimensions, 4U, error) ||
+ !ort_ok(model,
+ model->api->CreateCpuMemoryInfo(OrtArenaAllocator, OrtMemTypeDefault,
+ &model->memory_info),
+ error, "CPU memory-info creation") ||
+ !ort_ok(model,
+ model->api->CreateTensorWithDataAsOrtValue(
+ model->memory_info, input_buffer, input_bytes,
+ input_dimensions, 3U, ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT,
+ &model->input_value),
+ error, "input-tensor creation")) {
+ return false;
+ }
+ fprintf(stderr, "ONNX Runtime %s, CPU execution provider\n", base->GetVersionString());
+ return true;
+#endif
+}
+
+static void model_destroy(Model *model)
+{
+#ifdef STEMSEP_TEST_FAKE_MODEL
+ free(model->fake_output);
+#else
+ if (model->api != NULL) {
+ if (model->input_value != NULL) {
+ model->api->ReleaseValue(model->input_value);
+ }
+ if (model->memory_info != NULL) {
+ model->api->ReleaseMemoryInfo(model->memory_info);
+ }
+ if (model->session != NULL) {
+ model->api->ReleaseSession(model->session);
+ }
+ if (model->session_options != NULL) {
+ model->api->ReleaseSessionOptions(model->session_options);
+ }
+ if (model->environment != NULL) {
+ model->api->ReleaseEnv(model->environment);
+ }
+ }
+#endif
+ memset(model, 0, sizeof(*model));
+}
+
+static bool model_run(Model *model, const float *input_buffer,
+ ModelResult *result, Error *error)
+{
+ memset(result, 0, sizeof(*result));
+#ifdef STEMSEP_TEST_FAKE_MODEL
+ unsigned stem;
+ unsigned channel;
+ uint64_t frame;
+
+ (void)error;
+
+ for (stem = 0U; stem < MODEL_STEMS; ++stem) {
+ float scale = (float)(stem + 1U) / (float)MODEL_STEMS;
+ for (channel = 0U; channel < MODEL_CHANNELS; ++channel) {
+ size_t output_offset =
+ (size_t)((stem * MODEL_CHANNELS + channel) * MODEL_SEGMENT_FRAMES);
+ size_t input_offset = (size_t)(channel * MODEL_SEGMENT_FRAMES);
+ for (frame = 0U; frame < MODEL_SEGMENT_FRAMES; ++frame) {
+ model->fake_output[output_offset + (size_t)frame] =
+ input_buffer[input_offset + (size_t)frame] * scale;
+ }
+ }
+ }
+ result->samples = model->fake_output;
+ return true;
+#else
+ const char *input_names[1] = {MODEL_INPUT_NAME};
+ const char *output_names[1] = {MODEL_OUTPUT_NAME};
+ const OrtValue *input_values[1] = {model->input_value};
+ OrtValue *output_values[1] = {NULL};
+ OrtStatus *status;
+ void *raw_data = NULL;
+ int is_tensor = 0;
+
+ (void)input_buffer;
+ status = model->api->Run(model->session, NULL, input_names, input_values, 1U,
+ output_names, 1U, output_values);
+ if (status != NULL) {
+ if (output_values[0] != NULL) {
+ model->api->ReleaseValue(output_values[0]);
+ }
+ (void)ort_ok(model, status, error, "inference");
+ return false;
+ }
+ if (output_values[0] == NULL) {
+ return set_error(error, "ONNX Runtime returned no output tensor");
+ }
+ result->owned_value = output_values[0];
+ if (!ort_ok(model, model->api->IsTensor(result->owned_value, &is_tensor),
+ error, "output tensor validation")) {
+ model->api->ReleaseValue(result->owned_value);
+ result->owned_value = NULL;
+ return false;
+ }
+ if (!is_tensor) {
+ model->api->ReleaseValue(result->owned_value);
+ result->owned_value = NULL;
+ return set_error(error, "ONNX Runtime output is not a tensor");
+ }
+ if (!ort_ok(model,
+ model->api->GetTensorMutableData(result->owned_value, &raw_data),
+ error, "output tensor access")) {
+ model->api->ReleaseValue(result->owned_value);
+ result->owned_value = NULL;
+ return false;
+ }
+ if (raw_data == NULL) {
+ model->api->ReleaseValue(result->owned_value);
+ result->owned_value = NULL;
+ return set_error(error, "ONNX Runtime returned a null output buffer");
+ }
+ result->samples = raw_data;
+ return true;
+#endif
+}
+
+static void model_result_release(Model *model, ModelResult *result)
+{
+#ifndef STEMSEP_TEST_FAKE_MODEL
+ if (result->owned_value != NULL) {
+ model->api->ReleaseValue(result->owned_value);
+ }
+#else
+ (void)model;
+#endif
+ memset(result, 0, sizeof(*result));
+}
+
+static bool build_transition_window(float *window, Error *error)
+{
+ uint64_t frame;
+
+ if (MODEL_OVERLAP_FRAMES < 2U ||
+ MODEL_OVERLAP_FRAMES * 2U > MODEL_SEGMENT_FRAMES) {
+ return set_error(error, "invalid compiled overlap constants");
+ }
+ for (frame = 0U; frame < MODEL_SEGMENT_FRAMES; ++frame) {
+ window[frame] = 1.0F;
+ }
+ for (frame = 0U; frame < MODEL_OVERLAP_FRAMES; ++frame) {
+ float fade = (float)frame / (float)(MODEL_OVERLAP_FRAMES - 1U);
+ if (fade < MIN_TRANSITION_WEIGHT) {
+ fade = MIN_TRANSITION_WEIGHT;
+ }
+ window[frame] = fade;
+ window[MODEL_SEGMENT_FRAMES - 1U - frame] = fade;
+ }
+ return true;
+}
+
+static bool fill_model_input(float *input, Resampler *resampler,
+ uint64_t chunk_start, uint64_t target_end,
+ uint64_t *loaded_frames, Error *error)
+{
+ while (*loaded_frames < target_end) {
+ uint64_t destination = *loaded_frames - chunk_start;
+ float sample[2];
+
+ if (destination >= MODEL_SEGMENT_FRAMES) {
+ return set_error(error, "internal model-input assembly overflow");
+ }
+ if (!resampler_next(resampler, sample, error)) {
+ return false;
+ }
+ input[destination] = sample[0];
+ input[MODEL_SEGMENT_FRAMES + destination] = sample[1];
+ ++*loaded_frames;
+ }
+ return true;
+}
+
+static bool accumulate_model_output(float *accumulator, float *weight,
+ const float *model_output,
+ const float *window, uint64_t valid_frames,
+ Error *error)
+{
+ uint64_t frame;
+ unsigned plane;
+
+ for (frame = 0U; frame < valid_frames; ++frame) {
+ weight[frame] += window[frame];
+ }
+ for (plane = 0U; plane < MODEL_STEMS * MODEL_CHANNELS; ++plane) {
+ size_t base = (size_t)(plane * MODEL_SEGMENT_FRAMES);
+ for (frame = 0U; frame < valid_frames; ++frame) {
+ float sample = model_output[base + (size_t)frame];
+ if (!isfinite(sample)) {
+ return set_error(error, "model produced a NaN or infinite sample");
+ }
+ accumulator[base + (size_t)frame] += sample * window[frame];
+ }
+ }
+ return true;
+}
+
+static bool write_finalized_audio(OutputSet *outputs, const float *accumulator,
+ const float *weight, uint64_t frame_count,
+ Error *error)
+{
+ float interleaved[WAV_WRITE_BLOCK_FRAMES * MODEL_CHANNELS];
+ unsigned stem;
+
+ for (stem = 0U; stem < MODEL_STEMS; ++stem) {
+ uint64_t offset = 0U;
+ while (offset < frame_count) {
+ size_t block = (size_t)(frame_count - offset);
+ size_t frame;
+ if (block > WAV_WRITE_BLOCK_FRAMES) {
+ block = WAV_WRITE_BLOCK_FRAMES;
+ }
+ for (frame = 0U; frame < block; ++frame) {
+ uint64_t source_frame = offset + frame;
+ float divisor = weight[source_frame];
+ unsigned channel;
+ if (divisor < MIN_TRANSITION_WEIGHT) {
+ divisor = MIN_TRANSITION_WEIGHT;
+ }
+ for (channel = 0U; channel < MODEL_CHANNELS; ++channel) {
+ size_t plane = stem * MODEL_CHANNELS + channel;
+ float value = accumulator[plane * MODEL_SEGMENT_FRAMES +
+ (size_t)source_frame] / divisor;
+ if (!isfinite(value)) {
+ return set_error(error,
+ "overlap-add produced a non-finite %s sample",
+ STEM_NAMES[stem]);
+ }
+ interleaved[frame * MODEL_CHANNELS + channel] = value;
+ }
+ }
+ if (!wav_writer_write_frames(&outputs->writers[stem], interleaved,
+ block, error)) {
+ return false;
+ }
+ offset += block;
+ }
+ }
+ return true;
+}
+
+static void shift_overlap_buffers(float *input, float *accumulator, float *weight)
+{
+ unsigned plane;
+
+ for (plane = 0U; plane < MODEL_CHANNELS; ++plane) {
+ float *channel = input + plane * MODEL_SEGMENT_FRAMES;
+ memmove(channel, channel + MODEL_STRIDE_FRAMES,
+ (size_t)MODEL_OVERLAP_FRAMES * sizeof(float));
+ memset(channel + MODEL_OVERLAP_FRAMES, 0,
+ (size_t)MODEL_STRIDE_FRAMES * sizeof(float));
+ }
+ for (plane = 0U; plane < MODEL_STEMS * MODEL_CHANNELS; ++plane) {
+ float *values = accumulator + plane * MODEL_SEGMENT_FRAMES;
+ memmove(values, values + MODEL_STRIDE_FRAMES,
+ (size_t)MODEL_OVERLAP_FRAMES * sizeof(float));
+ memset(values + MODEL_OVERLAP_FRAMES, 0,
+ (size_t)MODEL_STRIDE_FRAMES * sizeof(float));
+ }
+ memmove(weight, weight + MODEL_STRIDE_FRAMES,
+ (size_t)MODEL_OVERLAP_FRAMES * sizeof(float));
+ memset(weight + MODEL_OVERLAP_FRAMES, 0,
+ (size_t)MODEL_STRIDE_FRAMES * sizeof(float));
+}
+
+static bool separate_audio(Model *model, Resampler *resampler, OutputSet *outputs,
+ float *input, float *accumulator, float *weight,
+ const float *window, int *failure_code, Error *error)
+{
+ uint64_t total_frames = resampler->output_frames;
+ uint64_t loaded_frames = 0U;
+ uint64_t chunk_count;
+ uint64_t chunk;
+ uint64_t first_target = total_frames < MODEL_SEGMENT_FRAMES ?
+ total_frames : MODEL_SEGMENT_FRAMES;
+
+ chunk_count = (total_frames + MODEL_STRIDE_FRAMES - 1U) /
+ MODEL_STRIDE_FRAMES;
+ if (chunk_count == 0U) {
+ chunk_count = 1U;
+ }
+ if (!fill_model_input(input, resampler, 0U, first_target,
+ &loaded_frames, error)) {
+ *failure_code = EXIT_INPUT;
+ return false;
+ }
+
+ for (chunk = 0U; chunk < chunk_count; ++chunk) {
+ uint64_t start = chunk * MODEL_STRIDE_FRAMES;
+ uint64_t remaining = total_frames - start;
+ uint64_t valid_frames = remaining < MODEL_SEGMENT_FRAMES ?
+ remaining : MODEL_SEGMENT_FRAMES;
+ uint64_t finalized_frames = chunk + 1U == chunk_count ?
+ valid_frames : MODEL_STRIDE_FRAMES;
+ ModelResult result;
+
+ if (g_interrupted) {
+ *failure_code = EXIT_INTERRUPTED;
+ return set_error(error, "interrupted");
+ }
+ fprintf(stderr, "Separating chunk %" PRIu64 "/%" PRIu64 " (%5.1f%%)\n",
+ chunk + 1U, chunk_count,
+ 100.0 * (double)(chunk + 1U) / (double)chunk_count);
+
+ if (!model_run(model, input, &result, error)) {
+ *failure_code = EXIT_MODEL;
+ return false;
+ }
+ if (!accumulate_model_output(accumulator, weight, result.samples,
+ window, valid_frames, error)) {
+ model_result_release(model, &result);
+ *failure_code = EXIT_MODEL;
+ return false;
+ }
+ model_result_release(model, &result);
+ if (!write_finalized_audio(outputs, accumulator, weight,
+ finalized_frames, error)) {
+ *failure_code = EXIT_OUTPUT;
+ return false;
+ }
+
+ if (chunk + 1U < chunk_count) {
+ uint64_t next_start = start + MODEL_STRIDE_FRAMES;
+ uint64_t next_end;
+ shift_overlap_buffers(input, accumulator, weight);
+ if (!checked_add_u64(next_start, MODEL_SEGMENT_FRAMES, &next_end) ||
+ next_end > total_frames) {
+ next_end = total_frames;
+ }
+ if (!fill_model_input(input, resampler, next_start, next_end,
+ &loaded_frames, error)) {
+ *failure_code = EXIT_INPUT;
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+static bool install_signal_handlers(Error *error)
+{
+ struct sigaction action;
+
+ memset(&action, 0, sizeof(action));
+ action.sa_handler = signal_handler;
+ if (sigemptyset(&action.sa_mask) != 0 ||
+ sigaction(SIGINT, &action, NULL) != 0 ||
+ sigaction(SIGTERM, &action, NULL) != 0) {
+ return set_error(error, "cannot install signal handlers: %s", strerror(errno));
+ }
+ return true;
+}
+
+static void print_usage(const char *program)
+{
+ fprintf(stderr, "Usage: %s -wav <wav_file>\n", program);
+}
+
+int main(int argc, char **argv)
+{
+ Error error = {{0}};
+ WavReader reader;
+ Resampler resampler;
+ Model model;
+ OutputSet outputs;
+ char *model_path = NULL;
+ char *input_directory = NULL;
+ char *output_name = NULL;
+ char *output_directory = NULL;
+ float *input = NULL;
+ float *accumulator = NULL;
+ float *weight = NULL;
+ float *window = NULL;
+ uint64_t output_bytes;
+ int exit_code = EXIT_FAILURE_GENERIC;
+
+ memset(&reader, 0, sizeof(reader));
+ memset(&resampler, 0, sizeof(resampler));
+ memset(&model, 0, sizeof(model));
+ memset(&outputs, 0, sizeof(outputs));
+
+ if (argc != 3 || strcmp(argv[1], "-wav") != 0 || argv[2][0] == '\0') {
+ print_usage(argv[0]);
+ return EXIT_USAGE;
+ }
+ if (!install_signal_handlers(&error)) {
+ exit_code = EXIT_INTERNAL;
+ goto cleanup;
+ }
+ if (!regular_readable_file(argv[2], &error, "input WAV") ||
+ !wav_reader_open(&reader, argv[2], &error)) {
+ exit_code = EXIT_INPUT;
+ goto cleanup;
+ }
+ if (!resampler_init(&resampler, &reader, &error)) {
+ exit_code = EXIT_INPUT;
+ goto cleanup;
+ }
+ if (!checked_mul_u64(resampler.output_frames,
+ MODEL_CHANNELS * sizeof(float), &output_bytes) ||
+ output_bytes > UINT32_MAX - 48U) {
+ (void)set_error(&error,
+ "resampled audio is too long for standard RIFF WAV output");
+ exit_code = EXIT_OUTPUT;
+ goto cleanup;
+ }
+
+ model_path = model_path_from_executable(argv[0], &error);
+ if (model_path == NULL) {
+ exit_code = EXIT_INTERNAL;
+ goto cleanup;
+ }
+#ifndef STEMSEP_TEST_FAKE_MODEL
+ if (!regular_readable_file(model_path, &error, "ONNX model")) {
+ exit_code = EXIT_MODEL;
+ goto cleanup;
+ }
+#endif
+
+ input_directory = path_directory(argv[2], &error);
+ output_name = input_stem_name(argv[2], &error);
+ if (input_directory == NULL || output_name == NULL) {
+ exit_code = EXIT_INTERNAL;
+ goto cleanup;
+ }
+ output_directory = join_path(input_directory, output_name, &error);
+ if (output_directory == NULL) {
+ exit_code = EXIT_INTERNAL;
+ goto cleanup;
+ }
+
+ input = calloc_array((size_t)(MODEL_CHANNELS * MODEL_SEGMENT_FRAMES),
+ sizeof(float), &error, "model input");
+ accumulator = calloc_array((size_t)(MODEL_STEMS * MODEL_CHANNELS *
+ MODEL_SEGMENT_FRAMES),
+ sizeof(float), &error, "overlap accumulator");
+ weight = calloc_array((size_t)MODEL_SEGMENT_FRAMES, sizeof(float),
+ &error, "overlap weights");
+ window = calloc_array((size_t)MODEL_SEGMENT_FRAMES, sizeof(float),
+ &error, "transition window");
+ if (input == NULL || accumulator == NULL || weight == NULL || window == NULL ||
+ !build_transition_window(window, &error)) {
+ exit_code = EXIT_INTERNAL;
+ goto cleanup;
+ }
+
+ fprintf(stderr,
+ "Input: %u channel%s, %" PRIu32 " Hz, %" PRIu64
+ " frames -> stereo %u Hz, %" PRIu64 " frames\n",
+ (unsigned)reader.channels, reader.channels == 1U ? "" : "s",
+ reader.sample_rate, reader.total_frames, MODEL_SAMPLE_RATE,
+ resampler.output_frames);
+ fprintf(stderr, "Model: %s\n", model_path);
+
+ if (!model_init(&model, model_path, input, &error)) {
+ exit_code = EXIT_MODEL;
+ goto cleanup;
+ }
+ if (!output_set_create(&outputs, output_directory, &error)) {
+ exit_code = EXIT_OUTPUT;
+ goto cleanup;
+ }
+ if (!separate_audio(&model, &resampler, &outputs, input, accumulator,
+ weight, window, &exit_code, &error)) {
+ goto cleanup;
+ }
+ if (!output_set_commit(&outputs, resampler.output_frames, &error)) {
+ exit_code = EXIT_OUTPUT;
+ goto cleanup;
+ }
+ fprintf(stderr, "Wrote six stems to %s\n", output_directory);
+ exit_code = EXIT_OK;
+
+cleanup:
+ if (exit_code != EXIT_OK && error.message[0] != '\0') {
+ fprintf(stderr, "error: %s\n", error.message);
+ }
+ output_set_cleanup(&outputs);
+ model_destroy(&model);
+ free(window);
+ free(weight);
+ free(accumulator);
+ free(input);
+ free(output_directory);
+ free(output_name);
+ free(input_directory);
+ free(model_path);
+ resampler_destroy(&resampler);
+ wav_reader_close(&reader);
+ return exit_code;
+}
diff --git a/models/README.md b/models/README.md
new file mode 100644
index 0000000..9be18f1
--- /dev/null
+++ b/models/README.md
@@ -0,0 +1,4 @@
+# Model directory
+
+Place the pinned `htdemucs_6s.onnx` model here. See the root `README.md` for
+the download URL and SHA-256 checksum.
diff --git a/third_party/onnxruntime/LICENSE b/third_party/onnxruntime/LICENSE
new file mode 100644
index 0000000..48bc6bb
--- /dev/null
+++ b/third_party/onnxruntime/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) Microsoft Corporation
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/third_party/onnxruntime/ThirdPartyNotices.txt b/third_party/onnxruntime/ThirdPartyNotices.txt
new file mode 100644
index 0000000..a449e42
--- /dev/null
+++ b/third_party/onnxruntime/ThirdPartyNotices.txt
@@ -0,0 +1,6082 @@
+THIRD PARTY SOFTWARE NOTICES AND INFORMATION
+
+Do Not Translate or Localize
+
+This software incorporates material from third parties. Microsoft makes certain
+open source code available at http://3rdpartysource.microsoft.com, or you may
+send a check or money order for US $5.00, including the product name, the open
+source component name, and version number, to:
+
+Source Code Compliance Team
+Microsoft Corporation
+One Microsoft Way
+Redmond, WA 98052
+USA
+
+Notwithstanding any other terms, you may reverse engineer this software to the
+extent required to debug changes to any libraries licensed under the GNU Lesser
+General Public License.
+
+_____
+
+Intel Math Kernel Library (Intel MKL)
+
+Intel Simplified Software License (Version April 2018)
+
+Copyright (c) 2018 Intel Corporation.
+
+Use and Redistribution. You may use and redistribute the software (the “Software”), without modification,
+provided the following conditions are met:
+
+* Redistributions must reproduce the above copyright notice and the following terms of use in the Software
+and in the documentation and/or other materials provided with the distribution.
+
+* Neither the name of Intel nor the names of its suppliers may be used to endorse or promote products
+derived from this Software without specific prior written permission.
+
+* No reverse engineering, decompilation, or disassembly of this Software is permitted.
+
+Limited patent license. Intel grants you a world-wide, royalty-free, non-exclusive license under patents it now
+or hereafter owns or controls to make, have made, use, import, offer to sell and sell (“Utilize”) this Software,
+but solely to the extent that any such patent is necessary to Utilize the Software alone. The patent license
+shall not apply to any combinations which include this software. No hardware per se is licensed hereunder.
+
+Third party and other Intel programs. “Third Party Programs” are the files listed in the “third-party-programs.txt”
+text file that is included with the Software and may include Intel programs under separate license terms.
+Third Party Programs, even if included with the distribution of the Materials, are governed by
+separate license terms and those license terms solely govern your use of those programs.
+
+DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE DISCLAIMED. THIS SOFTWARE IS
+NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS WHERE FAILURE OF THE SOFTWARE
+MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE THAT YOU ARE FULLY RESPONSIBLE FOR ANY
+CLAIMS, COSTS, DAMAGES, EXPENSES, AND ATTORNEYS’ FEES ARISING OUT OF ANY SUCH USE,
+EVEN IF ANY CLAIM ALLEGES THAT INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF
+THE MATERIALS.
+
+LIMITATION OF LIABILITY. IN NO EVENT WILL INTEL BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGE. YOU AGREE TO INDEMNIFY AND HOLD INTEL HARMLESS AGAINST ANY CLAIMS
+AND EXPENSES RESULTING FROM YOUR USE OR UNAUTHORIZED USE OF THE SOFTWARE.
+
+No support. Intel may make changes to the Software, at any time without notice, and is not obligated to
+support, update or provide training for the Software.
+
+Termination. Intel may terminate your right to use the Software in the event of your breach of this Agreement
+and you fail to cure the breach within a reasonable period of time.
+
+Feedback. Should you provide Intel with comments, modifications, corrections, enhancements or other input
+(“Feedback”) related to the Software Intel will be free to use, disclose, reproduce, license or otherwise
+distribute or exploit the Feedback in its sole discretion without any obligations or restrictions of any kind,
+including without limitation, intellectual property rights or licensing obligations.
+
+Compliance with laws. You agree to comply with all relevant laws and regulations governing your use,
+transfer, import or export (or prohibition thereof) of the Software.
+
+Governing law. All disputes will be governed by the laws of the United States of America and the State of
+Delaware without reference to conflict of law principles and subject to the exclusive jurisdiction of the state or
+federal courts sitting in the State of Delaware, and each party agrees that it submits to the personal
+jurisdiction and venue of those courts and waives any objections. The United Nations Convention on
+Contracts for the International Sale of Goods (1980) is specifically excluded and will not apply to the
+Software.
+
+*Other names and brands may be claimed as the property of others.
+
+_____
+
+protocolbuffers/protobuf
+
+Copyright 2008 Google Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Code generated by the Protocol Buffer compiler is owned by the owner
+of the input file used when generating it. This code is not
+standalone and requires a support library to be linked with it. This
+support library is itself covered by the above license.
+
+_____
+
+madler/zlib
+
+The deflate format used by zlib was defined by Phil Katz. The deflate and
+zlib specifications were written by L. Peter Deutsch. Thanks to all the
+people who reported problems and suggested various improvements in zlib; they
+are too numerous to cite here.
+
+Copyright notice:
+
+ (C) 1995-2017 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+If you use the zlib library in a product, we would appreciate *not* receiving
+lengthy legal documents to sign. The sources are provided for free but without
+warranty of any kind. The library has been entirely written by Jean-loup
+Gailly and Mark Adler; it does not include third-party code.
+
+If you redistribute modified sources, we would appreciate that you include in
+the file ChangeLog history information documenting your changes. Please read
+the FAQ for more information on the distribution of modified source versions.
+
+_____
+
+pybind/pybind11
+
+Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>, All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Please also refer to the file CONTRIBUTING.md, which clarifies licensing of
+external contributions to this project including patches, pull requests, etc.
+
+_____
+
+onnx
+Open Neural Network Exchange
+
+Copyright (c) Facebook, Inc. and Microsoft Corporation. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+_____
+
+Eigen
+
+MPL v2.0
+Mozilla Public License Version 2.0
+
+
+==================================
+
+1. Definitions
+
+--------------
+
+1.1. "Contributor"
+ means each individual or legal entity that creates, contributes to
+ the creation of, or owns Covered Software.
+
+1.2. "Contributor Version"
+ means the combination of the Contributions of others (if any) used
+ by a Contributor and that particular Contributor's Contribution.
+
+1.3. "Contribution"
+ means Covered Software of a particular Contributor.
+
+1.4. "Covered Software"
+ means Source Code Form to which the initial Contributor has attached
+ the notice in Exhibit A, the Executable Form of such Source Code
+ Form, and Modifications of such Source Code Form, in each case
+ including portions thereof.
+
+1.5. "Incompatible With Secondary Licenses"
+ means
+
+ (a) that the initial Contributor has attached the notice described
+ in Exhibit B to the Covered Software; or
+
+ (b) that the Covered Software was made available under the terms of
+ version 1.1 or earlier of the License, but not also under the
+ terms of a Secondary License.
+
+1.6. "Executable Form"
+ means any form of the work other than Source Code Form.
+
+1.7. "Larger Work"
+ means a work that combines Covered Software with other material, in
+ a separate file or files, that is not Covered Software.
+
+1.8. "License"
+ means this document.
+
+1.9. "Licensable"
+ means having the right to grant, to the maximum extent possible,
+ whether at the time of the initial grant or subsequently, any and
+ all of the rights conveyed by this License.
+
+1.10. "Modifications"
+ means any of the following:
+
+ (a) any file in Source Code Form that results from an addition to,
+ deletion from, or modification of the contents of Covered
+ Software; or
+
+ (b) any new file in Source Code Form that contains any Covered
+ Software.
+
+1.11. "Patent Claims" of a Contributor
+ means any patent claim(s), including without limitation, method,
+ process, and apparatus claims, in any patent Licensable by such
+ Contributor that would be infringed, but for the grant of the
+ License, by the making, using, selling, offering for sale, having
+ made, import, or transfer of either its Contributions or its
+ Contributor Version.
+
+1.12. "Secondary License"
+ means either the GNU General Public License, Version 2.0, the GNU
+ Lesser General Public License, Version 2.1, the GNU Affero General
+ Public License, Version 3.0, or any later versions of those
+ licenses.
+
+1.13. "Source Code Form"
+ means the form of the work preferred for making modifications.
+
+1.14. "You" (or "Your")
+ means an individual or a legal entity exercising rights under this
+ License. For legal entities, "You" includes any entity that
+ controls, is controlled by, or is under common control with You. For
+ purposes of this definition, "control" means (a) the power, direct
+ or indirect, to cause the direction or management of such entity,
+ whether by contract or otherwise, or (b) ownership of more than
+ fifty percent (50%) of the outstanding shares or beneficial
+ ownership of such entity.
+
+2. License Grants and Conditions
+
+--------------------------------
+
+2.1. Grants
+
+Each Contributor hereby grants You a world-wide, royalty-free,
+non-exclusive license:
+
+(a) under intellectual property rights (other than patent or trademark)
+ Licensable by such Contributor to use, reproduce, make available,
+ modify, display, perform, distribute, and otherwise exploit its
+ Contributions, either on an unmodified basis, with Modifications, or
+ as part of a Larger Work; and
+
+(b) under Patent Claims of such Contributor to make, use, sell, offer
+ for sale, have made, import, and otherwise transfer either its
+ Contributions or its Contributor Version.
+
+2.2. Effective Date
+
+The licenses granted in Section 2.1 with respect to any Contribution
+become effective for each Contribution on the date the Contributor first
+distributes such Contribution.
+
+2.3. Limitations on Grant Scope
+
+The licenses granted in this Section 2 are the only rights granted under
+this License. No additional rights or licenses will be implied from the
+distribution or licensing of Covered Software under this License.
+Notwithstanding Section 2.1(b) above, no patent license is granted by a
+Contributor:
+
+(a) for any code that a Contributor has removed from Covered Software;
+ or
+
+(b) for infringements caused by: (i) Your and any other third party's
+ modifications of Covered Software, or (ii) the combination of its
+ Contributions with other software (except as part of its Contributor
+ Version); or
+
+(c) under Patent Claims infringed by Covered Software in the absence of
+ its Contributions.
+
+This License does not grant any rights in the trademarks, service marks,
+or logos of any Contributor (except as may be necessary to comply with
+the notice requirements in Section 3.4).
+
+2.4. Subsequent Licenses
+
+No Contributor makes additional grants as a result of Your choice to
+distribute the Covered Software under a subsequent version of this
+License (see Section 10.2) or under the terms of a Secondary License (if
+permitted under the terms of Section 3.3).
+
+2.5. Representation
+
+Each Contributor represents that the Contributor believes its
+Contributions are its original creation(s) or it has sufficient rights
+to grant the rights to its Contributions conveyed by this License.
+
+2.6. Fair Use
+
+This License is not intended to limit any rights You have under
+applicable copyright doctrines of fair use, fair dealing, or other
+equivalents.
+
+2.7. Conditions
+
+Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
+in Section 2.1.
+
+3. Responsibilities
+
+-------------------
+
+3.1. Distribution of Source Form
+
+All distribution of Covered Software in Source Code Form, including any
+Modifications that You create or to which You contribute, must be under
+the terms of this License. You must inform recipients that the Source
+Code Form of the Covered Software is governed by the terms of this
+License, and how they can obtain a copy of this License. You may not
+attempt to alter or restrict the recipients' rights in the Source Code
+Form.
+
+3.2. Distribution of Executable Form
+
+If You distribute Covered Software in Executable Form then:
+
+(a) such Covered Software must also be made available in Source Code
+ Form, as described in Section 3.1, and You must inform recipients of
+ the Executable Form how they can obtain a copy of such Source Code
+ Form by reasonable means in a timely manner, at a charge no more
+ than the cost of distribution to the recipient; and
+
+(b) You may distribute such Executable Form under the terms of this
+ License, or sublicense it under different terms, provided that the
+ license for the Executable Form does not attempt to limit or alter
+ the recipients' rights in the Source Code Form under this License.
+
+3.3. Distribution of a Larger Work
+
+You may create and distribute a Larger Work under terms of Your choice,
+provided that You also comply with the requirements of this License for
+the Covered Software. If the Larger Work is a combination of Covered
+Software with a work governed by one or more Secondary Licenses, and the
+Covered Software is not Incompatible With Secondary Licenses, this
+License permits You to additionally distribute such Covered Software
+under the terms of such Secondary License(s), so that the recipient of
+the Larger Work may, at their option, further distribute the Covered
+Software under the terms of either this License or such Secondary
+License(s).
+
+3.4. Notices
+
+You may not remove or alter the substance of any license notices
+(including copyright notices, patent notices, disclaimers of warranty,
+or limitations of liability) contained within the Source Code Form of
+the Covered Software, except that You may alter any license notices to
+the extent required to remedy known factual inaccuracies.
+
+3.5. Application of Additional Terms
+
+You may choose to offer, and to charge a fee for, warranty, support,
+indemnity or liability obligations to one or more recipients of Covered
+Software. However, You may do so only on Your own behalf, and not on
+behalf of any Contributor. You must make it absolutely clear that any
+such warranty, support, indemnity, or liability obligation is offered by
+You alone, and You hereby agree to indemnify every Contributor for any
+liability incurred by such Contributor as a result of warranty, support,
+indemnity or liability terms You offer. You may include additional
+disclaimers of warranty and limitations of liability specific to any
+jurisdiction.
+
+4. Inability to Comply Due to Statute or Regulation
+
+---------------------------------------------------
+
+If it is impossible for You to comply with any of the terms of this
+License with respect to some or all of the Covered Software due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description must
+be placed in a text file included with all distributions of the Covered
+Software under this License. Except to the extent prohibited by statute
+or regulation, such description must be sufficiently detailed for a
+recipient of ordinary skill to be able to understand it.
+
+5. Termination
+
+--------------
+
+5.1. The rights granted under this License will terminate automatically
+if You fail to comply with any of its terms. However, if You become
+compliant, then the rights granted under this License from a particular
+Contributor are reinstated (a) provisionally, unless and until such
+Contributor explicitly and finally terminates Your grants, and (b) on an
+ongoing basis, if such Contributor fails to notify You of the
+non-compliance by some reasonable means prior to 60 days after You have
+come back into compliance. Moreover, Your grants from a particular
+Contributor are reinstated on an ongoing basis if such Contributor
+notifies You of the non-compliance by some reasonable means, this is the
+first time You have received notice of non-compliance with this License
+from such Contributor, and You become compliant prior to 30 days after
+Your receipt of the notice.
+
+5.2. If You initiate litigation against any entity by asserting a patent
+infringement claim (excluding declaratory judgment actions,
+counter-claims, and cross-claims) alleging that a Contributor Version
+directly or indirectly infringes any patent, then the rights granted to
+You by any and all Contributors for the Covered Software under Section
+2.1 of this License shall terminate.
+
+5.3. In the event of termination under Sections 5.1 or 5.2 above, all
+end user license agreements (excluding distributors and resellers) which
+have been validly granted by You or Your distributors under this License
+prior to termination shall survive termination.
+
+************************************************************************
+* *
+* 6. Disclaimer of Warranty *
+* ------------------------- *
+* *
+* Covered Software is provided under this License on an "as is" *
+* basis, without warranty of any kind, either expressed, implied, or *
+* statutory, including, without limitation, warranties that the *
+* Covered Software is free of defects, merchantable, fit for a *
+* particular purpose or non-infringing. The entire risk as to the *
+* quality and performance of the Covered Software is with You. *
+* Should any Covered Software prove defective in any respect, You *
+* (not any Contributor) assume the cost of any necessary servicing, *
+* repair, or correction. This disclaimer of warranty constitutes an *
+* essential part of this License. No use of any Covered Software is *
+* authorized under this License except under this disclaimer. *
+* *
+************************************************************************
+
+************************************************************************
+* *
+* 7. Limitation of Liability *
+* -------------------------- *
+* *
+* Under no circumstances and under no legal theory, whether tort *
+* (including negligence), contract, or otherwise, shall any *
+* Contributor, or anyone who distributes Covered Software as *
+* permitted above, be liable to You for any direct, indirect, *
+* special, incidental, or consequential damages of any character *
+* including, without limitation, damages for lost profits, loss of *
+* goodwill, work stoppage, computer failure or malfunction, or any *
+* and all other commercial damages or losses, even if such party *
+* shall have been informed of the possibility of such damages. This *
+* limitation of liability shall not apply to liability for death or *
+* personal injury resulting from such party's negligence to the *
+* extent applicable law prohibits such limitation. Some *
+* jurisdictions do not allow the exclusion or limitation of *
+* incidental or consequential damages, so this exclusion and *
+* limitation may not apply to You. *
+* *
+************************************************************************
+8. Litigation
+-------------
+
+Any litigation relating to this License may be brought only in the
+courts of a jurisdiction where the defendant maintains its principal
+place of business and such litigation shall be governed by laws of that
+jurisdiction, without reference to its conflict-of-law provisions.
+Nothing in this Section shall prevent a party's ability to bring
+cross-claims or counter-claims.
+
+9. Miscellaneous
+----------------
+
+This License represents the complete agreement concerning the subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. Any law or regulation which provides
+that the language of a contract shall be construed against the drafter
+shall not be used to construe this License against a Contributor.
+
+10. Versions of the License
+---------------------------
+
+10.1. New Versions
+
+Mozilla Foundation is the license steward. Except as provided in Section
+10.3, no one other than the license steward has the right to modify or
+publish new versions of this License. Each version will be given a
+distinguishing version number.
+
+10.2. Effect of New Versions
+
+You may distribute the Covered Software under the terms of the version
+of the License under which You originally received the Covered Software,
+or under the terms of any subsequent version published by the license
+steward.
+
+10.3. Modified Versions
+
+If you create software not governed by this License, and you want to
+create a new license for such software, you may create and use a
+modified version of this License if you rename the license and remove
+any references to the name of the license steward (except to note that
+such modified license differs from this License).
+
+10.4. Distributing Source Code Form that is Incompatible With Secondary
+Licenses
+
+If You choose to distribute Source Code Form that is Incompatible With
+Secondary Licenses under the terms of this version of the License, the
+notice described in Exhibit B of this License must be attached.
+
+Exhibit A - Source Code Form License Notice
+-------------------------------------------
+
+ This Source Code Form is subject to the terms of the Mozilla Public
+ License, v. 2.0. If a copy of the MPL was not distributed with this
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+If it is not possible or desirable to put the notice in a particular
+file, then You may include the notice in a location (such as a LICENSE
+file in a relevant directory) where a recipient would be likely to look
+for such a notice.
+
+You may add additional accurate notices of copyright ownership.
+
+Exhibit B - "Incompatible With Secondary Licenses" Notice
+---------------------------------------------------------
+
+ This Source Code Form is "Incompatible With Secondary Licenses", as
+ defined by the Mozilla Public License, v. 2.0.
+
+_____
+
+intel/dnnl
+
+Copyright 2016-2018 Intel Corporation
+
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+sub-components:
+
+xbyak
+
+Copyright (c) 2007 MITSUNARI Shigeo. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+Neither the name of the copyright owner nor the names of its contributors may
+be used to endorse or promote products derived from this software without
+specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+
+_____
+
+Microsoft GSL
+
+Copyright (c) 2015 Microsoft Corporation. All rights reserved.
+
+This code is licensed under the MIT License (MIT).
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+_____
+
+Tensorflow
+
+Copyright 2018 The TensorFlow Authors. All rights reserved.
+
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction,
+and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by
+the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all
+other entities that control, are controlled by, or are under common
+control with that entity. For the purposes of this definition,
+"control" means (i) the power, direct or indirect, to cause the
+direction or management of such entity, whether by contract or
+otherwise, or (ii) ownership of fifty percent (50%) or more of the
+outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity
+exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications,
+including but not limited to software source code, documentation
+source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical
+transformation or translation of a Source form, including but
+not limited to compiled object code, generated documentation,
+and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or
+Object form, made available under the License, as indicated by a
+copyright notice that is included in or attached to the work
+(an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object
+form, that is based on (or derived from) the Work and for which the
+editorial revisions, annotations, elaborations, or other modifications
+represent, as a whole, an original work of authorship. For the purposes
+of this License, Derivative Works shall not include works that remain
+separable from, or merely link (or bind by name) to the interfaces of,
+the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including
+the original version of the Work and any modifications or additions
+to that Work or Derivative Works thereof, that is intentionally
+submitted to Licensor for inclusion in the Work by the copyright owner
+or by an individual or Legal Entity authorized to submit on behalf of
+the copyright owner. For the purposes of this definition, "submitted"
+means any form of electronic, verbal, or written communication sent
+to the Licensor or its representatives, including but not limited to
+communication on electronic mailing lists, source code control systems,
+and issue tracking systems that are managed by, or on behalf of, the
+Licensor for the purpose of discussing and improving the Work, but
+excluding communication that is conspicuously marked or otherwise
+designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity
+on behalf of whom a Contribution has been received by Licensor and
+subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the
+Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+this License, each Contributor hereby grants to You a perpetual,
+worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+(except as stated in this section) patent license to make, have made,
+use, offer to sell, sell, import, and otherwise transfer the Work,
+where such license applies only to those patent claims licensable
+by such Contributor that are necessarily infringed by their
+Contribution(s) alone or by combination of their Contribution(s)
+with the Work to which such Contribution(s) was submitted. If You
+institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work
+or a Contribution incorporated within the Work constitutes direct
+or contributory patent infringement, then any patent licenses
+granted to You under this License for that Work shall terminate
+as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+Work or Derivative Works thereof in any medium, with or without
+modifications, and in Source or Object form, provided that You
+meet the following conditions:
+
+(a) You must give any other recipients of the Work or
+Derivative Works a copy of this License; and
+
+(b) You must cause any modified files to carry prominent notices
+stating that You changed the files; and
+
+(c) You must retain, in the Source form of any Derivative Works
+that You distribute, all copyright, patent, trademark, and
+attribution notices from the Source form of the Work,
+excluding those notices that do not pertain to any part of
+the Derivative Works; and
+
+(d) If the Work includes a "NOTICE" text file as part of its
+distribution, then any Derivative Works that You distribute must
+include a readable copy of the attribution notices contained
+within such NOTICE file, excluding those notices that do not
+pertain to any part of the Derivative Works, in at least one
+of the following places: within a NOTICE text file distributed
+as part of the Derivative Works; within the Source form or
+documentation, if provided along with the Derivative Works; or,
+within a display generated by the Derivative Works, if and
+wherever such third-party notices normally appear. The contents
+of the NOTICE file are for informational purposes only and
+do not modify the License. You may add Your own attribution
+notices within Derivative Works that You distribute, alongside
+or as an addendum to the NOTICE text from the Work, provided
+that such additional attribution notices cannot be construed
+as modifying the License.
+
+You may add Your own copyright statement to Your modifications and
+may provide additional or different license terms and conditions
+for use, reproduction, or distribution of Your modifications, or
+for any such Derivative Works as a whole, provided Your use,
+reproduction, and distribution of the Work otherwise complies with
+the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+any Contribution intentionally submitted for inclusion in the Work
+by You to the Licensor shall be under the terms and conditions of
+this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify
+the terms of any separate license agreement you may have executed
+with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+names, trademarks, service marks, or product names of the Licensor,
+except as required for reasonable and customary use in describing the
+origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+agreed to in writing, Licensor provides the Work (and each
+Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+implied, including, without limitation, any warranties or conditions
+of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+PARTICULAR PURPOSE. You are solely responsible for determining the
+appropriateness of using or redistributing the Work and assume any
+risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+whether in tort (including negligence), contract, or otherwise,
+unless required by applicable law (such as deliberate and grossly
+negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special,
+incidental, or consequential damages of any character arising as a
+result of this License or out of the use or inability to use the
+Work (including but not limited to damages for loss of goodwill,
+work stoppage, computer failure or malfunction, or any and all
+other commercial damages or losses), even if such Contributor
+has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+the Work or Derivative Works thereof, You may choose to offer,
+and charge a fee for, acceptance of support, warranty, indemnity,
+or other liability obligations and/or rights consistent with this
+License. However, in accepting such obligations, You may act only
+on Your own behalf and on Your sole responsibility, not on behalf
+of any other Contributor, and only if You agree to indemnify,
+defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason
+of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2017, The TensorFlow Authors.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+_____
+
+Microsoft Cognitive Toolkit (CNTK)
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify,
+merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
+LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+_____
+
+NumPy License
+
+Copyright (c) 2005, NumPy Developers
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+ Neither the name of the NumPy Developers nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+_____
+
+Pytorch / Caffe2
+
+From PyTorch:
+
+Copyright (c) 2016- Facebook, Inc (Adam Paszke)
+Copyright (c) 2014- Facebook, Inc (Soumith Chintala)
+Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert)
+Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu)
+Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu)
+Copyright (c) 2011-2013 NYU (Clement Farabet)
+Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston)
+Copyright (c) 2006 Idiap Research Institute (Samy Bengio)
+Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz)
+
+From Caffe2:
+
+Copyright (c) 2016-present, Facebook Inc. All rights reserved.
+
+All contributions by Facebook:
+Copyright (c) 2016 Facebook Inc.
+
+All contributions by Google:
+Copyright (c) 2015 Google Inc.
+All rights reserved.
+
+All contributions by Yangqing Jia:
+Copyright (c) 2015 Yangqing Jia
+All rights reserved.
+
+All contributions from Caffe:
+Copyright(c) 2013, 2014, 2015, the respective contributors
+All rights reserved.
+
+All other contributions:
+Copyright(c) 2015, 2016 the respective contributors
+All rights reserved.
+
+Caffe2 uses a copyright model similar to Caffe: each contributor holds
+copyright over their contributions to Caffe2. The project versioning records
+all such contribution and copyright details. If a contributor wants to further
+mark their specific copyright on a particular contribution, they should
+indicate their copyright solely in the commit message of the change when it is
+committed. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+3. Neither the names of Facebook, Deepmind Technologies, NYU, NEC Laboratories America
+ and IDIAP Research Institute nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+_____
+
+Caffe
+
+COPYRIGHT
+
+All contributions by the University of California:
+Copyright (c) 2014-2017 The Regents of the University of California (Regents)
+All rights reserved.
+
+All other contributions:
+Copyright (c) 2014-2017, the respective contributors
+All rights reserved.
+
+Caffe uses a shared copyright model: each contributor holds copyright over
+their contributions to Caffe. The project versioning records all such
+contribution and copyright details. If a contributor wants to further mark
+their specific copyright on a particular contribution, they should indicate
+their copyright solely in the commit message of the change when it is
+committed.
+
+LICENSE
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+CONTRIBUTION AGREEMENT
+
+By contributing to the BVLC/caffe repository through pull-request, comment,
+or otherwise, the contributor releases their content to the
+license and copyright terms herein.
+
+_____
+
+The LLVM Compiler Infrastructure
+
+==============================================================================
+LLVM Release License
+==============================================================================
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2003-2017 University of Illinois at Urbana-Champaign.
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+
+==============================================================================
+Copyrights and Licenses for Third Party Software Distributed with LLVM:
+==============================================================================
+The LLVM software contains code written by third parties. Such software will
+have its own individual LICENSE.TXT file in the directory in which it appears.
+This file will describe the copyrights, license, and restrictions which apply
+to that code.
+
+The disclaimer of warranty in the University of Illinois Open Source License
+applies to all code in the LLVM Distribution, and nothing in any of the
+other licenses gives permission to use the names of the LLVM Team or the
+University of Illinois to endorse or promote products derived from this
+Software.
+
+The following pieces of software have additional or alternate copyrights,
+licenses, and/or restrictions:
+
+Program Directory
+------- ---------
+Google Test llvm/utils/unittest/googletest
+OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex}
+pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT}
+ARM contributions llvm/lib/Target/ARM/LICENSE.TXT
+md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
+
+_____
+
+google/benchmark
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+CONTRIBUTORS
+
+# People who have agreed to one of the CLAs and can contribute patches.
+# The AUTHORS file lists the copyright holders; this file
+# lists people. For example, Google employees are listed here
+# but not in AUTHORS, because Google holds the copyright.
+#
+# Names should be added to this file only after verifying that
+# the individual or the individual's organization has agreed to
+# the appropriate Contributor License Agreement, found here:
+#
+# https://developers.google.com/open-source/cla/individual
+# https://developers.google.com/open-source/cla/corporate
+#
+# The agreement for individuals can be filled out on the web.
+#
+# When adding J Random Contributor's name to this file,
+# either J's name or J's organization's name should be
+# added to the AUTHORS file, depending on whether the
+# individual or corporate CLA was used.
+#
+# Names should be added to this file as:
+# Name <email address>
+#
+# Please keep the list sorted.
+
+Albert Pretorius <pretoalb@gmail.com>
+Arne Beer <arne@twobeer.de>
+Billy Robert O'Neal III <billy.oneal@gmail.com> <bion@microsoft.com>
+Chris Kennelly <ckennelly@google.com> <ckennelly@ckennelly.com>
+Christopher Seymour <chris.j.seymour@hotmail.com>
+David Coeurjolly <david.coeurjolly@liris.cnrs.fr>
+Deniz Evrenci <denizevrenci@gmail.com>
+Dominic Hamon <dma@stripysock.com> <dominic@google.com>
+Dominik Czarnota <dominik.b.czarnota@gmail.com>
+Eric Fiselier <eric@efcs.ca>
+Eugene Zhuk <eugene.zhuk@gmail.com>
+Evgeny Safronov <division494@gmail.com>
+Federico Ficarelli <federico.ficarelli@gmail.com>
+Felix Homann <linuxaudio@showlabor.de>
+Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com>
+Jern-Kuan Leong <jernkuan@gmail.com>
+JianXiong Zhou <zhoujianxiong2@gmail.com>
+Joao Paulo Magalhaes <joaoppmagalhaes@gmail.com>
+John Millikin <jmillikin@stripe.com>
+Jussi Knuuttila <jussi.knuuttila@gmail.com>
+Kai Wolf <kai.wolf@gmail.com>
+Kishan Kumar <kumar.kishan@outlook.com>
+Kaito Udagawa <umireon@gmail.com>
+Lei Xu <eddyxu@gmail.com>
+Matt Clarkson <mattyclarkson@gmail.com>
+Maxim Vafin <maxvafin@gmail.com>
+Nick Hutchinson <nshutchinson@gmail.com>
+Oleksandr Sochka <sasha.sochka@gmail.com>
+Pascal Leroy <phl@google.com>
+Paul Redmond <paul.redmond@gmail.com>
+Pierre Phaneuf <pphaneuf@google.com>
+Radoslav Yovchev <radoslav.tm@gmail.com>
+Raul Marin <rmrodriguez@cartodb.com>
+Ray Glover <ray.glover@uk.ibm.com>
+Robert Guo <robert.guo@mongodb.com>
+Roman Lebedev <lebedev.ri@gmail.com>
+Shuo Chen <chenshuo@chenshuo.com>
+Tobias Ulvgård <tobias.ulvgard@dirac.se>
+Tom Madams <tom.ej.madams@gmail.com> <tmadams@google.com>
+Yixuan Qiu <yixuanq@gmail.com>
+Yusuke Suzuki <utatane.tea@gmail.com>
+Zbigniew Skowron <zbychs@gmail.com>
+
+AUTHORS
+
+# This is the official list of benchmark authors for copyright purposes.
+# This file is distinct from the CONTRIBUTORS files.
+# See the latter for an explanation.
+#
+# Names should be added to this file as:
+# Name or Organization <email address>
+# The email address is not required for organizations.
+#
+# Please keep the list sorted.
+
+Albert Pretorius <pretoalb@gmail.com>
+Arne Beer <arne@twobeer.de>
+Carto
+Christopher Seymour <chris.j.seymour@hotmail.com>
+David Coeurjolly <david.coeurjolly@liris.cnrs.fr>
+Deniz Evrenci <denizevrenci@gmail.com>
+Dirac Research
+Dominik Czarnota <dominik.b.czarnota@gmail.com>
+Eric Fiselier <eric@efcs.ca>
+Eugene Zhuk <eugene.zhuk@gmail.com>
+Evgeny Safronov <division494@gmail.com>
+Federico Ficarelli <federico.ficarelli@gmail.com>
+Felix Homann <linuxaudio@showlabor.de>
+Google Inc.
+International Business Machines Corporation
+Ismael Jimenez Martinez <ismael.jimenez.martinez@gmail.com>
+Jern-Kuan Leong <jernkuan@gmail.com>
+JianXiong Zhou <zhoujianxiong2@gmail.com>
+Joao Paulo Magalhaes <joaoppmagalhaes@gmail.com>
+Jussi Knuuttila <jussi.knuuttila@gmail.com>
+Kaito Udagawa <umireon@gmail.com>
+Kishan Kumar <kumar.kishan@outlook.com>
+Lei Xu <eddyxu@gmail.com>
+Matt Clarkson <mattyclarkson@gmail.com>
+Maxim Vafin <maxvafin@gmail.com>
+MongoDB Inc.
+Nick Hutchinson <nshutchinson@gmail.com>
+Oleksandr Sochka <sasha.sochka@gmail.com>
+Paul Redmond <paul.redmond@gmail.com>
+Radoslav Yovchev <radoslav.tm@gmail.com>
+Roman Lebedev <lebedev.ri@gmail.com>
+Shuo Chen <chenshuo@chenshuo.com>
+Steinar H. Gunderson <sgunderson@bigfoot.com>
+Stripe, Inc.
+Yixuan Qiu <yixuanq@gmail.com>
+Yusuke Suzuki <utatane.tea@gmail.com>
+Zbigniew Skowron <zbychs@gmail.com>
+
+_____
+
+HalideIR
+
+Copyright (c) 2016 HalideIR contributors
+Copyright (c) 2012-2014 MIT CSAIL, Google Inc., and other contributors
+HalideIR is derived from the Halide project.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+_____
+
+Distributed Machine Learning Common Codebase
+
+Copyright (c) 2015 by Contributors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+_____
+
+DLPack: Open In Memory Tensor Structure
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2017 by Contributors
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+_____
+
+HowardHinnant/date
+
+The source code in this project is released using the MIT License. There is no
+global license for the project because each file is licensed individually with
+different author names and/or dates.
+
+If you contribute to this project, please add your name to the license of each
+file you modify. If you have already contributed to this project and forgot to
+add your name to the license, please feel free to submit a new P/R to add your
+name to the license in each file you modified.
+
+For convenience, here is a copy of the MIT license found in each file except
+without author names or dates:
+
+The MIT License (MIT)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+_____
+
+FreeBSD: getopt.c file
+
+Copyright (c) 1987, 1993, 1994
+The Regents of the University of California. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the University nor the names of its contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+_____
+
+
+google/googletest
+
+Copyright 2008, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+_____
+
+G3log : Asynchronous logger with Dynamic Sinks
+
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
+_____
+
+Scikit-learn
+
+Copyright (c) 2007–2018 The scikit-learn developers.
+All rights reserved.
+
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ a. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ b. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ c. Neither the name of the Scikit-learn Developers nor the names of
+ its contributors may be used to endorse or promote products
+ derived from this software without specific prior written
+ permission.
+
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
+
+_____
+
+google/re2
+
+Copyright (c) 2009 The RE2 Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+_____
+onnx/onnx-tensorrt
+
+MIT License
+
+Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
+Copyright (c) 2018 Open Neural Network Exchange
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+_____
+nvidia/cutlass
+
+Copyright (c) 2017 - 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+SPDX-License-Identifier: BSD-3-Clause
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+_____
+Boost
+
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+
+_____
+
+JDAI-CV/DNNLibrary
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [2019] [JD.com Inc. JD AI]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+_____
+
+google/flatbuffers
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2014 Google Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+_____
+
+google/glog
+
+Copyright (c) 2008, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+A function gettimeofday in utilities.cc is based on
+
+http://www.google.com/codesearch/p?hl=en#dR3YEbitojA/COPYING&q=GetSystemTimeAsFileTime%20license:bsd
+
+The license of this code is:
+
+Copyright (c) 2003-2008, Jouni Malinen <j@w1.fi> and contributors
+All Rights Reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+3. Neither the name(s) of the above-listed copyright holder(s) nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+_____
+
+abseil-cpp
+https://github.com/abseil/abseil-cpp
+
+ Apache License
+ Version 2.0, January 2004
+ https://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ https://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+_____
+
+microsoft/wil
+
+MIT License
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE
+
+_____
+
+nlohmann/json
+
+MIT License
+
+Copyright (c) 2013-2019 Niels Lohmann
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+_____
+
+dcleblanc/SafeInt
+
+MIT License
+
+Copyright (c) 2018 Microsoft
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+_____
+Open MPI
+
+3-Clause BSD License
+
+Most files in this release are marked with the copyrights of the
+organizations who have edited them. The copyrights below are in no
+particular order and generally reflect members of the Open MPI core
+team who have contributed code to this release. The copyrights for
+code used under license from other parties are included in the
+corresponding files.
+
+Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
+ University Research and Technology
+ Corporation. All rights reserved.
+Copyright (c) 2004-2017 The University of Tennessee and The University
+ of Tennessee Research Foundation. All rights
+ reserved.
+Copyright (c) 2004-2010 High Performance Computing Center Stuttgart,
+ University of Stuttgart. All rights reserved.
+Copyright (c) 2004-2008 The Regents of the University of California.
+ All rights reserved.
+Copyright (c) 2006-2017 Los Alamos National Security, LLC. All rights
+ reserved.
+Copyright (c) 2006-2017 Cisco Systems, Inc. All rights reserved.
+Copyright (c) 2006-2010 Voltaire, Inc. All rights reserved.
+Copyright (c) 2006-2017 Sandia National Laboratories. All rights reserved.
+Copyright (c) 2006-2010 Sun Microsystems, Inc. All rights reserved.
+ Use is subject to license terms.
+Copyright (c) 2006-2017 The University of Houston. All rights reserved.
+Copyright (c) 2006-2009 Myricom, Inc. All rights reserved.
+Copyright (c) 2007-2017 UT-Battelle, LLC. All rights reserved.
+Copyright (c) 2007-2017 IBM Corporation. All rights reserved.
+Copyright (c) 1998-2005 Forschungszentrum Juelich, Juelich Supercomputing
+ Centre, Federal Republic of Germany
+Copyright (c) 2005-2008 ZIH, TU Dresden, Federal Republic of Germany
+Copyright (c) 2007 Evergrid, Inc. All rights reserved.
+Copyright (c) 2008 Chelsio, Inc. All rights reserved.
+Copyright (c) 2008-2009 Institut National de Recherche en
+ Informatique. All rights reserved.
+Copyright (c) 2007 Lawrence Livermore National Security, LLC.
+ All rights reserved.
+Copyright (c) 2007-2017 Mellanox Technologies. All rights reserved.
+Copyright (c) 2006-2010 QLogic Corporation. All rights reserved.
+Copyright (c) 2008-2017 Oak Ridge National Labs. All rights reserved.
+Copyright (c) 2006-2012 Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2009-2015 Bull SAS. All rights reserved.
+Copyright (c) 2010 ARM ltd. All rights reserved.
+Copyright (c) 2016 ARM, Inc. All rights reserved.
+Copyright (c) 2010-2011 Alex Brick . All rights reserved.
+Copyright (c) 2012 The University of Wisconsin-La Crosse. All rights
+ reserved.
+Copyright (c) 2013-2016 Intel, Inc. All rights reserved.
+Copyright (c) 2011-2017 NVIDIA Corporation. All rights reserved.
+Copyright (c) 2016 Broadcom Limited. All rights reserved.
+Copyright (c) 2011-2017 Fujitsu Limited. All rights reserved.
+Copyright (c) 2014-2015 Hewlett-Packard Development Company, LP. All
+ rights reserved.
+Copyright (c) 2013-2017 Research Organization for Information Science (RIST).
+ All rights reserved.
+Copyright (c) 2017-2018 Amazon.com, Inc. or its affiliates. All Rights
+ reserved.
+Copyright (c) 2018 DataDirect Networks. All rights reserved.
+Copyright (c) 2018-2019 Triad National Security, LLC. All rights reserved.
+
+$COPYRIGHT$
+
+Additional copyrights may follow
+
+$HEADER$
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+- Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer listed
+ in this license in the documentation and/or other materials
+ provided with the distribution.
+
+- Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+The copyright holders provide no reassurances that the source code
+provided does not infringe any patent, copyright, or any other
+intellectual property rights of third parties. The copyright holders
+disclaim any liability to any recipient for claims brought against
+recipient by any third party for infringement of that parties
+intellectual property rights.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+_____
+
+The Android Open Source Project
+
+Copyright (C) 2017 The Android Open Source Project
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+------
+
+libprotobuf-mutator
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ -----
+
+ openucx/ucx
+ https://github.com/openucx/ucx
+
+ Copyright (c) 2014-2015 UT-Battelle, LLC. All rights reserved.
+ Copyright (C) 2014-2020 Mellanox Technologies Ltd. All rights reserved.
+ Copyright (C) 2014-2015 The University of Houston System. All rights reserved.
+ Copyright (C) 2015 The University of Tennessee and The University
+ of Tennessee Research Foundation. All rights reserved.
+ Copyright (C) 2016-2020 ARM Ltd. All rights reserved.
+ Copyright (c) 2016 Los Alamos National Security, LLC. All rights reserved.
+ Copyright (C) 2016-2020 Advanced Micro Devices, Inc. All rights reserved.
+ Copyright (C) 2019 UChicago Argonne, LLC. All rights reserved.
+ Copyright (c) 2018-2020 NVIDIA CORPORATION. All rights reserved.
+ Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ Copyright (C) 2016-2020 Stony Brook University. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ -----
+
+ From PyTorch:
+
+ Copyright (c) 2016- Facebook, Inc (Adam Paszke)
+ Copyright (c) 2014- Facebook, Inc (Soumith Chintala)
+ Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert)
+ Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu)
+ Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu)
+ Copyright (c) 2011-2013 NYU (Clement Farabet)
+ Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston)
+ Copyright (c) 2006 Idiap Research Institute (Samy Bengio)
+ Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz)
+
+ From Caffe2:
+
+ Copyright (c) 2016-present, Facebook Inc. All rights reserved.
+
+ All contributions by Facebook:
+ Copyright (c) 2016 Facebook Inc.
+
+ All contributions by Google:
+ Copyright (c) 2015 Google Inc.
+ All rights reserved.
+
+ All contributions by Yangqing Jia:
+ Copyright (c) 2015 Yangqing Jia
+ All rights reserved.
+
+ All contributions from Caffe:
+ Copyright(c) 2013, 2014, 2015, the respective contributors
+ All rights reserved.
+
+ All other contributions:
+ Copyright(c) 2015, 2016 the respective contributors
+ All rights reserved.
+
+ Caffe2 uses a copyright model similar to Caffe: each contributor holds
+ copyright over their contributions to Caffe2. The project versioning records
+ all such contribution and copyright details. If a contributor wants to further
+ mark their specific copyright on a particular contribution, they should
+ indicate their copyright solely in the commit message of the change when it is
+ committed.
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ 3. Neither the names of Facebook, Deepmind Technologies, NYU, NEC Laboratories America
+ and IDIAP Research Institute nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+_____
+
+ mpi4py
+ https://github.com/mpi4py/mpi4py/
+
+ =======================
+ LICENSE: MPI for Python
+ =======================
+
+ :Author: Lisandro Dalcin
+ :Contact: dalcinl@gmail.com
+
+
+ Copyright (c) 2019, Lisandro Dalcin.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+_____
+huggingface/transformers
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+_____
+msgpack/msgpack-python
+
+Copyright (C) 2008-2011 INADA Naoki <songofacandy@gmail.com>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+_____
+lanpa/tensorboardX
+
+MIT License
+
+Copyright (c) 2017 Tzu-Wei Huang
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+_____
+tensorflow/tensorboard
+
+Copyright 2017 The TensorFlow Authors. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2017, The TensorFlow Authors.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+_____
+
+cerberus
+
+Cerberus is a lightweight and extensible data validation library for Python.
+
+ISC License
+
+Copyright (c) 2012-2016 Nicola Iarocci.
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+_____
+
+MurmurHash3
+
+MIT license
+
+https://github.com/aappleby/smhasher
+
+SMHasher is a test suite designed to test the distribution, collision, and
+performance properties of non-cryptographic hash functions.
+This is the home for the MurmurHash family of hash functions along with the
+SMHasher test suite used to verify them.
+SMHasher is released under the MIT license.
+All MurmurHash versions are public domain software, and the author disclaims all copyright to their code.
+
+_____
+
+gtest-ios-framework
+
+https://github.com/mestevens/gtest-ios-framework
+
+Copyright (c) 2013 Matthew Stevens
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+_____
+
+DLPack
+
+https://github.com/dmlc/dlpack
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2017 by Contributors
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+_____
+
+emsdk
+
+MIT/Expat license
+
+https://github.com/emscripten-core/emsdk
+
+Copyright (c) 2018 Emscripten authors (see AUTHORS in Emscripten)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+----------------------------------------------------------------------------
+
+This is the MIT/Expat License. For more information see:
+
+1. http://www.opensource.org/licenses/mit-license.php
+
+2. http://en.wikipedia.org/wiki/MIT_License
+
+_____
+
+coremltools
+
+BSD-3-Clause License
+
+https://github.com/apple/coremltools
+
+Copyright (c) 2020, Apple Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+© 2021 GitHub, Inc.
+
+_____
+
+react-native
+
+MIT License
+
+https://github.com/facebook/react-native
+
+Copyright (c) Facebook, Inc. and its affiliates.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+_____
+
+pytorch/cpuinfo
+
+BSD 2-Clause "Simplified" License
+
+https://github.com/pytorch/cpuinfo
+
+Copyright (c) 2019 Google LLC
+Copyright (c) 2017-2018 Facebook Inc.
+Copyright (C) 2012-2017 Georgia Institute of Technology
+Copyright (C) 2010-2012 Marat Dukhan
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+_____
+
+SQLite Is Public Domain
+
+All of the code and documentation in SQLite has been dedicated to the public
+domain by the authors. All code authors, and representatives of the companies
+they work for, have signed affidavits dedicating their contributions to the
+public domain and originals of those signed affidavits are stored in a firesafe
+at the main offices of Hwaci. Anyone is free to copy, modify, publish, use,
+compile, sell, or distribute the original SQLite code, either in source code
+form or as a compiled binary, for any purpose, commercial or non-commercial,
+and by any means.
+
+The previous paragraph applies to the deliverable code and documentation in
+SQLite - those parts of the SQLite library that you actually bundle and ship
+with a larger application. Some scripts used as part of the build process (for
+example the "configure" scripts generated by autoconf) might fall under other
+open-source licenses. Nothing from these build scripts ever reaches the final
+deliverable SQLite library, however, and so the licenses associated with those
+scripts should not be a factor in assessing your rights to copy and use the
+SQLite library.
+
+All of the deliverable code in SQLite has been written from scratch. No code
+has been taken from other projects or from the open internet. Every line of
+code can be traced back to its original author, and all of those authors have
+public domain dedications on file. So the SQLite code base is clean and is
+uncontaminated with licensed code from other projects.
+
+_____
+
+google/XNNPACK
+
+BSD License
+
+For XNNPACK software
+
+Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
+Copyright 2019 Google LLC
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name Facebook nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+_____
+
+google/sentencepiece, https://github.com/google/sentencepiece
+(included when statically linked with onnxruntime-extensions)
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+_____
+
+dlfcn-win32/dlfcn-win32 is licensed under the MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+_____
+
+The Python Imaging Library (PIL) is
+
+ Copyright © 1997-2011 by Secret Labs AB
+ Copyright © 1995-2011 by Fredrik Lundh
+
+Pillow is the friendly PIL fork. It is
+
+ Copyright © 2010-2023 by Alex Clark and contributors
+
+Like PIL, Pillow is licensed under the open source HPND License:
+
+By obtaining, using, and/or copying this software and/or its associated
+documentation, you agree that you have read, understood, and will comply
+with the following terms and conditions:
+
+Permission to use, copy, modify, and distribute this software and its
+associated documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appears in all copies, and that
+both that copyright notice and this permission notice appear in supporting
+documentation, and that the name of Secret Labs AB or the author not be
+used in advertising or publicity pertaining to distribution of the software
+without specific, written prior permission.
+
+SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
+IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR ANY SPECIAL,
+INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
+_____
+
+openssl/openssl, https://github.com/openssl/openssl
+
+ Apache License
+ Version 2.0, January 2004
+ https://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+_____
+
+Tencent/rapidjson, https://github.com/Tencent/rapidjson
+
+Tencent is pleased to support the open source community by making RapidJSON available.
+
+Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
+
+If you have downloaded a copy of the RapidJSON binary from Tencent, please note that the RapidJSON binary is licensed under the MIT License.
+If you have downloaded a copy of the RapidJSON source code from Tencent, please note that RapidJSON source code is licensed under the MIT License, except for the third-party components listed below which are subject to different license terms. Your integration of RapidJSON into your own projects may require compliance with the MIT License, as well as the other licenses applicable to the third-party components included within RapidJSON. To avoid the problematic JSON license in your own projects, it's sufficient to exclude the bin/jsonchecker/ directory, as it's the only code under the JSON license.
+A copy of the MIT License is included in this file.
+
+Other dependencies and licenses:
+
+Open Source Software Licensed Under the BSD License:
+--------------------------------------------------------------------
+
+The msinttypes r29
+Copyright (c) 2006-2013 Alexander Chemeris
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+* Neither the name of copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Open Source Software Licensed Under the JSON License:
+--------------------------------------------------------------------
+
+json.org
+Copyright (c) 2002 JSON.org
+All Rights Reserved.
+
+JSON_checker
+Copyright (c) 2002 JSON.org
+All Rights Reserved.
+
+
+Terms of the JSON License:
+---------------------------------------------------
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+The Software shall be used for Good, not Evil.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+Terms of the MIT License:
+--------------------------------------------------------------------
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+_____
+
+boostorg/boost, https://github.com/boostorg/boost
+
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
+_____
+
+libb64/libb64, https://github.com/libb64/libb64
+
+Copyright-Only Dedication (based on United States law) or Public Domain Certification
+
+The person or persons who have associated work with this document (the "Dedicator" or "Certifier") hereby either (a) certifies that, to the best of his knowledge, the work of authorship identified is in the public domain of the country from which the work is published, or (b) hereby dedicates whatever copyright the dedicators holds in the work of authorship identified below (the "Work") to the public domain. A certifier, moreover, dedicates any copyright interest he may have in the associated work, and for these purposes, is described as a "dedicator" below.
+
+A certifier has taken reasonable steps to verify the copyright status of this work. Certifier recognizes that his good faith efforts may not shield him from liability if in fact the work certified is not in the public domain.
+
+Dedicator makes this dedication for the benefit of the public at large and to the detriment of the Dedicator's heirs and successors. Dedicator intends this dedication to be an overt act of relinquishment in perpetuity of all present and future rights under copyright law, whether vested or contingent, in the Work. Dedicator understands that such relinquishment of all rights includes the relinquishment of all rights to enforce (by lawsuit or otherwise) those copyrights in the Work.
+
+Dedicator recognizes that, once placed in the public domain, the Work may be freely reproduced, distributed, transmitted, used, modified, built upon, or otherwise exploited by anyone for any purpose, commercial or non-commercial, and in any way, including by methods that have not yet been invented or conceived.
+
+_____
+
+posix pthread library, https://sourceforge.net/projects/pthreads4w
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+_____
+
+Triton Inference Server & Client, https://github.com/triton-inference-server
+
+Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of NVIDIA CORPORATION nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+_____
+
+microsoft/mimalloc, https://github.com/microsoft/mimalloc
+
+MIT License
+
+Copyright (c) 2018-2021 Microsoft Corporation, Daan Leijen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+_____
+
+TensorFlow.js
+
+https://github.com/tensorflow/tfjs
+
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+——
+
+curl/curl
+
+https://github.com/curl
+
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (C) Daniel Stenberg, <daniel@haxx.se>, and many
+contributors, see the THANKS file.
+
+All rights reserved.
+
+Permission to use, copy, modify, and distribute this software for any purpose
+with or without fee is hereby granted, provided that the above copyright
+notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
+NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
+OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization of the copyright holder.
+
+_____
+
+Intel neural-compressor
+
+https://github.com/intel/neural-compressor
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ ============================================================================
+
+ Copyright 2016-2019 Intel Corporation
+ Copyright 2018 YANDEX LLC
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ This distribution includes third party software ("third party programs").
+ This third party software, even if included with the distribution of
+ the Intel software, may be governed by separate license terms, including
+ without limitation, third party license terms, other Intel software license
+ terms, and open source software license terms. These separate license terms
+ govern your use of the third party programs as set forth in the
+ "THIRD-PARTY-PROGRAMS" file.
+
+_____
+
+FlashAttention, https://github.com/Dao-AILab/flash-attention
+
+BSD 3-Clause License
+
+Copyright (c) 2022, the respective contributors, as shown by the AUTHORS file.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+_____
+
+composable_kernel
+
+https://github.com/ROCmSoftwarePlatform/composable_kernel
+
+Copyright (c) 2018- , Advanced Micro Devices, Inc. (Chao Liu, Jing Zhang)
+Copyright (c) 2019- , Advanced Micro Devices, Inc. (Letao Qin, Qianfeng Zhang, Liang Huang, Shaojie Wang)
+Copyright (c) 2022- , Advanced Micro Devices, Inc. (Anthony Chang, Chunyu Lai, Illia Silin, Adam Osewski, Poyen Chen, Jehandad Khan)
+Copyright (c) 2019-2021, Advanced Micro Devices, Inc. (Hanwen Chang)
+Copyright (c) 2019-2020, Advanced Micro Devices, Inc. (Tejash Shah)
+Copyright (c) 2020 , Advanced Micro Devices, Inc. (Xiaoyan Zhou)
+Copyright (c) 2021-2022, Advanced Micro Devices, Inc. (Jianfeng Yan)
+
+SPDX-License-Identifier: MIT
+Copyright (c) 2018-2023, Advanced Micro Devices, Inc. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+_____
+
+neural-speed
+
+https://github.com/intel/neural-speed
+
+ Apache License
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ ============================================================================
+
+ Copyright 2016-2019 Intel Corporation
+ Copyright 2018 YANDEX LLC
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ This distribution includes third party software ("third party programs").
+ This third party software, even if included with the distribution of
+ the Intel software, may be governed by separate license terms, including
+ without limitation, third party license terms, other Intel software license
+ terms, and open source software license terms. These separate license terms
+ govern your use of the third party programs as set forth in the
+ "THIRD-PARTY-PROGRAMS" file.
+
+_____
+
+dawn
+
+https://dawn.googlesource.com/dawn
+
+ BSD 3-Clause License
+
+ Copyright 2017-2023 The Dawn & Tint Authors
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ 3. Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/third_party/onnxruntime/include/onnxruntime_c_api.h b/third_party/onnxruntime/include/onnxruntime_c_api.h
new file mode 100644
index 0000000..b2f3d95
--- /dev/null
+++ b/third_party/onnxruntime/include/onnxruntime_c_api.h
@@ -0,0 +1,4952 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+// See docs\c_cxx\README.md on generating the Doxygen documentation from this file
+
+/** \mainpage ONNX Runtime
+ *
+ * ONNX Runtime is a high-performance inference and training graph execution engine for deep learning models.
+ *
+ * ONNX Runtime's C, C++ APIs offer an easy to use interface to onboard and execute onnx models.
+ * - \subpage c_cpp_api "Core C, C++ APIs"
+ * - \subpage training_c_cpp_api "Training C, C++ APIs for on-device training"
+ *
+ * \page c_cpp_api Core C, C++ APIs
+ * <h1>C</h1>
+ *
+ * ::OrtApi - Click here to go to the structure with all C API functions.
+ *
+ * <h1>C++</h1>
+ *
+ * ::Ort - Click here to go to the namespace holding all of the C++ wrapper classes
+ *
+ * It is a set of header only wrapper classes around the C API. The goal is to turn the C style return value error codes into C++ exceptions, and to
+ * automate memory management through standard C++ RAII principles.
+ *
+ * \addtogroup Global
+ * ONNX Runtime C API
+ * @{
+ */
+
+#pragma once
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+/** \brief The API version defined in this header
+ *
+ * This value is used by some API functions to behave as this version of the header expects.
+ */
+#define ORT_API_VERSION 21
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//! @}
+// SAL2 Definitions
+#ifndef _MSC_VER
+#define _In_
+#define _In_z_
+#define _In_opt_
+#define _In_opt_z_
+#define _Out_
+#define _Outptr_
+#define _Out_opt_
+#define _Inout_
+#define _Inout_opt_
+#define _Frees_ptr_opt_
+#define _Ret_maybenull_
+#define _Ret_notnull_
+#define _Check_return_
+#define _Outptr_result_maybenull_
+#define _In_reads_(X)
+#define _Inout_updates_(X)
+#define _Out_writes_(X)
+#define _Inout_updates_all_(X)
+#define _Out_writes_bytes_all_(X)
+#define _Out_writes_all_(X)
+#define _Success_(X)
+#define _Outptr_result_buffer_maybenull_(X)
+#define ORT_ALL_ARGS_NONNULL __attribute__((nonnull))
+#else
+#include <specstrings.h>
+#define ORT_ALL_ARGS_NONNULL
+#endif
+
+#ifdef _WIN32
+// Define ORT_DLL_IMPORT if your program is dynamically linked to Ort.
+// dllexport is not used, we use a .def file.
+#ifdef ORT_DLL_IMPORT
+#define ORT_EXPORT __declspec(dllimport)
+#else
+#define ORT_EXPORT
+#endif
+#define ORT_API_CALL _stdcall
+#define ORT_MUST_USE_RESULT
+#define ORTCHAR_T wchar_t
+#else
+// To make symbols visible on macOS/iOS
+#ifdef __APPLE__
+#define ORT_EXPORT __attribute__((visibility("default")))
+#else
+#define ORT_EXPORT
+#endif
+#define ORT_API_CALL
+#define ORT_MUST_USE_RESULT __attribute__((warn_unused_result))
+#define ORTCHAR_T char
+#endif
+
+/// ORTCHAR_T, ORT_TSTR are reserved specifically for path handling.
+/// All other strings are UTF-8 encoded, use char and std::string
+#ifndef ORT_TSTR
+#ifdef _WIN32
+#define ORT_TSTR(X) L##X
+// When X is a macro, L##X is not defined. In this case, we need to use ORT_TSTR_ON_MACRO.
+#define ORT_TSTR_ON_MACRO(X) L"" X
+#else
+#define ORT_TSTR(X) X
+#define ORT_TSTR_ON_MACRO(X) X
+#endif
+#endif
+
+// On Windows, ORT_FILE is a wchar_t version of the __FILE__ macro.
+// Otherwise, ORT_FILE is equivalent to __FILE__.
+#ifndef ORT_FILE
+#define ORT_FILE_INTERNAL(x) ORT_TSTR(x)
+#define ORT_FILE ORT_FILE_INTERNAL(__FILE__)
+#endif
+
+// Any pointer marked with _In_ or _Out_, cannot be NULL.
+
+// Windows users should use unicode paths when possible to bypass the MAX_PATH limitation
+// Every pointer marked with _In_ or _Out_, cannot be NULL. Caller should ensure that.
+// for ReleaseXXX(...) functions, they can accept NULL pointer.
+
+#ifdef __cplusplus
+// For any compiler with C++11 support, MSVC 2015 and greater, or Clang version supporting noexcept.
+// Such complex condition is needed because compilers set __cplusplus value differently.
+#ifndef __has_feature
+#define __has_feature(x) 0
+#endif
+#if ((__cplusplus >= 201103L) || (_MSC_VER >= 1900) || (defined(__has_feature) && __has_feature(cxx_noexcept)))
+#define NO_EXCEPTION noexcept
+#else
+#define NO_EXCEPTION throw()
+#endif
+#else
+#define NO_EXCEPTION
+#endif
+
+// __VA_ARGS__ on Windows and Linux are different
+#define ORT_API(RETURN_TYPE, NAME, ...) RETURN_TYPE ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
+
+#define ORT_API_STATUS(NAME, ...) \
+ _Success_(return == 0) _Check_return_ _Ret_maybenull_ OrtStatusPtr ORT_API_CALL NAME(__VA_ARGS__) \
+ NO_EXCEPTION ORT_MUST_USE_RESULT
+
+// XXX: Unfortunately, SAL annotations are known to not work with function pointers
+#define ORT_API2_STATUS(NAME, ...) \
+ _Check_return_ _Ret_maybenull_ OrtStatusPtr(ORT_API_CALL* NAME)(__VA_ARGS__) NO_EXCEPTION ORT_MUST_USE_RESULT
+
+// Used in *.cc files. Almost as same as ORT_API_STATUS, except without ORT_MUST_USE_RESULT and ORT_EXPORT
+#define ORT_API_STATUS_IMPL(NAME, ...) \
+ _Success_(return == 0) _Check_return_ _Ret_maybenull_ OrtStatusPtr ORT_API_CALL NAME(__VA_ARGS__) NO_EXCEPTION
+
+#define ORT_CLASS_RELEASE(X) void(ORT_API_CALL * Release##X)(_Frees_ptr_opt_ Ort##X * input)
+
+#ifdef __DOXYGEN__
+#undef ORT_API_STATUS
+#define ORT_API_STATUS(NAME, ...) OrtStatus* NAME(__VA_ARGS__)
+#undef ORT_API2_STATUS
+#define ORT_API2_STATUS(NAME, ...) OrtStatus* NAME(__VA_ARGS__)
+#undef ORT_CLASS_RELEASE
+#define ORT_CLASS_RELEASE(X) void Release##X(Ort##X* input)
+#undef NO_EXCEPTION
+#define NO_EXCEPTION
+#endif
+/** \addtogroup Global
+ * ONNX Runtime C API
+ * @{
+ */
+
+/** Copied from TensorProto::DataType
+ * Currently, Ort doesn't support complex64, complex128
+ */
+typedef enum ONNXTensorElementDataType {
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_UNDEFINED,
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT, // maps to c type float
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT8, // maps to c type uint8_t
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT8, // maps to c type int8_t
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT16, // maps to c type uint16_t
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT16, // maps to c type int16_t
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32, // maps to c type int32_t
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64, // maps to c type int64_t
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING, // maps to c++ type std::string
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_BOOL,
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT16,
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_DOUBLE, // maps to c type double
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT32, // maps to c type uint32_t
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT64, // maps to c type uint64_t
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX64, // complex with float32 real and imaginary components
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_COMPLEX128, // complex with float64 real and imaginary components
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_BFLOAT16, // Non-IEEE floating-point format based on IEEE754 single-precision
+ // float 8 types were introduced in onnx 1.14, see https://onnx.ai/onnx/technical/float8.html
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FN, // Non-IEEE floating-point format based on IEEE754 single-precision
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E4M3FNUZ, // Non-IEEE floating-point format based on IEEE754 single-precision
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2, // Non-IEEE floating-point format based on IEEE754 single-precision
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT8E5M2FNUZ, // Non-IEEE floating-point format based on IEEE754 single-precision
+ // Int4 types were introduced in ONNX 1.16. See https://onnx.ai/onnx/technical/int4.html
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_UINT4, // maps to a pair of packed uint4 values (size == 1 byte)
+ ONNX_TENSOR_ELEMENT_DATA_TYPE_INT4 // maps to a pair of packed int4 values (size == 1 byte)
+} ONNXTensorElementDataType;
+
+// Synced with onnx TypeProto oneof
+typedef enum ONNXType {
+ ONNX_TYPE_UNKNOWN,
+ ONNX_TYPE_TENSOR,
+ ONNX_TYPE_SEQUENCE,
+ ONNX_TYPE_MAP,
+ ONNX_TYPE_OPAQUE,
+ ONNX_TYPE_SPARSETENSOR,
+ ONNX_TYPE_OPTIONAL
+} ONNXType;
+
+// These types are synced with internal
+// SparseFormatFlags
+typedef enum OrtSparseFormat {
+ ORT_SPARSE_UNDEFINED = 0,
+ ORT_SPARSE_COO = 0x1,
+ ORT_SPARSE_CSRC = 0x2,
+ ORT_SPARSE_BLOCK_SPARSE = 0x4
+} OrtSparseFormat;
+
+// Enum allows to query sparse tensor indices
+enum OrtSparseIndicesFormat {
+ ORT_SPARSE_COO_INDICES,
+ ORT_SPARSE_CSR_INNER_INDICES,
+ ORT_SPARSE_CSR_OUTER_INDICES,
+ ORT_SPARSE_BLOCK_SPARSE_INDICES
+};
+
+/** \brief Logging severity levels
+ *
+ * In typical API usage, specifying a logging severity level specifies the minimum severity of log messages to show.
+ */
+typedef enum OrtLoggingLevel {
+ ORT_LOGGING_LEVEL_VERBOSE, ///< Verbose informational messages (least severe).
+ ORT_LOGGING_LEVEL_INFO, ///< Informational messages.
+ ORT_LOGGING_LEVEL_WARNING, ///< Warning messages.
+ ORT_LOGGING_LEVEL_ERROR, ///< Error messages.
+ ORT_LOGGING_LEVEL_FATAL, ///< Fatal error messages (most severe).
+} OrtLoggingLevel;
+
+typedef enum OrtErrorCode {
+ ORT_OK,
+ ORT_FAIL,
+ ORT_INVALID_ARGUMENT,
+ ORT_NO_SUCHFILE,
+ ORT_NO_MODEL,
+ ORT_ENGINE_ERROR,
+ ORT_RUNTIME_EXCEPTION,
+ ORT_INVALID_PROTOBUF,
+ ORT_MODEL_LOADED,
+ ORT_NOT_IMPLEMENTED,
+ ORT_INVALID_GRAPH,
+ ORT_EP_FAIL,
+} OrtErrorCode;
+
+typedef enum OrtOpAttrType {
+ ORT_OP_ATTR_UNDEFINED = 0,
+ ORT_OP_ATTR_INT,
+ ORT_OP_ATTR_INTS,
+ ORT_OP_ATTR_FLOAT,
+ ORT_OP_ATTR_FLOATS,
+ ORT_OP_ATTR_STRING,
+ ORT_OP_ATTR_STRINGS,
+} OrtOpAttrType;
+
+//! @}
+#define ORT_RUNTIME_CLASS(X) \
+ struct Ort##X; \
+ typedef struct Ort##X Ort##X
+
+/** \addtogroup Global
+ * ONNX Runtime C API
+ * @{
+ */
+// The actual types defined have an Ort prefix
+ORT_RUNTIME_CLASS(Env);
+ORT_RUNTIME_CLASS(Status); // nullptr for Status* indicates success
+ORT_RUNTIME_CLASS(MemoryInfo);
+ORT_RUNTIME_CLASS(IoBinding);
+ORT_RUNTIME_CLASS(Session); // Don't call ReleaseSession from Dllmain (because session owns a thread pool)
+ORT_RUNTIME_CLASS(Value);
+ORT_RUNTIME_CLASS(RunOptions);
+ORT_RUNTIME_CLASS(TypeInfo);
+ORT_RUNTIME_CLASS(TensorTypeAndShapeInfo);
+ORT_RUNTIME_CLASS(MapTypeInfo);
+ORT_RUNTIME_CLASS(SequenceTypeInfo);
+ORT_RUNTIME_CLASS(OptionalTypeInfo);
+ORT_RUNTIME_CLASS(SessionOptions);
+ORT_RUNTIME_CLASS(CustomOpDomain);
+ORT_RUNTIME_CLASS(ModelMetadata);
+ORT_RUNTIME_CLASS(ThreadPoolParams);
+ORT_RUNTIME_CLASS(ThreadingOptions);
+ORT_RUNTIME_CLASS(ArenaCfg);
+ORT_RUNTIME_CLASS(PrepackedWeightsContainer);
+ORT_RUNTIME_CLASS(TensorRTProviderOptionsV2);
+ORT_RUNTIME_CLASS(CUDAProviderOptionsV2);
+ORT_RUNTIME_CLASS(CANNProviderOptions);
+ORT_RUNTIME_CLASS(DnnlProviderOptions);
+ORT_RUNTIME_CLASS(Op);
+ORT_RUNTIME_CLASS(OpAttr);
+ORT_RUNTIME_CLASS(Logger);
+ORT_RUNTIME_CLASS(ShapeInferContext);
+ORT_RUNTIME_CLASS(LoraAdapter);
+
+#ifdef _WIN32
+typedef _Return_type_success_(return == 0) OrtStatus* OrtStatusPtr;
+#else
+typedef OrtStatus* OrtStatusPtr;
+#endif
+
+/** \brief Memory allocation interface
+ *
+ * Structure of function pointers that defines a memory allocator. This can be created and filled in by the user for custom allocators.
+ *
+ * When an allocator is passed to any function, be sure that the allocator object is not destroyed until the last allocated object using it is freed.
+ */
+typedef struct OrtAllocator {
+ uint32_t version; ///< Must be initialized to ORT_API_VERSION
+ void*(ORT_API_CALL* Alloc)(struct OrtAllocator* this_, size_t size); ///< Returns a pointer to an allocated block of `size` bytes
+ void(ORT_API_CALL* Free)(struct OrtAllocator* this_, void* p); ///< Free a block of memory previously allocated with OrtAllocator::Alloc
+ const struct OrtMemoryInfo*(ORT_API_CALL* Info)(const struct OrtAllocator* this_); ///< Return a pointer to an ::OrtMemoryInfo that describes this allocator
+ /**
+ * @brief Optional allocation function to use for memory allocations made during session initialization.
+ * Use this function if you want to separate allocations made by ORT during Run() calls from
+ * those made during session initialization. This allows for separate memory management strategies for these allocations.
+ */
+ void*(ORT_API_CALL* Reserve)(struct OrtAllocator* this_, size_t size); ///< Returns a pointer to an allocated block of `size` bytes
+} OrtAllocator;
+
+typedef void(ORT_API_CALL* OrtLoggingFunction)(
+ void* param, OrtLoggingLevel severity, const char* category, const char* logid, const char* code_location,
+ const char* message);
+
+/** \brief Graph optimization level
+ *
+ * Refer to https://www.onnxruntime.ai/docs/performance/graph-optimizations.html#graph-optimization-levels
+ * for an in-depth understanding of the Graph Optimization Levels.
+ */
+typedef enum GraphOptimizationLevel {
+ ORT_DISABLE_ALL = 0,
+ ORT_ENABLE_BASIC = 1,
+ ORT_ENABLE_EXTENDED = 2,
+ ORT_ENABLE_ALL = 99
+} GraphOptimizationLevel;
+
+typedef enum ExecutionMode {
+ ORT_SEQUENTIAL = 0,
+ ORT_PARALLEL = 1,
+} ExecutionMode;
+
+/** \brief Language projection identifiers
+ * /see OrtApi::SetLanguageProjection
+ */
+typedef enum OrtLanguageProjection {
+ ORT_PROJECTION_C = 0,
+ ORT_PROJECTION_CPLUSPLUS = 1,
+ ORT_PROJECTION_CSHARP = 2,
+ ORT_PROJECTION_PYTHON = 3,
+ ORT_PROJECTION_JAVA = 4,
+ ORT_PROJECTION_WINML = 5,
+ ORT_PROJECTION_NODEJS = 6,
+} OrtLanguageProjection;
+
+struct OrtKernelInfo;
+typedef struct OrtKernelInfo OrtKernelInfo;
+struct OrtKernelContext;
+typedef struct OrtKernelContext OrtKernelContext;
+struct OrtCustomOp;
+typedef struct OrtCustomOp OrtCustomOp;
+
+typedef enum OrtAllocatorType {
+ OrtInvalidAllocator = -1,
+ OrtDeviceAllocator = 0,
+ OrtArenaAllocator = 1
+} OrtAllocatorType;
+
+/** \brief Memory types for allocated memory, execution provider specific types should be extended in each provider.
+ */
+// Whenever this struct is updated, please also update the MakeKey function in onnxruntime / core / framework / execution_provider.cc
+typedef enum OrtMemType {
+ OrtMemTypeCPUInput = -2, ///< Any CPU memory used by non-CPU execution provider
+ OrtMemTypeCPUOutput = -1, ///< CPU accessible memory outputted by non-CPU execution provider, i.e. CUDA_PINNED
+ OrtMemTypeCPU = OrtMemTypeCPUOutput, ///< Temporary CPU accessible memory allocated by non-CPU execution provider, i.e. CUDA_PINNED
+ OrtMemTypeDefault = 0, ///< The default allocator for execution provider
+} OrtMemType;
+
+/** \brief This mimics OrtDevice type constants so they can be returned in the API
+ */
+typedef enum OrtMemoryInfoDeviceType {
+ OrtMemoryInfoDeviceType_CPU = 0,
+ OrtMemoryInfoDeviceType_GPU = 1,
+ OrtMemoryInfoDeviceType_FPGA = 2
+} OrtMemoryInfoDeviceType;
+
+/** \brief Algorithm to use for cuDNN Convolution Op
+ */
+typedef enum OrtCudnnConvAlgoSearch {
+ OrtCudnnConvAlgoSearchExhaustive, // expensive exhaustive benchmarking using cudnnFindConvolutionForwardAlgorithmEx
+ OrtCudnnConvAlgoSearchHeuristic, // lightweight heuristic based search using cudnnGetConvolutionForwardAlgorithm_v7
+ OrtCudnnConvAlgoSearchDefault, // default algorithm using CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM
+} OrtCudnnConvAlgoSearch;
+
+/** \brief CUDA Provider Options
+ *
+ * \see OrtApi::SessionOptionsAppendExecutionProvider_CUDA
+ */
+typedef struct OrtCUDAProviderOptions {
+#ifdef __cplusplus
+ OrtCUDAProviderOptions()
+ : device_id{},
+ cudnn_conv_algo_search{OrtCudnnConvAlgoSearchExhaustive},
+ gpu_mem_limit{SIZE_MAX},
+ arena_extend_strategy{},
+ do_copy_in_default_stream{1},
+ has_user_compute_stream{},
+ user_compute_stream{},
+ default_memory_arena_cfg{},
+ tunable_op_enable{false},
+ tunable_op_tuning_enable{false},
+ tunable_op_max_tuning_duration_ms{} {}
+#endif
+
+ /** \brief CUDA device Id
+ * Defaults to 0.
+ */
+ int device_id;
+
+ /** \brief CUDA Convolution algorithm search configuration.
+ * See enum OrtCudnnConvAlgoSearch for more details.
+ * Defaults to OrtCudnnConvAlgoSearchExhaustive.
+ */
+ OrtCudnnConvAlgoSearch cudnn_conv_algo_search;
+
+ /** \brief CUDA memory limit (To use all possible memory pass in maximum size_t)
+ * Defaults to SIZE_MAX.
+ * \note If a ::OrtArenaCfg has been applied, it will override this field
+ */
+ size_t gpu_mem_limit;
+
+ /** \brief Strategy used to grow the memory arena
+ * 0 = kNextPowerOfTwo<br>
+ * 1 = kSameAsRequested<br>
+ * Defaults to 0.
+ * \note If a ::OrtArenaCfg has been applied, it will override this field
+ */
+ int arena_extend_strategy;
+
+ /** \brief Flag indicating if copying needs to take place on the same stream as the compute stream in the CUDA EP
+ * 0 = Use separate streams for copying and compute.
+ * 1 = Use the same stream for copying and compute.
+ * Defaults to 1.
+ * WARNING: Setting this to 0 may result in data races for some models.
+ * Please see issue #4829 for more details.
+ */
+ int do_copy_in_default_stream;
+
+ /** \brief Flag indicating if there is a user provided compute stream
+ * Defaults to 0.
+ */
+ int has_user_compute_stream;
+
+ /** \brief User provided compute stream.
+ * If provided, please set `has_user_compute_stream` to 1.
+ */
+ void* user_compute_stream;
+
+ /** \brief CUDA memory arena configuration parameters
+ */
+ OrtArenaCfg* default_memory_arena_cfg;
+
+ /** \brief Enable TunableOp for using.
+ * Set it to 1/0 to enable/disable TunableOp. Otherwise, it is disabled by default.
+ * This option can be overridden by environment variable ORT_CUDA_TUNABLE_OP_ENABLE.
+ */
+ int tunable_op_enable;
+
+ /** \brief Enable TunableOp for tuning.
+ * Set it to 1/0 to enable/disable TunableOp tuning. Otherwise, it is disabled by default.
+ * This option can be overridden by environment variable ORT_CUDA_TUNABLE_OP_TUNING_ENABLE.
+ */
+ int tunable_op_tuning_enable;
+
+ /** \brief Max tuning duration time limit for each instance of TunableOp.
+ * Defaults to 0 to disable the limit.
+ */
+ int tunable_op_max_tuning_duration_ms;
+
+} OrtCUDAProviderOptions;
+
+/** \brief ROCM Provider Options
+ *
+ * \see OrtApi::SessionOptionsAppendExecutionProvider_ROCM
+ */
+typedef struct OrtROCMProviderOptions {
+#ifdef __cplusplus
+ OrtROCMProviderOptions()
+ : device_id{},
+ miopen_conv_exhaustive_search{0},
+ gpu_mem_limit{SIZE_MAX},
+ arena_extend_strategy{},
+ do_copy_in_default_stream{1},
+ has_user_compute_stream{},
+ user_compute_stream{},
+ default_memory_arena_cfg{},
+ enable_hip_graph{false},
+ tunable_op_enable{false},
+ tunable_op_tuning_enable{false},
+ tunable_op_max_tuning_duration_ms{} {}
+#endif
+
+ /** \brief ROCM device Id
+ * Defaults to 0.
+ */
+ int device_id;
+
+ /** \brief ROCM MIOpen Convolution algorithm exaustive search option.
+ * Defaults to 0 (false).
+ */
+ int miopen_conv_exhaustive_search;
+
+ /** \brief ROCM memory limit (To use all possible memory pass in maximum size_t)
+ * Defaults to SIZE_MAX.
+ * \note If a ::OrtArenaCfg has been applied, it will override this field
+ */
+ size_t gpu_mem_limit;
+
+ /** \brief Strategy used to grow the memory arena
+ * 0 = kNextPowerOfTwo<br>
+ * 1 = kSameAsRequested<br>
+ * Defaults to 0.
+ * \note If a ::OrtArenaCfg has been applied, it will override this field
+ */
+ int arena_extend_strategy;
+
+ /** \brief Flag indicating if copying needs to take place on the same stream as the compute stream in the ROCM EP
+ * 0 = Use separate streams for copying and compute.
+ * 1 = Use the same stream for copying and compute.
+ * Defaults to 1.
+ * WARNING: Setting this to 0 may result in data races for some models.
+ * Please see issue #4829 for more details.
+ */
+ int do_copy_in_default_stream;
+
+ /** \brief Flag indicating if there is a user provided compute stream
+ * Defaults to 0.
+ */
+ int has_user_compute_stream;
+
+ /** \brief User provided compute stream.
+ * If provided, please set `has_user_compute_stream` to 1.
+ */
+ void* user_compute_stream;
+
+ /** \brief ROCM memory arena configuration parameters
+ */
+ OrtArenaCfg* default_memory_arena_cfg;
+
+ int enable_hip_graph;
+
+ /** \brief Enable TunableOp for using.
+ * Set it to 1/0 to enable/disable TunableOp. Otherwise, it is disabled by default.
+ * This option can be overridden by environment variable ORT_ROCM_TUNABLE_OP_ENABLE.
+ */
+ int tunable_op_enable;
+
+ /** \brief Enable TunableOp for tuning.
+ * Set it to 1/0 to enable/disable TunableOp tuning. Otherwise, it is disabled by default.
+ * This option can be overridden by environment variable ORT_ROCM_TUNABLE_OP_TUNING_ENABLE.
+ */
+ int tunable_op_tuning_enable;
+
+ /** \brief Max tuning duration time limit for each instance of TunableOp.
+ * Defaults to 0 to disable the limit.
+ */
+ int tunable_op_max_tuning_duration_ms;
+
+} OrtROCMProviderOptions;
+
+/** \brief TensorRT Provider Options
+ *
+ * \see OrtApi::SessionOptionsAppendExecutionProvider_TensorRT
+ */
+typedef struct OrtTensorRTProviderOptions {
+ int device_id; ///< CUDA device id (0 = default device)
+ int has_user_compute_stream; // indicator of user specified CUDA compute stream.
+ void* user_compute_stream; // user specified CUDA compute stream.
+ int trt_max_partition_iterations; // maximum iterations for TensorRT parser to get capability
+ int trt_min_subgraph_size; // minimum size of TensorRT subgraphs
+ size_t trt_max_workspace_size; // maximum workspace size for TensorRT.
+ int trt_fp16_enable; // enable TensorRT FP16 precision. Default 0 = false, nonzero = true
+ int trt_int8_enable; // enable TensorRT INT8 precision. Default 0 = false, nonzero = true
+ const char* trt_int8_calibration_table_name; // TensorRT INT8 calibration table name.
+ int trt_int8_use_native_calibration_table; // use native TensorRT generated calibration table. Default 0 = false, nonzero = true
+ int trt_dla_enable; // enable DLA. Default 0 = false, nonzero = true
+ int trt_dla_core; // DLA core number. Default 0
+ int trt_dump_subgraphs; // dump TRT subgraph. Default 0 = false, nonzero = true
+ int trt_engine_cache_enable; // enable engine caching. Default 0 = false, nonzero = true
+ const char* trt_engine_cache_path; // specify engine cache path
+ int trt_engine_decryption_enable; // enable engine decryption. Default 0 = false, nonzero = true
+ const char* trt_engine_decryption_lib_path; // specify engine decryption library path
+ int trt_force_sequential_engine_build; // force building TensorRT engine sequentially. Default 0 = false, nonzero = true
+ // This is the legacy struct and don't add new fields here.
+ // For new field that can be represented by string, please add it in include/onnxruntime/core/providers/tensorrt/tensorrt_provider_options.h
+ // For non-string field, need to create a new separate api to handle it.
+} OrtTensorRTProviderOptions;
+
+/** \brief MIGraphX Provider Options
+ *
+ * \see OrtApi::SessionOptionsAppendExecutionProvider_MIGraphX
+ */
+typedef struct OrtMIGraphXProviderOptions {
+ int device_id; // hip device id.
+ int migraphx_fp16_enable; // MIGraphX FP16 precision. Default 0 = false, nonzero = true
+ int migraphx_int8_enable; // MIGraphX INT8 precision. Default 0 = false, nonzero = true
+ int migraphx_use_native_calibration_table; // MIGraphx INT8 cal table. Default 0 = false, noznero = true
+ const char* migraphx_int8_calibration_table_name; // MIGraphx INT8 calibration table name
+ int migraphx_save_compiled_model; // migraphx save compiled model. Default 0 = false, noznero = true
+ const char* migraphx_save_model_path; // migraphx model path name
+ int migraphx_load_compiled_model; // migraphx int8 cal table. Default 0 = false, noznero = true
+ const char* migraphx_load_model_path; // migraphx model path name
+ bool migraphx_exhaustive_tune; // migraphx tuned compile Default = false
+} OrtMIGraphXProviderOptions;
+
+/** \brief OpenVINO Provider Options
+ * \brief This Struct is frozen since ORT 1.13.0. Its maintained part of Legacy API for compatibility.
+ * \brief For latest OpenVINO Provider Options update to the ProviderOptions map.
+ * \brief Latest OpenVINO Provider Options are listed in the
+ * \htmlonly
+ * <a href="https://onnxruntime.ai/docs/execution-providers/OpenVINO-ExecutionProvider.html#summary-of-options">onnxruntime document.</a>
+ * \endhtmlonly
+ * \see OrtApi::SessionOptionsAppendExecutionProvider()
+ */
+typedef struct OrtOpenVINOProviderOptions {
+#ifdef __cplusplus
+ OrtOpenVINOProviderOptions() : device_type{},
+ enable_npu_fast_compile{},
+ device_id{},
+ num_of_threads{},
+ cache_dir{},
+ context{},
+ enable_opencl_throttling{},
+ enable_dynamic_shapes{} {}
+#endif
+ /** \brief Device type string
+ *
+ * Valid settings are one of: "CPU_FP32", "CPU_FP16", "GPU_FP32", "GPU_FP16"
+ */
+ const char* device_type;
+ unsigned char enable_npu_fast_compile; ///< 0 = disabled, nonzero = enabled
+ const char* device_id;
+ size_t num_of_threads; ///< 0 = Use default number of threads
+ const char* cache_dir; // path is set to empty by default
+ void* context;
+ unsigned char enable_opencl_throttling; ///< 0 = disabled, nonzero = enabled
+ unsigned char enable_dynamic_shapes; ///< 0 = disabled, nonzero = enabled
+} OrtOpenVINOProviderOptions;
+
+struct OrtApi;
+typedef struct OrtApi OrtApi;
+
+struct OrtTrainingApi;
+typedef struct OrtTrainingApi OrtTrainingApi;
+
+/** \brief The helper interface to get the right version of OrtApi
+ *
+ * Get a pointer to this structure through ::OrtGetApiBase
+ */
+struct OrtApiBase {
+ /** \brief Get a pointer to the requested version of the ::OrtApi
+ *
+ * \param[in] version Must be ::ORT_API_VERSION
+ * \return The ::OrtApi for the version requested, nullptr will be returned if this version is unsupported, for example when using a runtime
+ * older than the version created with this header file.
+ *
+ * One can call GetVersionString() to get the version of the Onnxruntime library for logging
+ * and error reporting purposes.
+ */
+ const OrtApi*(ORT_API_CALL* GetApi)(uint32_t version)NO_EXCEPTION;
+
+ /** \brief Returns a null terminated string of the version of the Onnxruntime library (eg: "1.8.1")
+ *
+ * \return UTF-8 encoded version string. Do not deallocate the returned buffer.
+ */
+ const char*(ORT_API_CALL* GetVersionString)(void)NO_EXCEPTION;
+};
+
+typedef struct OrtApiBase OrtApiBase;
+
+/** \brief The Onnxruntime library's entry point to access the C API
+ *
+ * Call this to get the a pointer to an ::OrtApiBase
+ */
+ORT_EXPORT const OrtApiBase* ORT_API_CALL OrtGetApiBase(void) NO_EXCEPTION;
+
+/** \brief Thread work loop function
+ *
+ * Onnxruntime will provide the working loop on custom thread creation
+ * Argument is an onnxruntime built-in type which will be provided when thread pool calls OrtCustomCreateThreadFn
+ */
+typedef void (*OrtThreadWorkerFn)(void* ort_worker_fn_param);
+
+typedef const struct OrtCustomHandleType {
+ char __place_holder;
+}* OrtCustomThreadHandle;
+
+/** \brief Ort custom thread creation function
+ *
+ * The function should return a thread handle to be used in onnxruntime thread pools
+ * Onnxruntime will throw exception on return value of nullptr or 0, indicating that the function failed to create a thread
+ */
+typedef OrtCustomThreadHandle (*OrtCustomCreateThreadFn)(void* ort_custom_thread_creation_options, OrtThreadWorkerFn ort_thread_worker_fn, void* ort_worker_fn_param);
+
+/** \brief Custom thread join function
+ *
+ * Onnxruntime thread pool destructor will call the function to join a custom thread.
+ * Argument ort_custom_thread_handle is the value returned by OrtCustomCreateThreadFn
+ */
+typedef void (*OrtCustomJoinThreadFn)(OrtCustomThreadHandle ort_custom_thread_handle);
+
+typedef OrtStatus*(ORT_API_CALL* RegisterCustomOpsFn)(OrtSessionOptions* options, const OrtApiBase* api);
+
+/** \brief Callback function for RunAsync
+ *
+ * \param[in] user_data User specific data that passed back to the callback
+ * \param[out] outputs On succeed, outputs host inference results, on error, the value will be nullptr
+ * \param[out] num_outputs Number of outputs, on error, the value will be zero
+ * \param[out] status On error, status will provide details
+ */
+typedef void (*RunAsyncCallbackFn)(void* user_data, OrtValue** outputs, size_t num_outputs, OrtStatusPtr status);
+
+/** \brief The C API
+ *
+ * All C API functions are defined inside this structure as pointers to functions.
+ * Call OrtApiBase::GetApi to get a pointer to it
+ *
+ * \nosubgrouping
+ */
+struct OrtApi {
+ /// \name OrtStatus
+ /// @{
+
+ /**
+ * \brief Create an OrtStatus from a null terminated string
+ *
+ * \param[in] code
+ * \param[in] msg A null-terminated string. Its contents will be copied.
+ * \return A new OrtStatus object, must be destroyed with OrtApi::ReleaseStatus
+ */
+ OrtStatus*(ORT_API_CALL* CreateStatus)(OrtErrorCode code, _In_ const char* msg)NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
+
+ /** \brief Get OrtErrorCode from OrtStatus
+ *
+ * \param[in] status
+ * \return OrtErrorCode that \p status was created with
+ */
+ OrtErrorCode(ORT_API_CALL* GetErrorCode)(_In_ const OrtStatus* status) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
+
+ /** \brief Get error string from OrtStatus
+ *
+ * \param[in] status
+ * \return The error message inside the `status`. Do not free the returned value.
+ */
+ const char*(ORT_API_CALL* GetErrorMessage)(_In_ const OrtStatus* status)NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
+
+ /// @}
+ /// \name OrtEnv
+ /// @{
+
+ /** \brief Create an OrtEnv
+ *
+ * \note Invoking this function will return the same instance of the environment as that returned by a previous call
+ * to another env creation function; all arguments to this function will be ignored.
+ * \param[in] log_severity_level The log severity level.
+ * \param[in] logid The log identifier.
+ * \param[out] out Returned newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateEnv, OrtLoggingLevel log_severity_level, _In_ const char* logid, _Outptr_ OrtEnv** out);
+
+ /** \brief Create an OrtEnv
+ *
+ * \note Invoking this function will return the same instance of the environment as that returned by a previous call
+ * to another env creation function; all arguments to this function will be ignored. If you want to provide your
+ * own logging function, consider setting it using the SetUserLoggingFunction API instead.
+ * \param[in] logging_function A pointer to a logging function.
+ * \param[in] logger_param A pointer to arbitrary data passed as the ::OrtLoggingFunction `param` parameter to
+ * `logging_function`. This parameter is optional.
+ * \param[in] log_severity_level The log severity level.
+ * \param[in] logid The log identifier.
+ * \param[out] out Returned newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateEnvWithCustomLogger, _In_ OrtLoggingFunction logging_function, _In_opt_ void* logger_param,
+ _In_ OrtLoggingLevel log_severity_level, _In_ const char* logid, _Outptr_ OrtEnv** out);
+
+ /** \brief Enable Telemetry
+ *
+ * \note Telemetry events are on by default since they are lightweight
+ * \param[in] env
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(EnableTelemetryEvents, _In_ const OrtEnv* env);
+ /** \brief Disable Telemetry
+ *
+ * \see OrtApi::EnableTelemetryEvents
+ * \param[in] env
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(DisableTelemetryEvents, _In_ const OrtEnv* env);
+
+ /// @}
+ /// \name OrtSession
+ /// @{
+
+ /** \brief Create an OrtSession from a model file
+ *
+ * \param[in] env
+ * \param[in] model_path
+ * \param[in] options
+ * \param[out] out Returned newly created OrtSession. Must be freed with OrtApi::ReleaseSession
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ // TODO: document the path separator convention? '/' vs '\'
+ // TODO: should specify the access characteristics of model_path. Is this read only during the
+ // execution of CreateSession, or does the OrtSession retain a handle to the file/directory
+ // and continue to access throughout the OrtSession lifetime?
+ // What sort of access is needed to model_path : read or read/write?
+ ORT_API2_STATUS(CreateSession, _In_ const OrtEnv* env, _In_ const ORTCHAR_T* model_path,
+ _In_ const OrtSessionOptions* options, _Outptr_ OrtSession** out);
+
+ /** \brief Create an OrtSession from memory
+ *
+ * \param[in] env
+ * \param[in] model_data
+ * \param[in] model_data_length
+ * \param[in] options
+ * \param[out] out Returned newly created OrtSession. Must be freed with OrtApi::ReleaseSession
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateSessionFromArray, _In_ const OrtEnv* env, _In_ const void* model_data, size_t model_data_length,
+ _In_ const OrtSessionOptions* options, _Outptr_ OrtSession** out);
+
+ /** \brief Run the model in an ::OrtSession
+ *
+ * Will not return until the model run has completed. Multiple threads might be used to run the model based on
+ * the options in the ::OrtSession and settings used when creating the ::OrtEnv
+ *
+ * \param[in] session
+ * \param[in] run_options If nullptr, will use a default ::OrtRunOptions
+ * \param[in] input_names Array of null terminated UTF8 encoded strings of the input names
+ * \param[in] inputs Array of ::OrtValue%s of the input values
+ * \param[in] input_len Number of elements in the input_names and inputs arrays
+ * \param[in] output_names Array of null terminated UTF8 encoded strings of the output names
+ * \param[in] output_names_len Number of elements in the output_names and outputs array
+ * \param[out] outputs Array of ::OrtValue%s that the outputs are stored in. This can also be
+ * an array of nullptr values, in this case ::OrtValue objects will be allocated and pointers
+ * to them will be set into the `outputs` array.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(Run, _Inout_ OrtSession* session, _In_opt_ const OrtRunOptions* run_options,
+ _In_reads_(input_len) const char* const* input_names,
+ _In_reads_(input_len) const OrtValue* const* inputs, size_t input_len,
+ _In_reads_(output_names_len) const char* const* output_names, size_t output_names_len,
+ _Inout_updates_all_(output_names_len) OrtValue** outputs);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /** \brief Create an ::OrtSessionOptions object
+ *
+ * To use additional providers, you must build ORT with the extra providers enabled. Then call one of these
+ * functions to enable them in the session:<br>
+ * OrtSessionOptionsAppendExecutionProvider_CPU<br>
+ * OrtSessionOptionsAppendExecutionProvider_CUDA<br>
+ * OrtSessionOptionsAppendExecutionProvider_(remaining providers...)<br>
+ * The order they are called indicates the preference order as well. In other words call this method
+ * on your most preferred execution provider first followed by the less preferred ones.
+ * If none are called Ort will use its internal CPU execution provider.
+ *
+ * \param[out] options The newly created OrtSessionOptions. Must be freed with OrtApi::ReleaseSessionOptions
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateSessionOptions, _Outptr_ OrtSessionOptions** options);
+
+ /** \brief Set filepath to save optimized model after graph level transformations
+ *
+ * \param[in] options
+ * \param[in] optimized_model_filepath
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetOptimizedModelFilePath, _Inout_ OrtSessionOptions* options,
+ _In_ const ORTCHAR_T* optimized_model_filepath);
+
+ /** \brief Create a copy of an existing ::OrtSessionOptions
+ *
+ * \param[in] in_options OrtSessionOptions to copy
+ * \param[out] out_options Returned newly created ::OrtSessionOptions. Must be freed with OrtApi::ReleaseSessionOptions
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CloneSessionOptions, _In_ const OrtSessionOptions* in_options,
+ _Outptr_ OrtSessionOptions** out_options);
+
+ /** \brief Set execution mode
+ *
+ * Controls whether you want to execute operators in your graph sequentially or in parallel. Usually when the model
+ * has many branches, setting this option to ExecutionMode.ORT_PARALLEL will give you better performance.
+ * See [docs/ONNX_Runtime_Perf_Tuning.md] for more details.
+ *
+ * \param[in] options
+ * \param[in] execution_mode
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetSessionExecutionMode, _Inout_ OrtSessionOptions* options, ExecutionMode execution_mode);
+
+ /** \brief Enable profiling for a session
+ *
+ * \param[in] options
+ * \param[in] profile_file_prefix
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(EnableProfiling, _Inout_ OrtSessionOptions* options, _In_ const ORTCHAR_T* profile_file_prefix);
+
+ /** \brief Disable profiling for a session
+ *
+ * \param[in] options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(DisableProfiling, _Inout_ OrtSessionOptions* options);
+
+ /** \brief Enable the memory pattern optimization
+ *
+ * The idea is if the input shapes are the same, we could trace the internal memory allocation
+ * and generate a memory pattern for future request. So next time we could just do one allocation
+ * with a big chunk for all the internal memory allocation.
+ * \note Memory pattern optimization is only available when Sequential Execution mode is enabled (see OrtApi::SetSessionExecutionMode)
+ *
+ * \see OrtApi::DisableMemPattern
+ *
+ * \param[in] options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(EnableMemPattern, _Inout_ OrtSessionOptions* options);
+
+ /** \brief Disable the memory pattern optimization
+ *
+ * \see OrtApi::EnableMemPattern
+ *
+ * \param[in] options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(DisableMemPattern, _Inout_ OrtSessionOptions* options);
+
+ /** \brief Enable the memory arena on CPU
+ *
+ * Arena may pre-allocate memory for future usage.
+ *
+ * \param[in] options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(EnableCpuMemArena, _Inout_ OrtSessionOptions* options);
+
+ /** \brief Disable the memory arena on CPU
+ *
+ * \param[in] options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(DisableCpuMemArena, _Inout_ OrtSessionOptions* options);
+
+ /** \brief Set session log id
+ *
+ * \param[in] options
+ * \param[in] logid The log identifier.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetSessionLogId, _Inout_ OrtSessionOptions* options, const char* logid);
+
+ /** \brief Set session log verbosity level
+ *
+ * Applies to session load, initialization, etc
+ *
+ * \param[in] options
+ * \param[in] session_log_verbosity_level \snippet{doc} snippets.dox Log Verbosity Level
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetSessionLogVerbosityLevel, _Inout_ OrtSessionOptions* options, int session_log_verbosity_level);
+
+ /** \brief Set session log severity level
+ *
+ * \param[in] options
+ * \param[in] session_log_severity_level The log severity level (refer to ::OrtLoggingLevel for possible values).
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetSessionLogSeverityLevel, _Inout_ OrtSessionOptions* options, int session_log_severity_level);
+
+ /** \brief Set the optimization level to apply when loading a graph
+ *
+ * Please see https://onnxruntime.ai/docs/performance/model-optimizations/graph-optimizations.html for an in-depth explanation
+ * \param[in,out] options The session options object
+ * \param[in] graph_optimization_level The optimization level
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetSessionGraphOptimizationLevel, _Inout_ OrtSessionOptions* options,
+ GraphOptimizationLevel graph_optimization_level);
+
+ /** \brief Sets the number of threads used to parallelize the execution within nodes
+ *
+ * When running a single node operation, ex. add, this sets the maximum number of threads to use.
+ *
+ * \note If built with OpenMP, this has no effect on the number of threads used. In this case
+ * use the OpenMP env variables to configure the number of intra op num threads.
+ *
+ * \param[in] options
+ * \param[in] intra_op_num_threads Number of threads to use<br>
+ * A value of 0 will use the default number of threads<br>
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetIntraOpNumThreads, _Inout_ OrtSessionOptions* options, int intra_op_num_threads);
+
+ /** \brief Sets the number of threads used to parallelize the execution of the graph
+ *
+ * If nodes can be run in parallel, this sets the maximum number of threads to use to run them in parallel.
+ *
+ * \note If sequential execution is enabled this value is ignored, it acts as if it was set to 1.
+ *
+ * \param[in] options
+ * \param[in] inter_op_num_threads Number of threads to use<br>
+ * A value of 0 will use the default number of threads<br>
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetInterOpNumThreads, _Inout_ OrtSessionOptions* options, int inter_op_num_threads);
+
+ /// @}
+ /// \name OrtCustomOpDomain
+ /// @{
+
+ /** \brief Create a custom op domain
+ *
+ * \param[in] domain
+ * \param[out] out Newly created domain. Must be freed with OrtApi::ReleaseCustomOpDomain
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateCustomOpDomain, _In_ const char* domain, _Outptr_ OrtCustomOpDomain** out);
+
+ /** \brief Add a custom op to a custom op domain
+ *
+ * \note The OrtCustomOp* pointer must remain valid until the ::OrtCustomOpDomain using it is released
+ *
+ * \param[in] custom_op_domain
+ * \param[in] op
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CustomOpDomain_Add, _Inout_ OrtCustomOpDomain* custom_op_domain, _In_ const OrtCustomOp* op);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /** \brief Add custom op domain to a session options
+ *
+ * \note The OrtCustomOpDomain* must not be deleted until all sessions using it are released
+ *
+ * \param[in] options
+ * \param[in] custom_op_domain
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(AddCustomOpDomain, _Inout_ OrtSessionOptions* options, _In_ OrtCustomOpDomain* custom_op_domain);
+
+ /** \deprecated Use OrtApi::RegisterCustomOpsLibrary_V2.
+ *
+ * Registers custom ops from a shared library.
+ *
+ * Loads a shared library (dll on windows, so on linux, etc) named 'library_path' and looks for this entry point:
+ * OrtStatus* RegisterCustomOps(OrtSessionOptions * options, const OrtApiBase* api);
+ * It then passes in the provided session options to this function along with the api base.
+ * The handle to the loaded library is returned in library_handle. It can be freed by the caller after all sessions using the passed in
+ * session options are destroyed, or if an error occurs and it is non null.
+ *
+ * \param[in] options
+ * \param[in] library_path
+ * \param[out] library_handle OS specific handle to the loaded library (Use FreeLibrary on Windows, dlclose on Linux, etc.. to unload)
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(RegisterCustomOpsLibrary, _Inout_ OrtSessionOptions* options, _In_ const char* library_path, _Outptr_ void** library_handle);
+
+ /// @}
+ /// \name OrtSession
+ /// @{
+
+ /** \brief Get input count for a session
+ *
+ * This number must also match the number of inputs passed to OrtApi::Run
+ *
+ * \see OrtApi::SessionGetInputTypeInfo, OrtApi::SessionGetInputName, OrtApi::Session
+ *
+ * \param[in] session
+ * \param[out] out Number of inputs
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionGetInputCount, _In_ const OrtSession* session, _Out_ size_t* out);
+
+ /** \brief Get output count for a session
+ *
+ * This number must also match the number of outputs returned by OrtApi::Run
+ *
+ * \see OrtApi::SessionGetOutputTypeInfo, OrtApi::SessionGetOutputName, OrtApi::Session
+ *
+ * \param[in] session
+ * \param[out] out Number of outputs
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionGetOutputCount, _In_ const OrtSession* session, _Out_ size_t* out);
+
+ /** \brief Get overridable initializer count
+ *
+ * \see OrtApi::SessionGetOverridableInitializerTypeInfo, OrtApi::SessionGetOverridableInitializerName
+ *
+ * \param[in] session
+ * \param[in] out
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionGetOverridableInitializerCount, _In_ const OrtSession* session, _Out_ size_t* out);
+
+ /** \brief Get input type information
+ *
+ * \param[in] session
+ * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetInputCount returns (exclusive)
+ * \param[out] type_info Must be freed with OrtApi::ReleaseTypeInfo
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionGetInputTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
+
+ /** \brief Get output type information
+ *
+ * \param[in] session
+ * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetOutputCount returns (exclusive)
+ * \param[out] type_info Must be freed with OrtApi::ReleaseTypeInfo
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionGetOutputTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
+
+ /** \brief Get overridable initializer type information
+ *
+ * \param[in] session
+ * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetOverridableInitializerCount returns (exclusive)
+ * \param[out] type_info Must be freed with OrtApi::ReleaseTypeInfo
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionGetOverridableInitializerTypeInfo, _In_ const OrtSession* session, size_t index, _Outptr_ OrtTypeInfo** type_info);
+
+ /** \brief Get input name
+ *
+ * \param[in] session
+ * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetInputCount returns (exclusive)
+ * \param[in] allocator
+ * \param[out] value Set to a null terminated UTF-8 encoded string allocated using `allocator`. Must be freed using `allocator`.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionGetInputName, _In_ const OrtSession* session, size_t index, _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
+
+ /** \brief Get output name
+ *
+ * \param[in] session
+ * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetOutputCount returns (exclusive)
+ * \param[in] allocator
+ * \param[out] value Set to a null terminated UTF-8 encoded string allocated using `allocator`. Must be freed using `allocator`.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionGetOutputName, _In_ const OrtSession* session, size_t index, _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
+
+ /** \brief Get overridable initializer name
+ *
+ * \param[in] session
+ * \param[in] index Must be between 0 (inclusive) and what OrtApi::SessionGetOverridableInitializerCount returns (exclusive)
+ * \param[in] allocator
+ * \param[out] value Set to a null terminated UTF-8 encoded string allocated using `allocator`. Must be freed using `allocator`.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionGetOverridableInitializerName, _In_ const OrtSession* session, size_t index,
+ _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
+
+ /// @}
+ /// \name OrtRunOptions
+ /// @{
+
+ /** \brief Create an OrtRunOptions
+ *
+ * \param[out] out Returned newly created ::OrtRunOptions. Must be freed with OrtApi::ReleaseRunOptions
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateRunOptions, _Outptr_ OrtRunOptions** out);
+
+ /** \brief Set per-run log verbosity level
+ *
+ * \see OrtApi::RunOptionsGetRunLogVerbosityLevel
+ *
+ * \param[in] options
+ * \param[in] log_verbosity_level \snippet{doc} snippets.dox Log Verbosity Level
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(RunOptionsSetRunLogVerbosityLevel, _Inout_ OrtRunOptions* options, int log_verbosity_level);
+
+ /** \brief Set per-run log severity level
+ *
+ * \see OrtApi::RunOptionsGetRunLogSeverityLevel
+ *
+ * \param[in] options
+ * \param[in] log_severity_level The log severity level (refer to ::OrtLoggingLevel for possible values).
+ */
+ ORT_API2_STATUS(RunOptionsSetRunLogSeverityLevel, _Inout_ OrtRunOptions* options, int log_severity_level);
+
+ /** \brief Set per-run tag
+ *
+ * This is used in a per-run log identifier.
+ *
+ * \see OrtApi::RunOptionsGetRunTag
+ *
+ * \param[in] options
+ * \param[in] run_tag The run tag.
+ */
+ ORT_API2_STATUS(RunOptionsSetRunTag, _Inout_ OrtRunOptions* options, _In_ const char* run_tag);
+
+ /** \brief Get per-run log verbosity level
+ *
+ * \see OrtApi::RunOptionsSetRunLogVerbosityLevel
+ *
+ * \param[in] options
+ * \param[out] log_verbosity_level \snippet{doc} snippets.dox Log Verbosity Level
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(RunOptionsGetRunLogVerbosityLevel, _In_ const OrtRunOptions* options,
+ _Out_ int* log_verbosity_level);
+
+ /** \brief Get per-run log severity level
+ *
+ * \see OrtApi::RunOptionsSetRunLogSeverityLevel
+ *
+ * \param[in] options
+ * \param[out] log_severity_level The log severity level (refer to ::OrtLoggingLevel for possible values).
+ */
+ ORT_API2_STATUS(RunOptionsGetRunLogSeverityLevel, _In_ const OrtRunOptions* options, _Out_ int* log_severity_level);
+
+ /** \brief Get per-run tag
+ *
+ * This is used in a per-run log identifier.
+ *
+ * \see OrtApi::RunOptionsSetRunTag
+ *
+ * \param[in] options
+ * \param[out] run_tag The run tag.
+ * Do not free this value, it is owned by `options`. It will be invalidated if the run tag
+ * changes (i.e., with OrtApi::RunOptionsSetRunTag) or `options` is freed.
+ */
+ ORT_API2_STATUS(RunOptionsGetRunTag, _In_ const OrtRunOptions* options, _Out_ const char** run_tag);
+
+ /** \brief Set terminate flag
+ *
+ * If a currently executing session needs to be force terminated, this can be called from another thread to force it to fail with an error.
+ *
+ * \param[in] options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(RunOptionsSetTerminate, _Inout_ OrtRunOptions* options);
+
+ /** \brief Clears the terminate flag
+ *
+ * Used so the OrtRunOptions instance can be used in a new OrtApi::Run call without it instantly terminating
+ *
+ * \param[in] options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(RunOptionsUnsetTerminate, _Inout_ OrtRunOptions* options);
+
+ /// @}
+ /// \name OrtValue
+ /// @{
+
+ /** \brief Create a tensor
+ *
+ * Create a tensor using a supplied ::OrtAllocator
+ *
+ * \param[in] allocator
+ * \param[in] shape Pointer to the tensor shape dimensions.
+ * \param[in] shape_len The number of tensor shape dimensions.
+ * \param[in] type
+ * \param[out] out Returns newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateTensorAsOrtValue, _Inout_ OrtAllocator* allocator, _In_ const int64_t* shape, size_t shape_len,
+ ONNXTensorElementDataType type, _Outptr_ OrtValue** out);
+
+ /** \brief Create a tensor backed by a user supplied buffer
+ *
+ * Create a tensor with user's buffer. You can fill the buffer either before calling this function or after.
+ * p_data is owned by caller. ReleaseValue won't release p_data.
+ *
+ * \param[in] info Memory description of where the p_data buffer resides (CPU vs GPU etc).
+ * \param[in] p_data Pointer to the data buffer.
+ * \param[in] p_data_len The number of bytes in the data buffer.
+ * \param[in] shape Pointer to the tensor shape dimensions.
+ * \param[in] shape_len The number of tensor shape dimensions.
+ * \param[in] type The data type.
+ * \param[out] out Returns newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateTensorWithDataAsOrtValue, _In_ const OrtMemoryInfo* info, _Inout_ void* p_data,
+ size_t p_data_len, _In_ const int64_t* shape, size_t shape_len, ONNXTensorElementDataType type,
+ _Outptr_ OrtValue** out);
+
+ /** \brief Return if an ::OrtValue is a tensor type
+ *
+ * \param[in] value A tensor type (string tensors are not supported)
+ * \param[out] out Set to 1 iff ::OrtValue is a tensor, 0 otherwise
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(IsTensor, _In_ const OrtValue* value, _Out_ int* out);
+
+ /** \brief Get a pointer to the raw data inside a tensor
+ *
+ * Used to read/write/modify the internal tensor data directly.
+ * \note The returned pointer is valid until the \p value is destroyed.
+ *
+ * \param[in] value A tensor type (string tensors are not supported)
+ * \param[out] out Filled in with a pointer to the internal storage
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetTensorMutableData, _In_ OrtValue* value, _Outptr_ void** out);
+
+ /** \brief Set all strings at once in a string tensor
+ *
+ * \param[in,out] value A tensor of type ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING
+ * \param[in] s An array of strings. Each string in this array must be null terminated.
+ * \param[in] s_len Count of strings in s (Must match the size of \p value's tensor shape)
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(FillStringTensor, _Inout_ OrtValue* value, _In_ const char* const* s, size_t s_len);
+
+ /** \brief Get total byte length for all strings in a string tensor
+ *
+ * Typically used with OrtApi::GetStringTensorContent
+ *
+ * \param[in] value A tensor of type ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING
+ * \param[out] len Total byte length of all strings (does not include trailing nulls)
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetStringTensorDataLength, _In_ const OrtValue* value, _Out_ size_t* len);
+
+ /** \brief Get all strings from a string tensor
+ *
+ * An example of the results:<br>
+ * Given \p value is a string tensor with the strings { "This" "is" "a" "test" }<br>
+ * \p s must have a size of 11 bytes<br>
+ * \p offsets must have 4 elements<br>
+ * After the call, these values will be filled in:<br>
+ * \p s will contain "Thisisatest"<br>
+ * \p offsets will contain { 0, 4, 6, 7 }<br>
+ * The length of the last string is just s_len - offsets[last]
+ *
+ * \param[in] value A tensor of type ONNX_TENSOR_ELEMENT_DATA_TYPE_STRING
+ * \param[in] s Buffer to sequentially write all tensor strings to. Each string is NOT null-terminated.
+ * \param[in] s_len Number of bytes of buffer pointed to by \p s (Get it from OrtApi::GetStringTensorDataLength)
+ * \param[out] offsets Array of start offsets into the strings written to \p s
+ * \param[in] offsets_len Number of elements in offsets
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetStringTensorContent, _In_ const OrtValue* value, _Out_writes_bytes_all_(s_len) void* s,
+ size_t s_len, _Out_writes_all_(offsets_len) size_t* offsets, size_t offsets_len);
+
+ /// @}
+ /// \name OrtTypeInfo
+ /// @{
+
+ /** \brief Get ::OrtTensorTypeAndShapeInfo from an ::OrtTypeInfo
+ *
+ * \param[in] type_info
+ * \param[out] out Do not free this value, it will be valid until type_info is freed.
+ * If type_info does not represent tensor, this value will be set to nullptr.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CastTypeInfoToTensorInfo, _In_ const OrtTypeInfo* type_info,
+ _Outptr_result_maybenull_ const OrtTensorTypeAndShapeInfo** out);
+
+ /** \brief Get ::ONNXType from ::OrtTypeInfo
+ *
+ * \param[in] type_info
+ * \param[out] out
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetOnnxTypeFromTypeInfo, _In_ const OrtTypeInfo* type_info, _Out_ enum ONNXType* out);
+
+ /// @}
+ /// \name OrtTensorTypeAndShapeInfo
+ /// @{
+
+ /** \brief Create an ::OrtTensorTypeAndShapeInfo object
+ *
+ * \param[out] out Returns newly created ::OrtTensorTypeAndShapeInfo. Must be freed with OrtApi::ReleaseTensorTypeAndShapeInfo
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateTensorTypeAndShapeInfo, _Outptr_ OrtTensorTypeAndShapeInfo** out);
+
+ /** \brief Set element type in ::OrtTensorTypeAndShapeInfo
+ *
+ * \param[in] info
+ * \param[in] type
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetTensorElementType, _Inout_ OrtTensorTypeAndShapeInfo* info, enum ONNXTensorElementDataType type);
+
+ /** \brief Set shape information in ::OrtTensorTypeAndShapeInfo
+ *
+ * \param[in] info
+ * \param[in] dim_values Array with `dim_count` elements. Can contain negative values.
+ * \param[in] dim_count Number of elements in `dim_values`
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetDimensions, OrtTensorTypeAndShapeInfo* info, _In_ const int64_t* dim_values, size_t dim_count);
+
+ /** \brief Get element type in ::OrtTensorTypeAndShapeInfo
+ *
+ * \see OrtApi::SetTensorElementType
+ *
+ * \param[in] info
+ * \param[out] out
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetTensorElementType, _In_ const OrtTensorTypeAndShapeInfo* info,
+ _Out_ enum ONNXTensorElementDataType* out);
+
+ /** \brief Get dimension count in ::OrtTensorTypeAndShapeInfo
+ *
+ * \see OrtApi::GetDimensions
+ *
+ * \param[in] info
+ * \param[out] out
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetDimensionsCount, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ size_t* out);
+
+ /** \brief Get dimensions in ::OrtTensorTypeAndShapeInfo
+ *
+ * \param[in] info
+ * \param[out] dim_values Array with `dim_values_length` elements. On return, filled with the dimensions stored in the ::OrtTensorTypeAndShapeInfo
+ * \param[in] dim_values_length Number of elements in `dim_values`. Use OrtApi::GetDimensionsCount to get this value
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetDimensions, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ int64_t* dim_values,
+ size_t dim_values_length);
+
+ /** \brief Get symbolic dimension names in ::OrtTensorTypeAndShapeInfo
+ *
+ * \param[in] info
+ * \param[in] dim_params Array with `dim_params_length` elements. On return filled with pointers to null terminated strings of the dimension names
+ * \param[in] dim_params_length Number of elements in `dim_params`. Use OrtApi::GetDimensionsCount to get this value
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetSymbolicDimensions, _In_ const OrtTensorTypeAndShapeInfo* info,
+ _Out_writes_all_(dim_params_length) const char* dim_params[], size_t dim_params_length);
+
+ /** \brief Get total number of elements in a tensor shape from an ::OrtTensorTypeAndShapeInfo
+ *
+ * Return the number of elements specified by the tensor shape (all dimensions multiplied by each other).
+ * For 0 dimensions, 1 is returned. If any dimension is less than 0, the result is always -1.
+ *
+ * Examples:<br>
+ * [] = 1<br>
+ * [1,3,4] = 12<br>
+ * [2,0,4] = 0<br>
+ * [-1,3,4] = -1<br>
+ *
+ * \param[in] info
+ * \param[out] out Number of elements
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetTensorShapeElementCount, _In_ const OrtTensorTypeAndShapeInfo* info, _Out_ size_t* out);
+
+ /// @}
+ /// \name OrtValue
+ /// @{
+
+ /** \brief Get type and shape information from a tensor ::OrtValue
+ *
+ * \param[in] value Must be a tensor (not a map/sequence/etc) or will return failure
+ * \param[out] out Newly created ::OrtTensorTypeAndShapeInfo. Must be freed with OrtApi::ReleaseTensorTypeAndShapeInfo
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetTensorTypeAndShape, _In_ const OrtValue* value, _Outptr_ OrtTensorTypeAndShapeInfo** out);
+
+ /** \brief Get type information of an OrtValue
+ *
+ * \param[in] value
+ * \param[out] out Newly created ::OrtTypeInfo. Must be freed with OrtApi::ReleaseTypeInfo
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetTypeInfo, _In_ const OrtValue* value, _Outptr_result_maybenull_ OrtTypeInfo** out);
+
+ /** \brief Get ONNXType of an ::OrtValue
+ *
+ * \param[in] value
+ * \param[out] out
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetValueType, _In_ const OrtValue* value, _Out_ enum ONNXType* out);
+
+ /// @}
+ /// \name OrtMemoryInfo
+ /// @{
+
+ /** \brief Create an ::OrtMemoryInfo
+ *
+ * \param[in] name
+ * \param[in] type
+ * \param[in] id
+ * \param[in] mem_type
+ * \param[out] out Newly created ::OrtMemoryInfo. Must be freed with OrtAPi::ReleaseMemoryInfo
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateMemoryInfo, _In_ const char* name, enum OrtAllocatorType type, int id,
+ enum OrtMemType mem_type, _Outptr_ OrtMemoryInfo** out);
+
+ /** \brief Create an ::OrtMemoryInfo for CPU memory
+ *
+ * Special case version of OrtApi::CreateMemoryInfo for CPU based memory. Same as using OrtApi::CreateMemoryInfo with name = "Cpu" and id = 0.
+ *
+ * \param[in] type
+ * \param[in] mem_type
+ * \param[out] out
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateCpuMemoryInfo, enum OrtAllocatorType type, enum OrtMemType mem_type,
+ _Outptr_ OrtMemoryInfo** out);
+
+ /** \brief Compare ::OrtMemoryInfo objects for equality
+ *
+ * Compares all settings of each ::OrtMemoryInfo for equality
+ *
+ * \param[in] info1
+ * \param[in] info2
+ * \param[out] out Set to 0 if equal, -1 if not equal
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CompareMemoryInfo, _In_ const OrtMemoryInfo* info1, _In_ const OrtMemoryInfo* info2, _Out_ int* out);
+
+ /** \brief Get name from ::OrtMemoryInfo
+ *
+ * \param[in] ptr
+ * \param[out] out Writes null terminated string to this pointer. Do NOT free the returned pointer. It is valid for the lifetime of the ::OrtMemoryInfo
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(MemoryInfoGetName, _In_ const OrtMemoryInfo* ptr, _Out_ const char** out);
+
+ /** \brief Get the id from ::OrtMemoryInfo
+ */
+ ORT_API2_STATUS(MemoryInfoGetId, _In_ const OrtMemoryInfo* ptr, _Out_ int* out);
+
+ /** \brief Get the ::OrtMemType from ::OrtMemoryInfo
+ */
+ ORT_API2_STATUS(MemoryInfoGetMemType, _In_ const OrtMemoryInfo* ptr, _Out_ OrtMemType* out);
+
+ /** \brief Get the ::OrtAllocatorType from ::OrtMemoryInfo
+ */
+ ORT_API2_STATUS(MemoryInfoGetType, _In_ const OrtMemoryInfo* ptr, _Out_ OrtAllocatorType* out);
+
+ /// @}
+ /// \name OrtAllocator
+ /// @{
+
+ /// \brief Calls OrtAllocator::Alloc function
+ ORT_API2_STATUS(AllocatorAlloc, _Inout_ OrtAllocator* ort_allocator, size_t size, _Outptr_ void** out);
+ /// \brief Calls OrtAllocator::Free function
+ ORT_API2_STATUS(AllocatorFree, _Inout_ OrtAllocator* ort_allocator, void* p);
+ /// \brief Calls OrtAllocator::Info function
+ ORT_API2_STATUS(AllocatorGetInfo, _In_ const OrtAllocator* ort_allocator, _Outptr_ const struct OrtMemoryInfo** out);
+
+ /** \brief Get the default allocator
+ *
+ * The default allocator is a CPU based, non-arena. Always returns the same pointer to the same default allocator.
+ *
+ * \param[out] out Returned value should NOT be freed
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetAllocatorWithDefaultOptions, _Outptr_ OrtAllocator** out);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /** \brief Override session symbolic dimensions
+ *
+ * Override symbolic dimensions (by specific denotation strings) with actual values if known at session initialization time to enable
+ * optimizations that can take advantage of fixed values (such as memory planning, etc)
+ *
+ * \param[in] options
+ * \param[in] dim_denotation
+ * \param[in] dim_value
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(AddFreeDimensionOverride, _Inout_ OrtSessionOptions* options, _In_ const char* dim_denotation,
+ _In_ int64_t dim_value);
+
+ /// @}
+ /// \name OrtValue
+ /// @{
+
+ /* Internal information (not seen in Doxygen)
+ *
+ * APIs to support non-tensor types - map and sequence.
+ * Currently only the following types are supported
+ * Note: the following types should be kept in sync with data_types.h
+ * Map types
+ * =========
+ * std::map<std::string, std::string>
+ * std::map<std::string, int64_t>
+ * std::map<std::string, float>
+ * std::map<std::string, double>
+ * std::map<int64_t, std::string>
+ * std::map<int64_t, int64_t>
+ * std::map<int64_t, float>
+ * std::map<int64_t, double>
+ *
+ * Sequence types
+ * ==============
+ * std::vector<std::string>
+ * std::vector<int64_t>
+ * std::vector<float>
+ * std::vector<double>
+ * std::vector<std::map<std::string, float>>
+ * std::vector<std::map<int64_t, float>
+ */
+
+ /** \brief Get non tensor data from an ::OrtValue
+ *
+ * If `value` is of type ONNX_TYPE_MAP, you need to retrieve the keys and values
+ * separately. Use index=0 to retrieve keys and index=1 to retrieve values.
+ * If `value` is of type ONNX_TYPE_SEQUENCE, use index to retrieve the index'th element
+ * of the sequence.
+ *
+ * \param[in] value
+ * \param[in] index See above for usage based on `value` type
+ * \param[in] allocator Allocator used to allocate ::OrtValue
+ * \param[out] out Created ::OrtValue that holds the element requested. Must be freed with OrtApi::ReleaseValue
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetValue, _In_ const OrtValue* value, int index, _Inout_ OrtAllocator* allocator,
+ _Outptr_ OrtValue** out);
+
+ /** \brief Get non tensor value count from an ::OrtValue
+ *
+ * If `value` is of type ONNX_TYPE_MAP 2 will always be returned. For ONNX_TYPE_SEQUENCE
+ * the number of elements in the sequence will be returned
+ *
+ * \param[in] value
+ * \param[out] out
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetValueCount, _In_ const OrtValue* value, _Out_ size_t* out);
+
+ /** \brief Create a map or sequence ::OrtValue
+ *
+ * To construct a map (ONNX_TYPE_MAP), use num_values = 2 and `in` should be an array of 2 ::OrtValue%s
+ * representing keys and values.<br>
+ *
+ * To construct a sequence (ONNX_TYPE_SEQUENCE), use num_values = N where N is the number of the elements in the
+ * sequence. 'in' should be an array of N ::OrtValue%s.
+ *
+ * \param[in] in See above for details
+ * \param[in] num_values
+ * \param[in] value_type Must be either ONNX_TYPE_MAP or ONNX_TYPE_SEQUENCE
+ * \param[out] out Newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateValue, _In_reads_(num_values) const OrtValue* const* in, size_t num_values,
+ enum ONNXType value_type, _Outptr_ OrtValue** out);
+
+ /** \brief Create an opaque (custom user defined type) ::OrtValue
+ *
+ * Constructs an ::OrtValue that contains a value of non-standard type created for
+ * experiments or while awaiting standardization. ::OrtValue in this case would contain
+ * an internal representation of the Opaque type. Opaque types are distinguished from
+ * each other by two strings 1) domain and 2) type name. The combination of the two
+ * must be unique, so the type representation is properly identified internally. The combination
+ * must be properly registered from within ORT at both compile/run time or by another API.
+ *
+ * To construct the ::OrtValue pass domain and type names, also a pointer to a data container
+ * the type of which must be known to both ORT and the client program. That data container may or may
+ * not match the internal representation of the Opaque type. The sizeof(data_container) is passed for
+ * verification purposes.
+ *
+ * \param[in] domain_name Null terminated string of the domain name
+ * \param[in] type_name Null terminated string of the type name
+ * \param[in] data_container User pointer Data to populate ::OrtValue
+ * \param[in] data_container_size Size in bytes of what `data_container` points to
+ * \param[out] out Newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateOpaqueValue, _In_z_ const char* domain_name, _In_z_ const char* type_name,
+ _In_ const void* data_container, size_t data_container_size, _Outptr_ OrtValue** out);
+
+ /** \brief Get internal data from an opaque (custom user defined type) ::OrtValue
+ *
+ * Copies internal data from an opaque value into a user provided buffer
+ *
+ * \see OrtApi::CreateOpaqueValue
+ *
+ * \param[in] domain_name Null terminated string of the domain name
+ * \param[in] type_name Null terminated string of the type name
+ * \param[in] in The opaque ::OrtValue
+ * \param[out] data_container Buffer to copy data into
+ * \param[out] data_container_size Size in bytes of the buffer pointed to by data_container. Must match the size of the internal buffer.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetOpaqueValue, _In_ const char* domain_name, _In_ const char* type_name, _In_ const OrtValue* in,
+ _Out_ void* data_container, size_t data_container_size);
+
+ /// @}
+ /// \name OrtKernelInfo
+ /// Custom operator APIs.
+ /// @{
+
+ /** \brief Get a float stored as an attribute in the graph node
+ *
+ * \param[in] info ::OrtKernelInfo instance
+ * \param[in] name Null terminated string of the name of the attribute
+ * \param[out] out Pointer to memory where the attribute will be stored
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(KernelInfoGetAttribute_float, _In_ const OrtKernelInfo* info, _In_ const char* name,
+ _Out_ float* out);
+
+ /** \brief Fetch a 64-bit int stored as an attribute in the graph node
+ *
+ * \param[in] info ::OrtKernelInfo instance
+ * \param[in] name Null terminated string of the name of the attribute
+ * \param[out] out Pointer to memory where the attribute will be stored
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(KernelInfoGetAttribute_int64, _In_ const OrtKernelInfo* info, _In_ const char* name,
+ _Out_ int64_t* out);
+
+ /** \brief Fetch a string stored as an attribute in the graph node
+ *
+ * If `out` is nullptr, the value of `size` is set to the true size of the string
+ * attribute, and a success status is returned.
+ *
+ * If the `size` parameter is greater than or equal to the actual string attribute's size,
+ * the value of `size` is set to the true size of the string attribute, the provided memory
+ * is filled with the attribute's contents, and a success status is returned.
+ *
+ * If the `size` parameter is less than the actual string attribute's size and `out`
+ * is not nullptr, the value of `size` is set to the true size of the string attribute
+ * and a failure status is returned.)
+ *
+ * \param[in] info ::OrtKernelInfo instance
+ * \param[in] name Null terminated string of the name of the attribute
+ * \param[out] out Pointer to memory where the attribute will be stored
+ * \param[in,out] size See above comments for details
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(KernelInfoGetAttribute_string, _In_ const OrtKernelInfo* info, _In_ const char* name, _Out_ char* out,
+ _Inout_ size_t* size);
+
+ /// @}
+ /// \name OrtKernelContext
+ /// Custom operator APIs.
+ /// @{
+
+ /** \brief Used for custom operators, get the input count of a kernel
+ *
+ * \see ::OrtCustomOp
+ */
+ ORT_API2_STATUS(KernelContext_GetInputCount, _In_ const OrtKernelContext* context, _Out_ size_t* out);
+
+ /** \brief Used for custom operators, get the output count of a kernel
+ *
+ * \see ::OrtCustomOp
+ */
+ ORT_API2_STATUS(KernelContext_GetOutputCount, _In_ const OrtKernelContext* context, _Out_ size_t* out);
+
+ /** \brief Used for custom operators, get an input of a kernel
+ *
+ * The function attempts fetches the input of the kernel. If the input is optional
+ * and not present, the function returns success and out is set to nullptr.
+ *
+ * \param[in] context ::OrtKernelContext instance
+ * \param[in] index See KernelContext_GetInputCount for boundaries check.
+ * \param[out] out OrtValue if the input is present otherwise is set nullptr
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(KernelContext_GetInput, _In_ const OrtKernelContext* context, _In_ size_t index,
+ _Out_ const OrtValue** out);
+
+ /** \brief Used for custom operators, get an output of a kernel
+ *
+ * The function attempts fetches the output of the kernel. If the output is optional
+ * and not present, the function returns success and out is set to nullptr.
+ *
+ * \param[in] context ::OrtKernelContext instance
+ * \param[in] index See KernelContext_GetOutputCount for boundaries check.
+ * \param[in] dim_values output dimensions
+ * \param[in] dim_count number of dimensions
+ * \param[out] out a ptr to OrtValue to output otherwise set to nullptr
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(KernelContext_GetOutput, _Inout_ OrtKernelContext* context, _In_ size_t index,
+ _In_ const int64_t* dim_values, size_t dim_count, _Outptr_ OrtValue** out);
+
+ /// @}
+ /// \name OrtEnv
+ /// @{
+ ORT_CLASS_RELEASE(Env);
+ /// @}
+ /// \name OrtStatus
+ /// @{
+ ORT_CLASS_RELEASE(Status);
+ /// @}
+ /// \name OrtMemoryInfo
+ /// @{
+ ORT_CLASS_RELEASE(MemoryInfo);
+ /// @}
+ /// \name OrtSession
+ /// @{
+ ORT_CLASS_RELEASE(Session); // Don't call ReleaseSession from Dllmain (because session owns a thread pool)
+ /// @}
+ /// \name OrtValue
+ /// @{
+ ORT_CLASS_RELEASE(Value);
+ /// @}
+ /// \name OrtRunOptions
+ /// @{
+ ORT_CLASS_RELEASE(RunOptions);
+ /// @}
+ /// \name OrtTypeInfo
+ /// @{
+ ORT_CLASS_RELEASE(TypeInfo);
+ /// @}
+ /// \name OrtTensorTypeAndShapeInfo
+ /// @{
+ ORT_CLASS_RELEASE(TensorTypeAndShapeInfo);
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+ ORT_CLASS_RELEASE(SessionOptions);
+ /// @}
+ /// \name OrtCustomOpDomain
+ /// @{
+ ORT_CLASS_RELEASE(CustomOpDomain);
+
+ /// @}
+ /// \name OrtTypeInfo
+ /// @{
+
+ /** \brief Get denotation from type information
+ *
+ * Augments ::OrtTypeInfo to return denotations on the type.
+ *
+ * This is used by WinML to determine if an input/output is intended to be an Image or a Tensor.
+ *
+ * \param[in] type_info
+ * \param[out] denotation Pointer to the null terminated denotation string is written to this pointer. This pointer is valid until the object is destroyed or the name is changed, do not free.
+ * \param[out] len Length in bytes of the string returned in `denotation`
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetDenotationFromTypeInfo, _In_ const OrtTypeInfo* type_info, _Out_ const char** const denotation,
+ _Out_ size_t* len);
+
+ /** \brief Get detailed map information from an ::OrtTypeInfo
+ *
+ * This augments ::OrtTypeInfo to return an ::OrtMapTypeInfo when the type is a map.
+ * The OrtMapTypeInfo has additional information about the map's key type and value type.
+ *
+ * This is used by WinML to support model reflection APIs.
+ *
+ * \param[out] type_info
+ * \param[out] out A pointer to the ::OrtMapTypeInfo. Do not free this value. If type_info
+ * does not contain a map, this value will be set to nullptr.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CastTypeInfoToMapTypeInfo, _In_ const OrtTypeInfo* type_info,
+ _Outptr_result_maybenull_ const OrtMapTypeInfo** out);
+
+ /** \brief Cast ::OrtTypeInfo to an ::OrtSequenceTypeInfo
+ *
+ * This api augments ::OrtTypeInfo to return an ::OrtSequenceTypeInfo when the type is a sequence.
+ * The ::OrtSequenceTypeInfo has additional information about the sequence's element type.
+ *
+ * This is used by WinML to support model reflection APIs.
+ *
+ * \param[in] type_info
+ * \param[out] out A pointer to the OrtSequenceTypeInfo. Do not free this value. If type_info
+ * doesn not contain a sequence, this value will be set to nullptr.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CastTypeInfoToSequenceTypeInfo, _In_ const OrtTypeInfo* type_info,
+ _Outptr_result_maybenull_ const OrtSequenceTypeInfo** out);
+
+ /// @}
+ /// \name OrtMapTypeInfo
+ /// @{
+
+ /** \brief Get key type from an ::OrtMapTypeInfo
+ *
+ * Key types are restricted to being scalar types.
+ *
+ * This is used by WinML to support model reflection APIs.
+ *
+ * \param[in] map_type_info
+ * \param[out] out
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetMapKeyType, _In_ const OrtMapTypeInfo* map_type_info, _Out_ enum ONNXTensorElementDataType* out);
+
+ /** \brief Get the value type from an ::OrtMapTypeInfo
+ *
+ * \param[in] map_type_info
+ * \param[out] type_info
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetMapValueType, _In_ const OrtMapTypeInfo* map_type_info, _Outptr_ OrtTypeInfo** type_info);
+
+ /// @}
+ /// \name OrtSequenceTypeInfo
+ /// @{
+
+ /** \brief Get element type from an ::OrtSequenceTypeInfo
+ *
+ * This is used by WinML to support model reflection APIs.
+ *
+ * \param[in] sequence_type_info
+ * \param[out] type_info
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetSequenceElementType, _In_ const OrtSequenceTypeInfo* sequence_type_info,
+ _Outptr_ OrtTypeInfo** type_info);
+
+ /// @}
+ /// \name OrtMapTypeInfo
+ /// @{
+ ORT_CLASS_RELEASE(MapTypeInfo);
+ /// @}
+ /// \name OrtSequenceTypeInfo
+ /// @{
+ ORT_CLASS_RELEASE(SequenceTypeInfo);
+
+ /// @}
+ /// \name OrtSession
+ /// @{
+
+ /** \brief End profiling and return filename of the profile data
+ *
+ * Profiling is turned on through OrtApi::EnableProfiling
+ *
+ * \param[in] session
+ * \param[in] allocator
+ * \param[out] out Null terminated string of the filename, allocated using `allocator`. Must be freed using `allocator`
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionEndProfiling, _In_ OrtSession* session, _Inout_ OrtAllocator* allocator, _Outptr_ char** out);
+
+ /** \brief Get ::OrtModelMetadata from an ::OrtSession
+ *
+ * \param[in] session
+ * \param[out] out Newly created ::OrtModelMetadata. Must be freed using OrtApi::ReleaseModelMetadata
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionGetModelMetadata, _In_ const OrtSession* session, _Outptr_ OrtModelMetadata** out);
+
+ /// @}
+ /// \name OrtModelMetadata
+ /// @{
+
+ /** \brief Get `producer name` from an ::OrtModelMetadata
+ *
+ * \param[in] model_metadata
+ * \param[in] allocator
+ * \param[out] value Set to a null terminated string allocated using `allocator`. Must be freed using `allocator`
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(ModelMetadataGetProducerName, _In_ const OrtModelMetadata* model_metadata,
+ _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
+
+ /** \brief Get `graph name` from an ::OrtModelMetadata
+ *
+ * \param[in] model_metadata
+ * \param[in] allocator
+ * \param[out] value Set to a null terminated string allocated using `allocator`. Must be freed using `allocator`
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(ModelMetadataGetGraphName, _In_ const OrtModelMetadata* model_metadata,
+ _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
+
+ /** \brief Get `domain` from an ::OrtModelMetadata
+ *
+ * \param[in] model_metadata
+ * \param[in] allocator
+ * \param[out] value Set to a null terminated string allocated using `allocator`. Must be freed using `allocator`
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(ModelMetadataGetDomain, _In_ const OrtModelMetadata* model_metadata, _Inout_ OrtAllocator* allocator,
+ _Outptr_ char** value);
+
+ /** \brief Get `description` from an ::OrtModelMetadata
+ *
+ * \param[in] model_metadata
+ * \param[in] allocator
+ * \param[out] value Set to a null terminated string allocated using `allocator`. Must be freed using `allocator`
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(ModelMetadataGetDescription, _In_ const OrtModelMetadata* model_metadata,
+ _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
+
+ /** \brief Return data for a key in the custom metadata map in an ::OrtModelMetadata
+ *
+ * \param[in] model_metadata
+ * \param[in] allocator
+ * \param[in] key Null terminated string
+ * \param[out] value Set to a null terminated string allocated using `allocator`. Must be freed using `allocator`
+ * `value` will be set to nullptr if the given key is not found in the custom metadata map.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(ModelMetadataLookupCustomMetadataMap, _In_ const OrtModelMetadata* model_metadata,
+ _Inout_ OrtAllocator* allocator, _In_ const char* key, _Outptr_result_maybenull_ char** value);
+
+ /** \brief Get version number from an ::OrtModelMetadata
+ *
+ * \param[in] model_metadata
+ * \param[out] value Set to the version number
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(ModelMetadataGetVersion, _In_ const OrtModelMetadata* model_metadata, _Out_ int64_t* value);
+
+ ORT_CLASS_RELEASE(ModelMetadata);
+
+ /// @}
+ /// \name OrtEnv
+ /// @{
+
+ /** \brief Create an OrtEnv
+ *
+ * Create an environment with global threadpools that will be shared across sessions.
+ * Use this in conjunction with OrtApi::DisablePerSessionThreads or else the session will use
+ * its own thread pools.
+ *
+ * \param[in] log_severity_level The log severity level.
+ * \param[in] logid The log identifier.
+ * \param[in] tp_options
+ * \param[out] out Returned newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateEnvWithGlobalThreadPools, OrtLoggingLevel log_severity_level, _In_ const char* logid,
+ _In_ const OrtThreadingOptions* tp_options, _Outptr_ OrtEnv** out);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /** \brief Use global thread pool on a session
+ *
+ * Disable using per session thread pool and use the shared global threadpool.
+ * This should be used in conjunction with OrtApi::CreateEnvWithGlobalThreadPools.
+ *
+ * \param[in] options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(DisablePerSessionThreads, _Inout_ OrtSessionOptions* options);
+
+ /// @}
+ /// \name OrtThreadingOptions
+ /// @{
+
+ /** \brief Create an ::OrtThreadingOptions
+ *
+ * \param[out] out Newly created ::OrtThreadingOptions. Must be freed with OrtApi::ReleaseThreadingOptions
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateThreadingOptions, _Outptr_ OrtThreadingOptions** out);
+
+ ORT_CLASS_RELEASE(ThreadingOptions);
+
+ /// @}
+ /// \name OrtModelMetadata
+ /// @{
+
+ /**
+ *
+ * \param[in] model_metadata
+ * \param[in] allocator
+ * \param[out] keys Array of null terminated strings (array count = num_keys) allocated using `allocator`.
+ * The strings and the pointer array must be freed using `allocator`
+ * `keys` will be set to nullptr if the custom metadata map is empty.
+ * \param[out] num_keys Set to the number of elements in the `keys` array
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(ModelMetadataGetCustomMetadataMapKeys, _In_ const OrtModelMetadata* model_metadata,
+ _Inout_ OrtAllocator* allocator, _Outptr_result_buffer_maybenull_(*num_keys) char*** keys, _Out_ int64_t* num_keys);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /**
+ *
+ * Override symbolic dimensions (by specific name strings) with actual values
+ * if known at session initialization time to enable optimizations that can
+ * take advantage of fixed values (such as memory planning, etc)
+ *
+ */
+ ORT_API2_STATUS(AddFreeDimensionOverrideByName,
+ _Inout_ OrtSessionOptions* options, _In_ const char* dim_name,
+ _In_ int64_t dim_value);
+
+ /// @}
+ /// \name Misc
+ /// @{
+
+ /** \brief Get the names of all available providers
+ *
+ * \note The providers in the list are not guaranteed to be usable. They may fail to load due to missing system dependencies.
+ * For example, if the CUDA/cuDNN libraries are not installed, the CUDA provider will report an error when it is added to the session options.
+ *
+ * \param[out] out_ptr Set to a pointer to an array of null terminated strings of the available providers. The entries and the
+ * array itself must be freed using OrtApi::ReleaseAvailableProviders
+ * \param[out] provider_length Set to the number of entries in the `out_ptr` array
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetAvailableProviders, _Outptr_ char*** out_ptr, _Out_ int* provider_length);
+
+ /** \brief Release data from OrtApi::GetAvailableProviders. This API will never fail
+ * so you can rely on it in a noexcept code.
+ *
+ * \param[in] ptr The `out_ptr` result from OrtApi::GetAvailableProviders.
+ * \param[in] providers_length The `provider_length` result from OrtApi::GetAvailableProviders
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(ReleaseAvailableProviders, _In_ char** ptr,
+ _In_ int providers_length);
+
+ /// @}
+ /// \name OrtValue
+ /// @{
+
+ /** \brief Get the length of a single string in a string tensor
+ *
+ * \param[in] value A string tensor
+ * \param[in] index Index of the string in the tensor
+ * \param[out] out Set to number of bytes of the string element
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetStringTensorElementLength, _In_ const OrtValue* value, size_t index, _Out_ size_t* out);
+
+ /** \brief Get a single string from a string tensor
+ *
+ * \param[in] value A string tensor
+ * \param[in] s_len Number of bytes in the `s` buffer. Must match the value returned by OrtApi::GetStringTensorElementLength.
+ * \param[in] index Index of the string in the tensor
+ * \param[out] s The string element contents in UTF-8 encoding. The string is NOT null-terminated.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetStringTensorElement, _In_ const OrtValue* value, size_t s_len, size_t index, _Out_writes_bytes_all_(s_len) void* s);
+
+ /** \brief Set a single string in a string tensor
+ *
+ * \param[in] value A string tensor
+ * \param[in] s A null terminated UTF-8 encoded string
+ * \param[in] index Index of the string in the tensor to set
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(FillStringTensorElement, _Inout_ OrtValue* value, _In_ const char* s, size_t index);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /** \brief Set a session configuration entry as a pair of strings
+ *
+ * If a configuration with same key exists, this will overwrite the configuration with the given config_value.
+ *
+ * The config_key and the format of config_value are defined in onnxruntime_session_options_config_keys.h
+ *
+ * \param[in] options
+ * \param[in] config_key A null terminated string representation of the config key
+ * \param[in] config_value A null terminated string representation of the config value
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(AddSessionConfigEntry, _Inout_ OrtSessionOptions* options,
+ _In_z_ const char* config_key, _In_z_ const char* config_value);
+
+ /// @}
+ /// \name OrtAllocator
+ /// @{
+
+ /** \brief Create an allocator for an ::OrtSession following an ::OrtMemoryInfo
+ *
+ * \param[in] session
+ * \param[in] mem_info valid ::OrtMemoryInfo instance
+ * \param[out] out Newly created ::OrtAllocator. Must be freed with OrtApi::ReleaseAllocator
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateAllocator, _In_ const OrtSession* session, _In_ const OrtMemoryInfo* mem_info,
+ _Outptr_ OrtAllocator** out);
+
+ /** \brief Release an ::OrtAllocator obtained from OrtApi::CreateAllocator
+ */
+ ORT_CLASS_RELEASE(Allocator);
+
+ /// @}
+ /// \name OrtSession
+ /// @{
+
+ /** \brief Run a model using Io Bindings for the inputs & outputs
+ *
+ * \see OrtApi::Run
+ *
+ * \param[in] session
+ * \param[in] run_options
+ * \param[in] binding_ptr
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(RunWithBinding, _Inout_ OrtSession* session, _In_ const OrtRunOptions* run_options, _In_ const OrtIoBinding* binding_ptr);
+
+ /** \brief Create an ::OrtIoBinding instance
+ *
+ * An IoBinding object allows one to bind pre-allocated ::OrtValue%s to input names.
+ * Thus if you want to use a raw on device buffer as input or output you can avoid
+ * extra copy during runtime.
+ *
+ * \param[in] session
+ * \param[out] out Newly created ::OrtIoBinding. Must be freed with OrtApi::ReleaseIoBinding
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateIoBinding, _Inout_ OrtSession* session, _Outptr_ OrtIoBinding** out);
+
+ /// @}
+ /// \name OrtIoBinding
+ /// @{
+
+ /** \brief Release an ::OrtIoBinding obtained from OrtApi::CreateIoBinding
+ */
+ ORT_CLASS_RELEASE(IoBinding);
+
+ /** \brief Bind an ::OrtValue to an ::OrtIoBinding input
+ *
+ * When using OrtApi::RunWithBinding this value is used for the named input
+ *
+ * \param[in] binding_ptr
+ * \param[in] name Name for the model input
+ * \param[in] val_ptr ::OrtValue of Tensor type.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(BindInput, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtValue* val_ptr);
+
+ /** \brief Bind an ::OrtValue to an ::OrtIoBinding output
+ *
+ * When using OrtApi::RunWithBinding this value is used for the named output
+ *
+ * \param[in] binding_ptr
+ * \param[in] name Null terminated string of the model output name
+ * \param[in] val_ptr ::OrtValue of Tensor type.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(BindOutput, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtValue* val_ptr);
+
+ /** \brief Bind an ::OrtIoBinding output to a device
+ *
+ * Binds the ::OrtValue to a device which is specified by ::OrtMemoryInfo.
+ * You can either create an instance of ::OrtMemoryInfo with a device id or obtain one from the allocator that you have created/are using
+ * This is useful when one or more outputs have dynamic shapes and, it is hard to pre-allocate and bind a chunk of
+ * memory within ::OrtValue ahead of time.
+ *
+ * \see OrtApi::RunWithBinding
+ *
+ * \param[in] binding_ptr
+ * \param[in] name Null terminated string of the device name
+ * \param[in] mem_info_ptr
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(BindOutputToDevice, _Inout_ OrtIoBinding* binding_ptr, _In_ const char* name, _In_ const OrtMemoryInfo* mem_info_ptr);
+
+ /** \brief Get the names of an ::OrtIoBinding's outputs
+ *
+ * Returns the names of the outputs in the order they were bound. This is useful after running the model
+ * with bound outputs because the returned names are in order in which output ::OrtValue are returned. This is useful if
+ * the order of outputs and their names is not known.
+ *
+ * \param[in] binding_ptr
+ * \param[in] allocator Allocator used to allocate continuous buffers for output strings and lengths.
+ * \param[out] buffer Returns an array of non-null terminated UTF-8 strings. The number of strings stored is returned in the count parameter.
+ * This buffer is allocated using `allocator` and must be freed using it.
+ * \param[out] lengths Returns an array of `count` lengths of the strings returned in `buffer`
+ * This buffer is allocated using `allocator` and must be freed using it.
+ * \param[out] count Number of strings returned. If `binding_ptr` has no bound outputs, zero is returned,
+ * no memory allocation is performed and buffer and lengths are set to nullptr.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetBoundOutputNames, _In_ const OrtIoBinding* binding_ptr, _In_ OrtAllocator* allocator,
+ _Out_ char** buffer, _Out_writes_all_(count) size_t** lengths, _Out_ size_t* count);
+
+ /** \brief Get the output ::OrtValue objects from an ::OrtIoBinding
+ *
+ * Returns an array of pointers to individually allocated ::OrtValue%s that contain results of a model execution with OrtApi::RunWithBinding
+ * The array contains the same number of ::OrtValue%s and they are in the same order as they were bound with OrtApi::BindOutput
+ * or OrtApi::BindOutputToDevice.
+ *
+ * The returned ::OrtValue%s must be released using OrtApi::ReleaseValue after they are no longer needed.
+ * The array is allocated using the specified instance of the allocator and must be freed using the same allocator after
+ * all the ::OrtValue%s contained therein are individually released.
+ *
+ * \param[in] binding_ptr
+ * \param[in] allocator Allocator used to allocate output array
+ * \param[out] output Set to the allocated array of allocated ::OrtValue outputs. Set to nullptr if there are 0 outputs.
+ * \param[out] output_count Set to number of ::OrtValue%s returned
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetBoundOutputValues, _In_ const OrtIoBinding* binding_ptr, _In_ OrtAllocator* allocator,
+ _Out_writes_all_(output_count) OrtValue*** output, _Out_ size_t* output_count);
+
+ /** \brief Clears any previously set Inputs for an ::OrtIoBinding
+ */
+ void(ORT_API_CALL* ClearBoundInputs)(_Inout_ OrtIoBinding* binding_ptr) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
+
+ /** \brief Clears any previously set Outputs for an ::OrtIoBinding
+ */
+ void(ORT_API_CALL* ClearBoundOutputs)(_Inout_ OrtIoBinding* binding_ptr) NO_EXCEPTION ORT_ALL_ARGS_NONNULL;
+
+ /// @}
+ /// \name OrtValue
+ /// @{
+
+ /** \brief Direct memory access to a specified tensor element
+ *
+ * For example, given a tensor with shape of [3,224,224], a pointer to the element at location [2,150,128] can be retrieved
+ *
+ * This function only works for numeric type tensors (No strings, etc).
+ * This is a no-copy method whose returned pointer is valid until the passed in ::OrtValue is free'd.
+ *
+ * \param[in] value
+ * \param[in] location_values Pointer to an array of index values that specify an element's location relative to its shape
+ * \param[in] location_values_count Number of elements in location_values. Must match the number of elements in the tensor's shape.
+ * \param[out] out Set to a pointer to the element specified
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(TensorAt, _Inout_ OrtValue* value, const int64_t* location_values, size_t location_values_count, _Outptr_ void** out);
+
+ /// @}
+ /// \name OrtEnv
+ /// @{
+
+ /** \brief Create an allocator and register it with the ::OrtEnv
+ *
+ * Enables sharing the allocator between multiple sessions that use the same env instance.
+ * Lifetime of the created allocator will be valid for the duration of the environment.
+ * Returns an error if an allocator with the same ::OrtMemoryInfo is already registered.
+ *
+ * See https://onnxruntime.ai/docs/get-started/with-c.html for details.
+ *
+ * \param[in] env ::OrtEnv instance
+ * \param[in] mem_info
+ * \param[in] arena_cfg Pass nullptr for defaults
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateAndRegisterAllocator, _Inout_ OrtEnv* env, _In_ const OrtMemoryInfo* mem_info,
+ _In_ const OrtArenaCfg* arena_cfg);
+
+ /** \brief Set language projection
+ *
+ * Set the language projection for collecting telemetry data when Env is created.
+ *
+ * The default is ORT_PROJECTION_C, which means it will classify the language not in the list to C also.
+ *
+ * \param[in] ort_env
+ * \param[in] projection
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetLanguageProjection, _In_ const OrtEnv* ort_env, _In_ OrtLanguageProjection projection);
+
+ /// @}
+ /// \name OrtSession
+ /// @{
+
+ /** \brief Return the time that profiling was started
+ *
+ * \note The timer precision varies per platform. On Windows and MacOS, the precision will be ~100ns
+ *
+ * \param[in] session
+ * \param[out] out nanoseconds of profiling's start time
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionGetProfilingStartTimeNs, _In_ const OrtSession* session, _Outptr_ uint64_t* out);
+
+ /// @}
+ /// \name OrtThreadingOptions
+ /// @{
+
+ /** \brief Set global intra-op thread count
+ *
+ * This configures the global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools
+ *
+ * \param[in] tp_options
+ * \param[in] intra_op_num_threads Number of threads, special values:<br>
+ * 0 = Use default thread count<br>
+ * 1 = The invoking thread will be used; no threads will be created in the thread pool.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetGlobalIntraOpNumThreads, _Inout_ OrtThreadingOptions* tp_options, int intra_op_num_threads);
+
+ /** \brief Set global inter-op thread count
+ *
+ * This configures the global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools
+ *
+ * \param[in] tp_options
+ * \param[in] inter_op_num_threads Number of threads, special values:<br>
+ * 0 = Use default thread count<br>
+ * 1 = The invoking thread will be used; no threads will be created in the thread pool.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetGlobalInterOpNumThreads, _Inout_ OrtThreadingOptions* tp_options, int inter_op_num_threads);
+
+ /** \brief Set global spin control options
+ *
+ * This will configure the global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools.
+ * Allow spinning of thread pools when their queues are empty. This will set the value for both
+ * inter_op and intra_op threadpools.
+ *
+ * \param[in] tp_options
+ * \param[in] allow_spinning Valid values are 0 or 1.<br>
+ * 0 = It won't spin (recommended if CPU usage is high)<br>
+ * 1 = Threadpool will spin to wait for queue to become non-empty
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetGlobalSpinControl, _Inout_ OrtThreadingOptions* tp_options, int allow_spinning);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /** \brief Add a pre-allocated initializer to a session
+ *
+ * If a model contains an initializer with a name that is same as the name passed to this call,
+ * ORT will use this initializer instance instead of deserializing one from the model file. This
+ * is useful when you want to share the same initializer across sessions.
+ *
+ * \param[in] options
+ * \param[in] name Null terminated string of the initializer name
+ * \param[in] val ::OrtValue containing the initializer. Its lifetime and the underlying initializer buffer must be
+ * managed by the user (created using the OrtApi::CreateTensorWithDataAsOrtValue) and it must outlive the session object
+ * to which it is added.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(AddInitializer, _Inout_ OrtSessionOptions* options, _In_z_ const char* name,
+ _In_ const OrtValue* val);
+
+ /// @}
+ /// \name OrtEnv
+ /// @{
+
+ /**
+ * Create a custom environment with global threadpools and logger that will be shared across sessions.
+ * Use this in conjunction with OrtApi::DisablePerSessionThreads or else the session will use
+ * its own thread pools.
+ *
+ * \param[in] logging_function A pointer to a logging function.
+ * \param[in] logger_param A pointer to arbitrary data passed as the ::OrtLoggingFunction `param` parameter to
+ * `logging_function`.
+ * \param[in] log_severity_level The log severity level.
+ * \param[in] logid The log identifier.
+ * \param[in] tp_options
+ * \param[out] out Newly created OrtEnv. Must be freed with OrtApi::ReleaseEnv
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateEnvWithCustomLoggerAndGlobalThreadPools, OrtLoggingFunction logging_function, _In_opt_ void* logger_param, OrtLoggingLevel log_severity_level,
+ _In_ const char* logid, _In_ const struct OrtThreadingOptions* tp_options, _Outptr_ OrtEnv** out);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /** \brief Append CUDA provider to session options
+ *
+ * If CUDA is not available (due to a non CUDA enabled build, or if CUDA is not installed on the system), this function will return failure.
+ *
+ * \param[in] options
+ * \param[in] cuda_options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_CUDA,
+ _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptions* cuda_options);
+
+ /** \brief Append ROCM execution provider to the session options
+ *
+ * If ROCM is not available (due to a non ROCM enabled build, or if ROCM is not installed on the system), this function will return failure.
+ *
+ * \param[in] options
+ * \param[in] rocm_options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_ROCM,
+ _In_ OrtSessionOptions* options, _In_ const OrtROCMProviderOptions* rocm_options);
+
+ /** \brief Append OpenVINO execution provider to the session options
+ *
+ * If OpenVINO is not available (due to a non OpenVINO enabled build, or if OpenVINO is not installed on the system), this function will fail.
+ *
+ * \param[in] options
+ * \param[in] provider_options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_OpenVINO,
+ _In_ OrtSessionOptions* options, _In_ const OrtOpenVINOProviderOptions* provider_options);
+
+ /// @}
+ /// \name OrtThreadingOptions
+ /// @{
+
+ /** \brief Set threading flush-to-zero and denormal-as-zero
+ *
+ * Sets global thread pool options to be used in the call to OrtApi::CreateEnvWithGlobalThreadPools.
+ * Flush-to-zero and denormal-as-zero are applied to threads in both intra and inter global thread pool.
+ * \note This option is not needed if the models used have no denormals. Having no denormals is recommended as this option may hurt model accuracy.
+ *
+ * \param[in] tp_options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetGlobalDenormalAsZero, _Inout_ OrtThreadingOptions* tp_options);
+
+ /// @}
+ /// \name OrtArenaCfg
+ /// @{
+
+ /** \deprecated Use OrtApi::CreateArenaCfgV2
+ *
+ * This will create the configuration of an arena that can eventually be used to define an arena based allocator's behavior
+ *
+ * \param[in] max_mem Use 0 to allow ORT to choose the default
+ * \param[in] arena_extend_strategy Use -1 to allow ORT to choose the default, 0 = kNextPowerOfTwo, 1 = kSameAsRequested
+ * \param[in] initial_chunk_size_bytes Use -1 to allow ORT to choose the default
+ * \param[in] max_dead_bytes_per_chunk Use -1 to allow ORT to choose the default
+ * \param[in] out A pointer to an OrtArenaCfg instance
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateArenaCfg, _In_ size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes,
+ int max_dead_bytes_per_chunk, _Outptr_ OrtArenaCfg** out);
+
+ ORT_CLASS_RELEASE(ArenaCfg);
+
+ /// @}
+ /// \name OrtModelMetadata
+ /// @{
+
+ /**
+ * Use this to obtain the description of the graph present in the model
+ * (doc_string field of the GraphProto message within the ModelProto message).
+ * If it doesn't exist, an empty string will be returned.
+ *
+ * \param[in] model_metadata An instance of ::OrtModelMetadata
+ * \param[in] allocator Allocator used to allocate the string that will be returned back
+ * \param[out] value Set to a null terminated string allocated using `allocator`. The caller is responsible for freeing it using `allocator`
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(ModelMetadataGetGraphDescription, _In_ const OrtModelMetadata* model_metadata,
+ _Inout_ OrtAllocator* allocator, _Outptr_ char** value);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /** \brief Append TensorRT provider to session options
+ *
+ * If TensorRT is not available (due to a non TensorRT enabled build, or if TensorRT is not installed on the system), this function will return failure.
+ *
+ * \param[in] options
+ * \param[in] tensorrt_options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_TensorRT,
+ _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptions* tensorrt_options);
+
+ /// @}
+ /// \name Misc
+ /// @{
+
+ /** \brief Set current GPU device ID
+ *
+ * Set the current device id of the GPU execution provider (CUDA/tensorrt/rocm). The device id should be less
+ * than the total number of devices available. This is only useful when multiple-GPUs are installed and it is
+ * required to restrict execution to a single GPU.
+ *
+ * \param[in] device_id
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetCurrentGpuDeviceId, _In_ int device_id);
+
+ /** \brief Get current GPU device ID
+ *
+ * Get the current device id of the GPU execution provider (CUDA/tensorrt/rocm).
+ *
+ * \see OrtApi::SetCurrentGpuDeviceId
+ *
+ * \param[out] device_id
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetCurrentGpuDeviceId, _In_ int* device_id);
+
+ /// @}
+ /// \name OrtKernelInfo
+ /// Custom operator APIs.
+ /// @{
+
+ /** \brief Fetch an array of int64_t values stored as an attribute in the graph node
+ *
+ *
+ * If `out` is nullptr, the value of `size` is set to the true size of the attribute
+ * array's size, and a success status is returned.
+ *
+ * If the `size` parameter is greater than or equal to the actual attribute array's size,
+ * the value of `size` is set to the true size of the attribute array's size,
+ * the provided memory is filled with the attribute's contents,
+ * and a success status is returned.
+ *
+ * If the `size` parameter is less than the actual attribute array's size and `out`
+ * is not nullptr, the value of `size` is set to the true size of the attribute array's size
+ * and a failure status is returned.)
+ *
+ * \param[in] info instance
+ * \param[in] name name of the attribute to be parsed
+ * \param[out] out pointer to memory where the attribute's contents are to be stored
+ * \param[in, out] size actual size of attribute array
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(KernelInfoGetAttributeArray_float, _In_ const OrtKernelInfo* info, _In_ const char* name,
+ _Out_ float* out, _Inout_ size_t* size);
+
+ /** \brief Fetch an array of int64_t values stored as an attribute in the graph node
+ *
+ * If `out` is nullptr, the value of `size` is set to the true size of the attribute
+ * array's size, and a success status is returned.
+ *
+ * If the `size` parameter is greater than or equal to the actual attribute array's size,
+ * the value of `size` is set to the true size of the attribute array's size,
+ * the provided memory is filled with the attribute's contents,
+ * and a success status is returned.
+ *
+ * If the `size` parameter is less than the actual attribute array's size and `out`
+ * is not nullptr, the value of `size` is set to the true size of the attribute array's size
+ * and a failure status is returned.)
+ *
+ * \param[in] info instance
+ * \param[in] name name of the attribute to be parsed
+ * \param[out] out pointer to memory where the attribute's contents are to be stored
+ * \param[in, out] size actual size of attribute array
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(KernelInfoGetAttributeArray_int64, _In_ const OrtKernelInfo* info, _In_ const char* name,
+ _Out_ int64_t* out, _Inout_ size_t* size);
+
+ /// @}
+ /// \name OrtArenaCfg
+ /// @{
+
+ /** \brief Create an ::OrtArenaCfg
+ *
+ * Create the configuration of an arena that can eventually be used to define an arena based allocator's behavior.
+ *
+ * Supported keys are (See https://onnxruntime.ai/docs/get-started/with-c.html for details on what the
+ * following parameters mean and how to choose these values.):
+ * "max_mem": Maximum memory that can be allocated by the arena based allocator.
+ * Use 0 for ORT to pick the best value. Default is 0.
+ * "arena_extend_strategy": 0 = kNextPowerOfTwo, 1 = kSameAsRequested.
+ * Use -1 to allow ORT to choose the default.
+ * "initial_chunk_size_bytes": (Possible) Size of the first allocation in the arena.
+ * Only relevant if arena strategy is `kNextPowerOfTwo`. Use -1 to allow ORT to choose the default.
+ * Ultimately, the first allocation size is determined by the allocation memory request.
+ * "max_dead_bytes_per_chunk": Threshold of unused memory in an allocated chunk of arena memory after
+ * crossing which the current chunk is chunked into 2.
+ * "initial_growth_chunk_size_bytes": (Possible) Size of the second allocation in the arena.
+ * Only relevant if arena strategy is `kNextPowerOfTwo`. Use -1 to allow ORT to choose the default.
+ * "max_power_of_two_extend_bytes": The maximum enxtend size if arena strategy is `kNextPowerOfTwo`.
+ * It is not an allocation limit, it is only a limit for extension when requested byte is less than the limit.
+ * When requested bytes is more than the limit, allocator will still return as requested.
+ * Use -1 to allow ORT to choose the default 1GB for max_power_of_two_extend_bytes.
+ * Ultimately, the allocation size is determined by the allocation memory request.
+ * Further allocation sizes are governed by the arena extend strategy.
+ *
+ * \param[in] arena_config_keys Keys to configure the arena
+ * \param[in] arena_config_values Values to configure the arena
+ * \param[in] num_keys Number of keys in `arena_config_keys` and `arena_config_values`
+ * \param[out] out Newly created ::OrtArenaCfg. Must be freed with OrtApi::ReleaseArenaCfg
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateArenaCfgV2, _In_reads_(num_keys) const char* const* arena_config_keys,
+ _In_reads_(num_keys) const size_t* arena_config_values, _In_ size_t num_keys,
+ _Outptr_ OrtArenaCfg** out);
+
+ /// @}
+ /// \name OrtRunOptions
+ /// @{
+
+ /** \brief Set a single run configuration entry as a pair of strings
+ *
+ * If a configuration with same key exists, this will overwrite the configuration with the given config_value
+ *
+ * The config_key and the format of config_value are defined in onnxruntime_run_options_config_keys.h
+ *
+ * \param[in] options
+ * \param[in] config_key A null terminated string representation of the config key
+ * \param[in] config_value A null terminated string representation of the config value
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(AddRunConfigEntry, _Inout_ OrtRunOptions* options,
+ _In_z_ const char* config_key, _In_z_ const char* config_value);
+
+ /// @}
+ /// \name OrtPrepackedWeightsContainer
+ /// @{
+
+ /** \brief Create an ::OrtPrepackedWeightsContainer
+ *
+ * This container will hold pre-packed buffers of shared initializers for sharing between sessions
+ * (i.e.) if there are shared initializers that can be shared between sessions, the pre-packed buffers
+ * of these (if any) may possibly be shared to provide memory footprint savings. Pass this container
+ * to sessions that you would like to share pre-packed buffers of shared initializers at session
+ * creation time.
+ *
+ * \param[out] out Newly created ::OrtPrepackedWeightsContainer. Must be freed with OrtApi::ReleasePrepackedWeightsContainer
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreatePrepackedWeightsContainer, _Outptr_ OrtPrepackedWeightsContainer** out);
+
+ /** \brief Release OrtPrepackedWeightsContainer instance
+ *
+ * \note instance must not be released until the sessions using it are released
+ */
+ ORT_CLASS_RELEASE(PrepackedWeightsContainer);
+
+ /// @}
+ /// \name OrtSession
+ /// @{
+
+ /** \brief Create session with prepacked weights container
+ *
+ * Same functionality offered by OrtApi::CreateSession except that a container that contains
+ * pre-packed weights' buffers is written into/read from by the created session.
+ * This is useful when used in conjunction with OrtApi::AddInitializer which injects
+ * shared initializer info into sessions. Wherever possible, the pre-packed versions of these
+ * shared initializers are cached in this container so that multiple sessions can just re-use
+ * these instead of duplicating these in memory.
+ *
+ * \param[in] env OrtEnv instance instance
+ * \param[in] model_path Null terminated string of the path (wchar on Windows, char otherwise)
+ * \param[in] options
+ * \param[in] prepacked_weights_container
+ * \param[out] out Newly created ::OrtSession. Must be freed with OrtApi::ReleaseSession
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateSessionWithPrepackedWeightsContainer, _In_ const OrtEnv* env, _In_ const ORTCHAR_T* model_path,
+ _In_ const OrtSessionOptions* options, _Inout_ OrtPrepackedWeightsContainer* prepacked_weights_container,
+ _Outptr_ OrtSession** out);
+
+ /** \brief Create session from memory with prepacked weights container
+ *
+ * Same functionality offered by OrtApi::CreateSessionFromArray except that a container that contains
+ * pre-packed weights' buffers is written into/read from by the created session.
+ * This is useful when used in conjunction with OrtApi::AddInitializer which injects
+ * shared initializer info into sessions. Wherever possible, the pre-packed versions of these
+ * shared initializers are cached in this container so that multiple sessions can just re-use
+ * these instead of duplicating these in memory.
+ *
+ * \param[in] env
+ * \param[in] model_data Array of bytes holding the model
+ * \param[in] model_data_length Number of bytes in `model_data_model`
+ * \param[in] options
+ * \param[in] prepacked_weights_container
+ * \param[out] out Newly created ::OrtSession. Must be freed with OrtApi::ReleaseSession
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateSessionFromArrayWithPrepackedWeightsContainer, _In_ const OrtEnv* env,
+ _In_ const void* model_data, size_t model_data_length,
+ _In_ const OrtSessionOptions* options, _Inout_ OrtPrepackedWeightsContainer* prepacked_weights_container,
+ _Outptr_ OrtSession** out);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /** \brief Append TensorRT execution provider to the session options
+ *
+ * If TensorRT is not available (due to a non TensorRT enabled build), this function will return failure.
+ *
+ * This is slightly different from OrtApi::SessionOptionsAppendExecutionProvider_TensorRT, it takes an
+ * ::OrtTensorRTProviderOptions which is publicly defined. This takes an opaque ::OrtTensorRTProviderOptionsV2
+ * which must be created with OrtApi::CreateTensorRTProviderOptions.
+ *
+ * For OrtApi::SessionOptionsAppendExecutionProvider_TensorRT, the user needs to instantiate ::OrtTensorRTProviderOptions
+ * as well as allocate/release buffers for some members of ::OrtTensorRTProviderOptions.
+ * Here, OrtApi::CreateTensorRTProviderOptions and Ortapi::ReleaseTensorRTProviderOptions will do the memory management for you.
+ *
+ * \param[in] options
+ * \param[in] tensorrt_options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_TensorRT_V2,
+ _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options);
+
+ /// @}
+ /// \name OrtTensorRTProviderOptionsV2
+ /// @{
+
+ /** \brief Create an OrtTensorRTProviderOptionsV2
+ *
+ * \param[out] out Newly created ::OrtTensorRTProviderOptionsV2. Must be released with OrtApi::ReleaseTensorRTProviderOptions
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateTensorRTProviderOptions, _Outptr_ OrtTensorRTProviderOptionsV2** out);
+
+ /** \brief Set options in a TensorRT Execution Provider.
+ *
+ * Please refer to https://onnxruntime.ai/docs/execution-providers/TensorRT-ExecutionProvider.html#cc
+ * to know the available keys and values. Key should be in null terminated string format of the member of ::OrtTensorRTProviderOptionsV2
+ * and value should be its related range. Recreates the options and only sets the supplied values.
+ *
+ * For example, key="trt_max_workspace_size" and value="2147483648"
+ *
+ * \param[in] tensorrt_options
+ * \param[in] provider_options_keys Array of UTF-8 null-terminated string for provider options keys
+ * \param[in] provider_options_values Array of UTF-8 null-terminated string for provider options values
+ * \param[in] num_keys Number of elements in the `provider_option_keys` and `provider_options_values` arrays
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(UpdateTensorRTProviderOptions, _Inout_ OrtTensorRTProviderOptionsV2* tensorrt_options,
+ _In_reads_(num_keys) const char* const* provider_options_keys,
+ _In_reads_(num_keys) const char* const* provider_options_values,
+ _In_ size_t num_keys);
+
+ /** \brief Get serialized TensorRT provider options string.
+ *
+ * For example, "trt_max_workspace_size=2147483648;trt_max_partition_iterations=10;trt_int8_enable=1;......"
+ *
+ * \param tensorrt_options - OrtTensorRTProviderOptionsV2 instance
+ * \param allocator - a ptr to an instance of OrtAllocator obtained with OrtApi::CreateAllocator or OrtApi::GetAllocatorWithDefaultOptions
+ * the specified allocator will be used to allocate continuous buffers for output strings and lengths.
+ * \param ptr - is a UTF-8 null terminated string allocated using 'allocator'. The caller is responsible for using the same allocator to free it.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetTensorRTProviderOptionsAsString, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
+
+ /** \brief Release an ::OrtTensorRTProviderOptionsV2
+ *
+ * \note This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does
+ */
+ void(ORT_API_CALL* ReleaseTensorRTProviderOptions)(_Frees_ptr_opt_ OrtTensorRTProviderOptionsV2* input);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /** \brief Enable custom operators
+ *
+ * See onnxruntime-extensions: https://github.com/microsoft/onnxruntime-extensions.git
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(EnableOrtCustomOps, _Inout_ OrtSessionOptions* options);
+
+ /// @}
+ /// \name OrtAllocator
+ /// @{
+
+ /** \brief Register a custom allocator
+ *
+ * Enables sharing between multiple sessions that use the same env instance.
+ * Returns an error if an allocator with the same ::OrtMemoryInfo is already registered.
+ *
+ * The behavior of this is exactly the same as OrtApi::CreateAndRegisterAllocator except
+ * instead of ORT creating an allocator based on provided info, in this case
+ * ORT uses the user-provided custom allocator.
+ * See https://onnxruntime.ai/docs/get-started/with-c.html for details.
+ *
+ * \param[in] env
+ * \param[in] allocator User provided allocator
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(RegisterAllocator, _Inout_ OrtEnv* env, _In_ OrtAllocator* allocator);
+
+ /** \brief Unregister a custom allocator
+ *
+ * It is an error if you provide an ::OrtMemoryInfo not corresponding to any
+ * registered allocators for sharing.
+ *
+ * \param[in] env
+ * \param[in] mem_info
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(UnregisterAllocator, _Inout_ OrtEnv* env,
+ _In_ const OrtMemoryInfo* mem_info);
+
+ /// @}
+ /// \name OrtValue
+ /// @{
+
+ /** \brief Sets *out to 1 iff an ::OrtValue is a SparseTensor, and 0 otherwise
+ *
+ * \param[in] value existing ::OrtValue
+ * \param[out] out unless an error occurs, contains 1 iff the value contains an instance
+ * of sparse tensor or 0 otherwise.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(IsSparseTensor, _In_ const OrtValue* value, _Out_ int* out);
+
+ /** \brief Create an ::OrtValue with a sparse tensor that is empty.
+ *
+ * Use FillSparseTensor<Format>() functions to populate sparse tensor with non-zero values and
+ * format specific indices data.
+ * Use ReleaseValue to destroy the sparse tensor, this will also release the buffer inside the output value
+ * if any was allocated.
+ * \param[in,out] allocator allocator to use when performing an allocation. Allocation will be performed
+ * by FillSparseTensor<Format>() APIs. The lifespan of the allocator instance must eclipse the lifespan
+ * this sparse tensor instance as the same allocator will be used to free memory.
+ * \param[in] dense_shape shape of the original dense tensor
+ * \param[in] dense_shape_len number of shape dimensions being passed
+ * \param[in] type must be one of TENSOR_ELEMENT_DATA_TYPE_xxxx
+ * \param[out] out Should be freed by calling ReleaseValue
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateSparseTensorAsOrtValue, _Inout_ OrtAllocator* allocator, _In_ const int64_t* dense_shape,
+ size_t dense_shape_len, ONNXTensorElementDataType type, _Outptr_ OrtValue** out);
+
+ /**
+ * This fills populates an empty tensor that was created using OrtApi::CreateSparseTensorAsOrtValue.
+ * This will allocate required memory and copy the supplied NNZ values and COO indices into that memory allocation.
+ * Memory allocation is performed using the allocator that was specified with OrtApi::CreateSparseTensorAsOrtValue.
+ *
+ * \param[in,out] ort_value ::OrtValue to populate with data
+ * \param[in] data_mem_info serves to identify the location of the data to be copied. If the allocator specified
+ * at the creation time has memory info that is not the same as mem_info argument to this function a X-device copy will be performed.
+ * String data is assumed to be on CPU and will only be copied into a CPU allocated buffer.
+ * \param[in] values_shape pointer to values shape array
+ * \param[in] values_shape_len length of the values_shape
+ * \param[in] values pointer to an array of values. For strings, pass const char**.
+ * \param[in] indices_data pointer to a location of COO indices
+ * \param[in] indices_num number of COO indices
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(FillSparseTensorCoo, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
+ _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
+ _In_ const int64_t* indices_data, size_t indices_num);
+
+ /**
+ * This fills populates an empty tensor that was created using OrtApi::CreateSparseTensorAsOrtValue.
+ * This will allocate required memory and copy the supplied NNZ values and CSR indices into that memory allocation.
+ * Memory allocation is performed using the allocator that was specified with OrtApi::CreateSparseTensorAsOrtValue.
+ *
+ * \param[in,out] ort_value ::OrtValue to populate with data
+ * \param[in] data_mem_info serves to identify the location of the data to be copied. If the allocator specified
+ * at the creation time has memory info that is not the same as mem_info argument to this function a X-device copy will be performed.
+ * String data is assumed to be on CPU and will only be copied into a CPU allocated buffer.
+ * \param[in] values_shape pointer to values shape array
+ * \param[in] values_shape_len length of the values_shape
+ * \param[in] values - pointer to an array of values. For strings, pass const char**.
+ * \param[in] inner_indices_data pointer to a location of CSR inner indices
+ * \param[in] inner_indices_num number of CSR inner indices
+ * \param[in] outer_indices_data pointer to a location of CSR outer indices
+ * \param[in] outer_indices_num number of CSR outer indices
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(FillSparseTensorCsr, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
+ _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
+ _In_ const int64_t* inner_indices_data, size_t inner_indices_num,
+ _In_ const int64_t* outer_indices_data, size_t outer_indices_num);
+
+ /**
+ * This fills populates an empty tensor that was created using OrtApi::CreateSparseTensorAsOrtValue.
+ * This will allocate required memory and copy the supplied NNZ values and BlockSparse indices into that memory allocation.
+ * Memory allocation is performed using the allocator that was specified with OrtApi::CreateSparseTensorAsOrtValue.
+ *
+ * \param[in,out] ort_value ::OrtValue to populate with data
+ * \param[in] data_mem_info serves to identify the location of the data to be copied. If the allocator specified
+ * at the creation time has memory info that is not the same as mem_info argument to this function a X-device copy will be performed.
+ * String data is assumed to be on CPU and will only be copied into a CPU allocated buffer.
+ * \param[in] values_shape
+ * \param[in] values_shape_len
+ * \param[in] values structure with values information
+ * \param[in] indices_shape_data pointer to a location of indices shape
+ * \param[in] indices_shape_len length of the block sparse indices shape
+ * \param[in] indices_data pointer to a location of indices data. Shape will determine the length of the indices data.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(FillSparseTensorBlockSparse, _Inout_ OrtValue* ort_value, _In_ const OrtMemoryInfo* data_mem_info,
+ _In_ const int64_t* values_shape, size_t values_shape_len, _In_ const void* values,
+ _In_ const int64_t* indices_shape_data, size_t indices_shape_len,
+ _In_ const int32_t* indices_data);
+
+ /**
+ * Create an ::OrtValue with a sparse tensor. This is the first step.
+ * Next, use Use<Format>Indices() functions to supply sparse tensor with
+ * format specific indices data and set its sparse format to a specific enum value.
+ * This will not perform memory allocations. It will
+ * use supplied user buffer which should outlive the created sparse tensor.
+ * Use OrtApi::ReleaseValue to destroy the sparse tensor. It would not release the supplied values buffer.
+ * This function can not be used to map strings from the user allocated memory. Strings must always be copied
+ * and have UTF-8 encoding. Therefore, use OrtApi::CreateSparseTensorAsOrtValue above and then fill it with data
+ * using appropriate Make*() function.
+ *
+ * \param[in] info memory info where sparse values reside.
+ * \param[in,out] p_data pointer to a user allocated buffer with values. To create a full sparse tensor with no non-zero
+ * values, pass nullptr
+ * \param[in] dense_shape shape of the original dense tensor
+ * \param[in] dense_shape_len number of shape dimensions being passed
+ * \param[in] values_shape shape of the values data. To create a fully sparse tensor with no non-zero values,
+ * pass {0} shape.
+ * \param[in] values_shape_len number of values shape dimensions
+ * \param[in] type must be one of TENSOR_ELEMENT_DATA_TYPE_xxxx
+ * \param[out] out Should be freed by calling ReleaseValue
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(CreateSparseTensorWithValuesAsOrtValue, _In_ const OrtMemoryInfo* info, _Inout_ void* p_data,
+ _In_ const int64_t* dense_shape, size_t dense_shape_len,
+ _In_ const int64_t* values_shape, size_t values_shape_len,
+ ONNXTensorElementDataType type, _Outptr_ OrtValue** out);
+
+ /**
+ * This assigns Coo format indices to the SparseTensor that was created by
+ * OrtApi::CreateSparseTensorWithValuesAsOrtValue above. It also sets OrtSparseFormat to
+ * ORT_SPARSE_COO. This will not allocate any additional memory for data. The life span of
+ * indices_data buffer should eclipse the life span of this ::OrtValue.
+ *
+ * \param[in,out] ort_value ::OrtValue instance constructed with OrtApi::CreateSparseTensorWithValuesAsOrtValue
+ * \param[in,out] indices_data pointer to a user pre-allocated buffer or nullptr for fully sparse tensors.
+ * \param[in] indices_num number of COO indices. Should either be 0 for fully sparse tensors, be equal
+ * to the number of nnz values specified to OrtApi::CreateSparseTensorWithValuesAsOrtValue for 1-D {nnz} indices or
+ * be twice as number of nnz values for a 2-D indices {nnz, 2}
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(UseCooIndices, _Inout_ OrtValue* ort_value, _Inout_ int64_t* indices_data, size_t indices_num);
+
+ /**
+ * The assigns CSR format indices to the SparseTensor that was created by
+ * OrtApi::CreateSparseTensorWithValuesAsOrtValue above. It also sets OrtSparseFormat to
+ * ORT_SPARSE_CSRC. This will not allocate any additional memory for data. The life spans of
+ * inner_data and outer_data buffers should eclipse the life span of this ::OrtValue.
+ *
+ * \param[in,out] ort_value ::OrtValue instance constructed with OrtApi::CreateSparseTensorWithValuesAsOrtValue
+ * \param[in,out] inner_data pointer to a user pre-allocated buffer or nullptr for fully sparse tensors.
+ * \param[in] inner_num number of inner CSR indices. Should either be 0 for fully sparse tensors or be equal
+ * to the number of nnz values specified to OrtApi::CreateSparseTensorWithValuesAsOrtValue.
+ * \param[in,out] outer_data pointer to user pre-allocated buffer or nullptr for fully sparse tensors.
+ * \param[in] outer_num number of CSR outer indices. Should either be 0 for fully sparse tensors or
+ * equal to rows + 1 of the dense shape.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(UseCsrIndices, _Inout_ OrtValue* ort_value, _Inout_ int64_t* inner_data, size_t inner_num,
+ _Inout_ int64_t* outer_data, size_t outer_num);
+
+ /**
+ * The assigns BlockSparse format indices to the SparseTensor that was created by
+ * OrtApi::CreateSparseTensorWithValuesAsOrtValue above. It also sets OrtSparseFormat to
+ * ORT_SPARSE_BLOCK_SPARSE. This will not allocate any additional memory for data. The life span of
+ * indices_data buffer must eclipse the lifespan of this ::OrtValue.
+ *
+ * \param[in,out] ort_value OrtValue instance constructed with OrtApi::CreateSparseTensorWithValuesAsOrtValue
+ * \param[in] indices_shape pointer to indices shape. Use {0} for fully sparse tensors
+ * \param[in] indices_shape_len length of the indices shape
+ * \param[in,out] indices_data pointer to user pre-allocated buffer or nullptr for fully sparse tensors.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(UseBlockSparseIndices, _Inout_ OrtValue* ort_value, const int64_t* indices_shape, size_t indices_shape_len, _Inout_ int32_t* indices_data);
+
+ /** \brief Returns sparse tensor format enum iff a given ort value contains an instance of sparse tensor.
+ *
+ * \param[in] ort_value ::OrtValue that contains an instance of sparse tensor
+ * \param[out] out pointer to out parameter
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetSparseTensorFormat, _In_ const OrtValue* ort_value, _Out_ enum OrtSparseFormat* out);
+
+ /** \brief Returns data type and shape of sparse tensor values (nnz) iff ::OrtValue contains a SparseTensor.
+ *
+ * \param[in] ort_value An ::OrtValue that contains a fully constructed sparse tensor
+ * \param[out] out Must be freed by OrtApi::ReleaseTensorTypeAndShapeInfo
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetSparseTensorValuesTypeAndShape, _In_ const OrtValue* ort_value, _Outptr_ OrtTensorTypeAndShapeInfo** out);
+
+ /** \brief Returns numeric data for sparse tensor values (nnz). For string values use GetStringTensor*().
+ *
+ * \param[in] ort_value an instance of ::OrtValue containing sparse tensor
+ * \param[out] out returns a pointer to values data. Do not attempt to free this ptr.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetSparseTensorValues, _In_ const OrtValue* ort_value, _Outptr_ const void** out);
+
+ /** \brief Returns data type, shape for the type of indices specified by indices_format.
+ *
+ * \param[in] ort_value ::OrtValue containing sparse tensor.
+ * \param[in] indices_format One of the indices formats. It is an error to request a format that the sparse
+ * tensor does not contain.
+ * \param[out] out an instance of ::OrtTensorTypeAndShapeInfo. Must be freed by OrtApi::ReleaseTensorTypeAndShapeInfo
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetSparseTensorIndicesTypeShape, _In_ const OrtValue* ort_value, enum OrtSparseIndicesFormat indices_format, _Outptr_ OrtTensorTypeAndShapeInfo** out);
+
+ /** \brief Returns indices data for the type of the indices specified by indices_format
+ *
+ * \param[in] ort_value ::OrtValue containing sparse tensor.
+ * \param[in] indices_format One of the indices formats. It is an error to request a format that the sparse tensor does not contain.
+ * \param[out] num_indices Pointer to where the number of indices entries is returned
+ * \param[out] indices Returned pointer to the indices data. Do not free the returned pointer as it refers to internal data owned by the ::OrtValue
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetSparseTensorIndices, _In_ const OrtValue* ort_value, enum OrtSparseIndicesFormat indices_format, _Out_ size_t* num_indices, _Outptr_ const void** indices);
+ /// @}
+ /// \name OrtSessionOptions
+ /// @{
+
+ /**
+ * \brief Sets out to 1 iff an optional type OrtValue has an element, 0 otherwise (OrtValue is None)
+ * Use this API to find if the optional type OrtValue is None or not.
+ * If the optional type OrtValue is not None, use the OrtValue just like any other OrtValue.
+ * For example, if you get an OrtValue that corresponds to Optional(tensor) and
+ * if HasValue() returns true, use it as tensor and so on.
+
+ * \param[in] value Input OrtValue.
+ * \param[out] out indicating if the input OrtValue contains data (1) or if it is a None (0)
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(HasValue, _In_ const OrtValue* value, _Out_ int* out);
+
+ /// @}
+ /// \name OrtKernelContext
+ /// Custom operator APIs.
+ /// @{
+
+ /** \brief Used for custom operators, gets the GPU compute stream to use to launch the custom a GPU kernel
+ * \see ::OrtCustomOp
+ * \param[in] context OrtKernelContext instance
+ * \param[out] out Returns pointer to a GPU compute stream that can be used to launch the custom GPU kernel.
+ * If retrieving the GPU compute stream is not relevant (GPU not enabled in the build, kernel partitioned to
+ * some other EP), then a nullptr is returned as the output param.
+ * Do not free or mutate the returned pointer as it refers to internal data owned by the underlying session.
+ * Only use it for custom kernel launching.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(KernelContext_GetGPUComputeStream, _In_ const OrtKernelContext* context, _Outptr_ void** out);
+
+ /// @}
+ /// \name GetTensorMemoryInfo
+ /// @{
+ /** \brief Returns a pointer to the ::OrtMemoryInfo of a Tensor
+ * \param[in] value ::OrtValue containing tensor.
+ * \param[out] mem_info ::OrtMemoryInfo of the tensor. Do NOT free the returned pointer. It is valid for the lifetime of the ::OrtValue
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetTensorMemoryInfo, _In_ const OrtValue* value, _Out_ const OrtMemoryInfo** mem_info);
+
+ /// @}
+ /// \name GetExecutionProviderApi
+ /// @{
+ /** \brief Get a pointer to the requested version of the Execution Provider specific
+ * API extensions to the OrtApi
+ * \param[in] provider_name The name of the execution provider name. Currently only the following
+ * values are supported: "DML".
+ * \param[in] version Must be ::ORT_API_VERSION.
+ * \param[out] provider_api A void pointer containing a reference to the execution provider versioned api structure.
+ * For example, the provider_api pointer can be cast to the OrtDmlApi* when the provider_name is "DML".
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetExecutionProviderApi, _In_ const char* provider_name, _In_ uint32_t version, _Outptr_ const void** provider_api);
+
+ /// @}
+
+ /// \name SessionOptions
+ /// @{
+ /** \brief Set custom thread creation function
+ *
+ * \param[in] options Session options
+ * \param[in] ort_custom_create_thread_fn Custom thread creation function
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionOptionsSetCustomCreateThreadFn, _Inout_ OrtSessionOptions* options, _In_ OrtCustomCreateThreadFn ort_custom_create_thread_fn);
+
+ /** \brief Set creation options for custom thread
+ *
+ * \param[in] options Session options
+ * \param[in] ort_custom_thread_creation_options Custom thread creation options (can be nullptr)
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionOptionsSetCustomThreadCreationOptions, _Inout_ OrtSessionOptions* options, _In_ void* ort_custom_thread_creation_options);
+
+ /** \brief Set custom thread join function
+ *
+ * \param[in] options Session options
+ * \param[in] ort_custom_join_thread_fn Custom join thread function, must not be nullptr when ort_custom_create_thread_fn is set
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SessionOptionsSetCustomJoinThreadFn, _Inout_ OrtSessionOptions* options, _In_ OrtCustomJoinThreadFn ort_custom_join_thread_fn);
+ /// @}
+
+ /// \name OrtThreadingOptions
+ /// @{
+ /** \brief Set custom thread creation function for global thread pools
+ *
+ * \param[inout] tp_options
+ * \param[in] ort_custom_create_thread_fn Custom thread creation function
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetGlobalCustomCreateThreadFn, _Inout_ OrtThreadingOptions* tp_options, _In_ OrtCustomCreateThreadFn ort_custom_create_thread_fn);
+
+ /** \brief Set custom thread creation options for global thread pools
+ *
+ * \param[inout] tp_options
+ * \param[in] ort_custom_thread_creation_options Custom thread creation options (can be nullptr)
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetGlobalCustomThreadCreationOptions, _Inout_ OrtThreadingOptions* tp_options, _In_ void* ort_custom_thread_creation_options);
+
+ /** \brief Set custom thread join function for global thread pools
+ *
+ * \param[inout] tp_options
+ * \param[in] ort_custom_join_thread_fn Custom thread join function, must not be nullptr when global ort_custom_create_thread_fn is set
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SetGlobalCustomJoinThreadFn, _Inout_ OrtThreadingOptions* tp_options, _In_ OrtCustomJoinThreadFn ort_custom_join_thread_fn);
+ /// @}
+
+ /** \brief Synchronize bound inputs. The call may be necessary for some providers, such as cuda,
+ * in case the system that allocated bound memory operated on a different stream. However, the
+ * operation is provider specific and could be a no-op.
+ *
+ * \param[inout] binding_ptr
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SynchronizeBoundInputs, _Inout_ OrtIoBinding* binding_ptr);
+
+ /** \brief Synchronize bound outputs. The call may be necessary for some providers, such as cuda,
+ * in case the system that allocated bound memory operated on a different stream. However, the
+ * operation is provider specific and could be a no-op.
+ *
+ * \param[inout] binding_ptr
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(SynchronizeBoundOutputs, _Inout_ OrtIoBinding* binding_ptr);
+
+ /// \name OrtSessionOptions
+ /// @{
+
+ /** \brief Append CUDA execution provider to the session options
+ *
+ * If CUDA is not available (due to a non CUDA enabled build), this function will return failure.
+ *
+ * This is slightly different from OrtApi::SessionOptionsAppendExecutionProvider_CUDA, it takes an
+ * ::OrtCUDAProviderOptions which is publicly defined. This takes an opaque ::OrtCUDAProviderOptionsV2
+ * which must be created with OrtApi::CreateCUDAProviderOptions.
+ *
+ * For OrtApi::SessionOptionsAppendExecutionProvider_CUDA, the user needs to instantiate ::OrtCUDAProviderOptions
+ * as well as allocate/release buffers for some members of ::OrtCUDAProviderOptions.
+ * Here, OrtApi::CreateCUDAProviderOptions and Ortapi::ReleaseCUDAProviderOptions will do the memory management for you.
+ *
+ * \param[in] options
+ * \param[in] cuda_options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.11.
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_CUDA_V2,
+ _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptionsV2* cuda_options);
+
+ /// @}
+ /// \name OrtCUDAProviderOptionsV2
+ /// @{
+
+ /** \brief Create an OrtCUDAProviderOptionsV2
+ *
+ * \param[out] out Newly created ::OrtCUDAProviderOptionsV2. Must be released with OrtApi::ReleaseCudaProviderOptions
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.11.
+ */
+ ORT_API2_STATUS(CreateCUDAProviderOptions, _Outptr_ OrtCUDAProviderOptionsV2** out);
+
+ /** \brief Set options in a CUDA Execution Provider.
+ *
+ * Please refer to https://onnxruntime.ai/docs/execution-providers/CUDA-ExecutionProvider.html#configuration-options
+ * to know the available keys and values. Key should be in null terminated string format of the member of ::OrtCUDAProviderOptionsV2
+ * and value should be its related range. Recreates the options and only sets the supplied values.
+ *
+ * For example, key="device_id" and value="0"
+ *
+ * \param[in] cuda_options
+ * \param[in] provider_options_keys Array of UTF-8 null-terminated string for provider options keys
+ * \param[in] provider_options_values Array of UTF-8 null-terminated string for provider options values
+ * \param[in] num_keys Number of elements in the `provider_option_keys` and `provider_options_values` arrays
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.11.
+ */
+ ORT_API2_STATUS(UpdateCUDAProviderOptions, _Inout_ OrtCUDAProviderOptionsV2* cuda_options,
+ _In_reads_(num_keys) const char* const* provider_options_keys,
+ _In_reads_(num_keys) const char* const* provider_options_values,
+ _In_ size_t num_keys);
+
+ /**
+ * Get serialized CUDA provider options string.
+ *
+ * For example, "device_id=0;arena_extend_strategy=0;......"
+ *
+ * \param cuda_options - OrtCUDAProviderOptionsV2 instance
+ * \param allocator - a ptr to an instance of OrtAllocator obtained with CreateAllocator() or GetAllocatorWithDefaultOptions()
+ * the specified allocator will be used to allocate continuous buffers for output strings and lengths.
+ * \param ptr - is a UTF-8 null terminated string allocated using 'allocator'. The caller is responsible for using the same allocator to free it.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.11.
+ */
+ ORT_API2_STATUS(GetCUDAProviderOptionsAsString, _In_ const OrtCUDAProviderOptionsV2* cuda_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
+
+ /** \brief Release an ::OrtCUDAProviderOptionsV2
+ *
+ * \note This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does
+ *
+ * \since Version 1.11.
+ */
+ void(ORT_API_CALL* ReleaseCUDAProviderOptions)(_Frees_ptr_opt_ OrtCUDAProviderOptionsV2* input);
+
+ /// @}
+
+ /** \brief Append MIGraphX provider to session options
+ *
+ * If MIGraphX is not available (due to a non MIGraphX enabled build, or if MIGraphX is not installed on the system), this function will return failure.
+ *
+ * \param[in] options
+ * \param[in] migraphx_options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.11.
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_MIGraphX,
+ _In_ OrtSessionOptions* options, _In_ const OrtMIGraphXProviderOptions* migraphx_options);
+
+ /** \brief Replace initialized Tensors with external data with the data provided in initializers.
+ *
+ * The function will find the initialized TensorProtos with external data in the graph with the provided names and
+ * replace them with the provided tensors. The API verifies that the TensorProto being replaced
+ * has an external data reference and has the same name, dimensions and data type as its replacement. The replacement
+ * will occur before any of the optimizations take place. The data will be copied into the graph
+ * since TensorProto can't refer to the user provided buffers.
+ *
+ * Once the model has been loaded, the OrtValue(s) added to SessionOptions instance will be removed
+ * from the internal SessionOptions copy to save memory, the user provided buffers can then be deallocated
+ * and the SessionOptions instance that refers to them can be destroyed.
+ *
+ * \param[in] options
+ * \param[in] initializer_names Array of null terminated UTF-8 encoded strings of the initializers names.
+ * \param[in] initializers Array of ::OrtValue type
+ * \param[in] num_initializers Number of elements in the initializer_names and initializers
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.12.
+ */
+ ORT_API2_STATUS(AddExternalInitializers, _In_ OrtSessionOptions* options,
+ _In_reads_(num_initializers) const char* const* initializer_names,
+ _In_reads_(num_initializers) const OrtValue* const* initializers, size_t num_initializers);
+
+ /** \brief: Create attribute of onnxruntime operator
+ *
+ * \param[in] name Name of the attribute
+ * \param[in] data Data content of the attribute
+ * \param[in] len Number of bytes stored in data
+ * \param[in] type Data type
+ * \param[out] op_attr Attribute that has been created, which must be released by OrtApi::ReleaseOpAttr
+ *
+ * \since Version 1.12.
+ */
+ ORT_API2_STATUS(CreateOpAttr,
+ _In_ const char* name,
+ _In_ const void* data,
+ _In_ int len,
+ _In_ OrtOpAttrType type,
+ _Outptr_ OrtOpAttr** op_attr);
+
+ /* \brief: Release op attribute
+ *
+ * \param[in] opAttr Attribute created by OrtApi::CreateOpAttr
+ *
+ * \since Version 1.12.
+ */
+ ORT_CLASS_RELEASE(OpAttr);
+
+ /** \brief: Create onnxruntime native operator
+ *
+ * \param[in] info Kernel info
+ * \param[in] op_name Operator name
+ * \param[in] domain Operator domain
+ * \param[in] version Operator opset version
+ * \param[in] type_constraint_names Name of the type contraints, such as "T" or "T1"
+ * \param[in] type_constraint_values Type of each contraints
+ * \param[in] type_constraint_count Number of contraints
+ * \param[in] attr_values Attributes used to initialize the operator
+ * \param[in] attr_count Number of the attributes
+ * \param[in] input_count Number of inputs
+ * \param[in] output_count Number of outputs
+ * \param[out] ort_op Operator that has been created
+ *
+ * \since Version 1.12.
+ */
+ ORT_API2_STATUS(CreateOp,
+ _In_ const OrtKernelInfo* info,
+ _In_z_ const char* op_name,
+ _In_z_ const char* domain,
+ int version,
+ _In_reads_(type_constraint_count) const char** type_constraint_names,
+ _In_reads_(type_constraint_count) const ONNXTensorElementDataType* type_constraint_values,
+ int type_constraint_count,
+ _In_reads_(attr_count) const OrtOpAttr* const* attr_values,
+ int attr_count,
+ int input_count,
+ int output_count,
+ _Outptr_ OrtOp** ort_op);
+
+ /** \brief: Invoke the operator created by OrtApi::CreateOp
+ * The inputs must follow the order as specified in onnx specification
+ *
+ * \param[in] context Kernel context
+ * \param[in] ort_op Operator that has been created
+ * \param[in] input_values Array of inputs
+ * \param[in] input_count Number of inputs
+ * \param[in] output_values Array of outputs
+ * \param[in] output_count Number of outputs
+ *
+ * \since Version 1.12.
+ */
+ ORT_API2_STATUS(InvokeOp,
+ _In_ const OrtKernelContext* context,
+ _In_ const OrtOp* ort_op,
+ _In_ const OrtValue* const* input_values,
+ _In_ int input_count,
+ _Inout_ OrtValue* const* output_values,
+ _In_ int output_count);
+
+ /* \brief: Release an onnxruntime operator
+ *
+ * \param[in] Op Operator created by OrtApi::CreateOp
+ *
+ * \since Version 1.12.
+ */
+ ORT_CLASS_RELEASE(Op);
+
+ /** \brief: Append execution provider to the session options.
+ * \param[in] options
+ * \param[in] provider_name - provider to add.
+ * \param[in] provider_options_keys - keys to configure the provider options
+ * \param[in] provider_options_values - values to configure the provider options
+ * \param[in] num_keys - number of keys passed in
+ *
+ * Currently supported providers:
+ * QNN
+ * SNPE
+ * XNNPACK
+ *
+ * Note: If an execution provider has a dedicated SessionOptionsAppendExecutionProvider_<provider name> function
+ * that should be used to add it.
+ *
+ * QNN supported keys:
+ * "backend_path": file path to QNN backend library.
+ * "profiling_level": QNN profiling level, options: "off", "basic", "detailed". Default to off.
+ * "profiling_file_path": QNN profiling file path if ETW not enabled.
+ * "rpc_control_latency": QNN RPC control latency.
+ * "vtcm_mb": QNN VTCM size in MB. default to 0(not set).
+ * "htp_performance_mode": QNN performance mode, options: "burst", "balanced", "default", "high_performance",
+ * "high_power_saver", "low_balanced", "extreme_power_saver", "low_power_saver", "power_saver", "sustained_high_performance". Default to "default".
+ * "qnn_saver_path": File path to the QNN Saver backend library. If specified, QNN Saver will be enabled and will
+ * dump QNN API calls to disk for replay/debugging. QNN Saver produces incorrect model inference results and
+ * may alter model/EP partitioning. Use only for debugging.
+ * "qnn_context_priority": QNN context priority, options: "low", "normal", "normal_high", "high". Default to "normal".
+ * "htp_graph_finalization_optimization_mode": Set the optimization mode for graph finalization on the HTP backend. Available options:
+ * - "0": Default.
+ * - "1": Faster preparation time, less optimal graph.
+ * - "2": Longer preparation time, more optimal graph.
+ * - "3": Longest preparation time, most likely even more optimal graph. See QNN SDK documentation for specific details.
+ * "soc_model": The SoC model number. Refer to the QNN SDK documentation for valid values. Defaults to "0" (unknown).
+ * "htp_arch": The minimum HTP architecture the driver will use to select compatible QNN operators. Available options:
+ * - "0": Default (none).
+ * - "68"
+ * - "69"
+ * - "73"
+ * - "75"
+ * "device_id": The ID of the device to use when setting 'htp_arch'. Defaults to "0" (for single device).
+ * "enable_htp_fp16_precision": Used for float32 model for HTP backend.
+ * Enable the float32 model to be inferenced with fp16 precision. Otherwise, it will be fp32 precision.
+ * - "0": With fp32 precision.
+ * - "1": Default. With fp16 precision.
+ * "enable_htp_weight_sharing": Enable QNN weight sharing feature while compiling multiple graphs into one QNN context.
+ * - "0": Default. Disabled.
+ * - "1": Enabled.
+ * "offload_graph_io_quantization": Offload graph input quantization and graph output dequantization to another
+ * execution provider (typically CPU EP).
+ * - "0": Disabled. QNN EP will handle quantization and dequantization of graph I/O.
+ * - "1": Enabled. This is the default value.
+ * "enable_htp_spill_fill_buffer": Enable HTP spill fill buffer setting. The flag is used while generating context binary.
+ * - "0": Default. Disabled.
+ * - "1": Enabled.
+ * "enable_htp_shared_memory_allocator": Enable the QNN HTP shared memory allocator. Requires libcdsprpc.so/dll to
+ * be available.
+ * - "0": Default. Disabled.
+ * - "1": Enabled.
+ * "dump_json_qnn_graph": Set to "1" to dump QNN graphs generated by QNN EP as JSON files. Each graph partition
+ * assigned to QNN EP is dumped to a separate file.
+ * "json_qnn_graph_dir": Directory in which to dump QNN JSON graphs. If not specified, QNN graphs are dumped in the
+ * program's current working directory. Ignored if "dump_json_qnn_graph" is not set.
+ *
+ * SNPE supported keys:
+ * "runtime": SNPE runtime engine, options: "CPU", "CPU_FLOAT32", "GPU", "GPU_FLOAT32_16_HYBRID", "GPU_FLOAT16",
+ * "DSP", "DSP_FIXED8_TF", "AIP_FIXED_TF", "AIP_FIXED8_TF".
+ * Mapping to SNPE Runtime_t definition: CPU, CPU_FLOAT32 => zdl::DlSystem::Runtime_t::CPU;
+ * GPU, GPU_FLOAT32_16_HYBRID => zdl::DlSystem::Runtime_t::GPU;
+ * GPU_FLOAT16 => zdl::DlSystem::Runtime_t::GPU_FLOAT16;
+ * DSP, DSP_FIXED8_TF => zdl::DlSystem::Runtime_t::DSP.
+ * AIP_FIXED_TF, AIP_FIXED8_TF => zdl::DlSystem::Runtime_t::AIP_FIXED_TF.
+ * "priority": execution priority, options: "low", "normal".
+ * "buffer_type": ITensor or user buffers, options: "ITENSOR", user buffer with different types - "TF8", "TF16", "UINT8", "FLOAT".
+ * "ITENSOR" -- default, ITensor which is float only.
+ * "TF8" -- quantized model required, "FLOAT" -- for both quantized or non-quantized model
+ * "enable_init_cache": enable SNPE init caching feature, set to 1 to enabled it. Disabled by default.
+ * If SNPE is not available (due to a non Snpe enabled build or its dependencies not being installed), this function will fail.
+ *
+ * XNNPACK supported keys:
+ * "intra_op_num_threads": number of thread-pool size to use for XNNPACK execution provider.
+ * default value is 0, which means to use the session thread-pool size.
+ *
+ * \since Version 1.12.
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider, _In_ OrtSessionOptions* options,
+ _In_ const char* provider_name,
+ _In_reads_(num_keys) const char* const* provider_options_keys,
+ _In_reads_(num_keys) const char* const* provider_options_values,
+ _In_ size_t num_keys);
+
+ /* \brief: Get a copy of kernel info
+ *
+ * \param[in] info Kernel info
+ * \param[out] info_copy Copy of kernel info
+ *
+ * \since Version 1.12.
+ */
+ ORT_API2_STATUS(CopyKernelInfo,
+ _In_ const OrtKernelInfo* info,
+ _Outptr_ OrtKernelInfo** info_copy);
+
+ /* \brief: Release kernel info
+ *
+ * \param[in] KernelInfo A copy of kernel info returned by CopyKernelInfo
+ *
+ * \since Version 1.12.
+ */
+ ORT_CLASS_RELEASE(KernelInfo);
+
+ /// \name Ort Training
+ /// @{
+ /** \brief Gets the Training C Api struct
+ *
+ * Call this function to access the ::OrtTrainingApi structure that holds pointers to functions that enable
+ * training with onnxruntime.
+ * \note A NULL pointer will be returned and no error message will be printed if the training api
+ * is not supported with this build. A NULL pointer will be returned and an error message will be
+ * printed if the provided version is unsupported, for example when using a runtime older than the
+ * version created with this header file.
+ *
+ * \param[in] version Must be ::ORT_API_VERSION
+ * \return The ::OrtTrainingApi struct for the version requested.
+ *
+ * \since Version 1.13
+ */
+ const OrtTrainingApi*(ORT_API_CALL* GetTrainingApi)(uint32_t version)NO_EXCEPTION;
+
+ /// @}
+
+ /** \brief Append CANN provider to session options
+ *
+ * If CANN is not available (due to a non CANN enabled build, or if CANN is not installed on the system), this function will return failure.
+ *
+ * \param[in] options
+ * \param[in] cann_options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.13.
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_CANN,
+ _In_ OrtSessionOptions* options, _In_ const OrtCANNProviderOptions* cann_options);
+
+ /** \brief Create an OrtCANNProviderOptions
+ *
+ * \param[out] out created ::OrtCANNProviderOptions. Must be released with OrtApi::ReleaseCANNProviderOptions
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.13.
+ */
+ ORT_API2_STATUS(CreateCANNProviderOptions, _Outptr_ OrtCANNProviderOptions** out);
+
+ /** \brief Set options in a CANN Execution Provider.
+ *
+ * \param[in] cann_options
+ * \param[in] provider_options_keys Array of UTF-8 null-terminated string for provider options keys
+ * \param[in] provider_options_values Array of UTF-8 null-terminated string for provider options values
+ * \param[in] num_keys Number of elements in the `provider_option_keys` and `provider_options_values` arrays
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.13.
+ */
+ ORT_API2_STATUS(UpdateCANNProviderOptions, _Inout_ OrtCANNProviderOptions* cann_options,
+ _In_reads_(num_keys) const char* const* provider_options_keys,
+ _In_reads_(num_keys) const char* const* provider_options_values,
+ _In_ size_t num_keys);
+
+ /** \brief Get serialized CANN provider options string.
+ *
+ * \param[in] cann_options OrtCANNProviderOptions instance
+ * \param[in] allocator a ptr to an instance of OrtAllocator obtained with CreateAllocator()
+ * or GetAllocatorWithDefaultOptions(), the specified allocator will be used to allocate
+ * continuous buffers for output strings and lengths.
+ * \param[out] ptr is a UTF-8 null terminated string allocated using 'allocator'.
+ * The caller is responsible for using the same allocator to free it.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.13.
+ */
+ ORT_API2_STATUS(GetCANNProviderOptionsAsString, _In_ const OrtCANNProviderOptions* cann_options,
+ _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
+
+ /** \brief Release an OrtCANNProviderOptions
+ *
+ * \param[in] input The pointer of OrtCANNProviderOptions which will been deleted
+ *
+ * \since Version 1.13.
+ */
+ void(ORT_API_CALL* ReleaseCANNProviderOptions)(_Frees_ptr_opt_ OrtCANNProviderOptions* input);
+
+ /* \brief Get OrtDevice type from MemoryInfo
+ *
+ * \since Version 1.14
+ */
+ void(ORT_API_CALL* MemoryInfoGetDeviceType)(_In_ const OrtMemoryInfo* ptr, _Out_ OrtMemoryInfoDeviceType* out);
+
+ /* \brief Update the OrtEnv instance with custom log severity level
+ *
+ * \param[in] ort_env The OrtEnv instance being used
+ * \param[in] log_severity_level The log severity level.
+ *
+ * \since Version 1.14.
+ */
+ ORT_API2_STATUS(UpdateEnvWithCustomLogLevel, _In_ OrtEnv* ort_env, OrtLoggingLevel log_severity_level);
+
+ /* \brief Set affinities for intra op threads
+ *
+ * Affinity string follows format:
+ * logical_processor_id,logical_processor_id;logical_processor_id,logical_processor_id
+ * Semicolon isolates configurations among threads, while comma split processors where ith thread expected to attach to.
+ * e.g. 1,2,3;4,5
+ * specifies affinities for two threads, with the 1st thread attach to the 1st, 2nd, and 3rd processor, and 2nd thread to the 4th and 5th.
+ * To ease the configuration, an "interval" is also allowed:
+ * e.g. 1-8;8-16;17-24
+ * orders that the 1st thread runs on first eight processors, 2nd thread runs on next eight processors, and so forth.
+ * Note:
+ * 1. Once set, the number of thread affinities must equal to intra_op_num_threads - 1,
+ * ort does not set affinity on the main thread which is started and managed by the calling app;
+ * 2. For windows, ort will infer the group id from a logical processor id, for example, assuming there are two groups with each has 64 logical processors,
+ * an id of 64 will be inferred as the last processor of the 1st group, while 65 will be interpreted as the 1st processor of the second group.
+ * Hence 64-65 is an invalid configuration, because a windows thread cannot be attached to processors across group boundary.
+ *
+ * \since Version 1.14
+ */
+ ORT_API2_STATUS(SetGlobalIntraOpThreadAffinity, _Inout_ OrtThreadingOptions* tp_options, const char* affinity_string);
+
+ /** \brief Register custom ops from a shared library.
+ *
+ * Loads a shared library (.dll on windows, .so on linux, etc) named 'library_name' and looks for this entry point:
+ * OrtStatus* RegisterCustomOps(OrtSessionOptions * options, const OrtApiBase* api);
+ * It then passes in the provided session options to this function along with the api base.
+ *
+ * The handle to the loaded library is automatically released by ORT when the last OrtSession that references the
+ * library handle is released. If no OrtSession is created, then the library handle is released when the provided
+ * OrtSessionOptions is released.
+ *
+ * \param[in] options The session options.
+ * \param[in] library_name The name of the shared library to load and register. Refer to OS-specific dynamic library
+ * loading utilities (e.g., LoadLibraryEx on Windows or dlopen on Linux/MacOS) for information
+ * on the format of library names and search paths.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.14
+ */
+ ORT_API2_STATUS(RegisterCustomOpsLibrary_V2, _Inout_ OrtSessionOptions* options, _In_ const ORTCHAR_T* library_name);
+
+ /** \brief Register custom ops by calling a RegisterCustomOpsFn function.
+ *
+ * Searches for registration_func_name and if found calls it.
+ *
+ * The library containing the function must either be linked against or previously loaded by the executable.
+ *
+ * If you want ONNX Runtime to load the library and manage its lifetime, use RegisterCustomOpsLibrary_V2.
+ *
+ * RegisterCustomOpsUsingFunction can be used in scenarios where it may not be possible for ONNX Runtime to load
+ * the library from a path. e.g. mobile platforms where the library must be linked into the app.
+ *
+ * The registration function must have the signature of RegisterCustomOpsFn:
+ * OrtStatus* (*fn)(OrtSessionOptions* options, const OrtApiBase* api);
+ *
+ * See https://onnxruntime.ai/docs/reference/operators/add-custom-op.html for details on how the registration
+ * function should be implemented.
+ *
+ * \param[in] options OrtSessionOptions that is passed through as the first argument in the call to the
+ * registration function.
+ * \param[in] registration_func_name Name of registration function to use.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.14
+ */
+ ORT_API2_STATUS(RegisterCustomOpsUsingFunction, _Inout_ OrtSessionOptions* options,
+ _In_ const char* registration_func_name);
+
+ /// \name OrtKernelInfo
+ /// Custom operator APIs.
+ /// @{
+
+ /** \brief Get the number of inputs from ::OrtKernelInfo.
+ *
+ * Used in the CreateKernel callback of an OrtCustomOp to query the number of inputs
+ * during kernel/session creation.
+ *
+ * \param[in] info Instance of ::OrtKernelInfo.
+ * \param[out] out Pointer to variable assigned with the result on success.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.14
+ */
+ ORT_API2_STATUS(KernelInfo_GetInputCount, _In_ const OrtKernelInfo* info, _Out_ size_t* out);
+
+ /** \brief Get the number of outputs from ::OrtKernelInfo.
+ *
+ * Used in the CreateKernel callback of an OrtCustomOp to query the number of outputs
+ * during kernel/session creation.
+ *
+ * \param[in] info Instance of ::OrtKernelInfo.
+ * \param[out] out Pointer to variable assigned with the result on success.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.14
+ */
+ ORT_API2_STATUS(KernelInfo_GetOutputCount, _In_ const OrtKernelInfo* info, _Out_ size_t* out);
+
+ /** \brief Get the name of a ::OrtKernelInfo's input.
+ *
+ * Used in the CreateKernel callback of an OrtCustomOp to query an input's name
+ * during kernel/session creation.
+ *
+ * If `out` is nullptr, the value of `size` is set to the size of the name
+ * string (including null-terminator), and a success status is returned.
+ *
+ * If the `size` parameter is greater than or equal to the name string's size,
+ * the value of `size` is set to the true size of the string (including null-terminator),
+ * the provided memory is filled with the string's contents, and a success status is returned.
+ *
+ * If the `size` parameter is less than the actual string's size and `out`
+ * is not nullptr, the value of `size` is set to the true size of the string
+ * and a failure status is returned.
+ *
+ * \param[in] info An instance of ::OrtKernelInfo.
+ * \param[in] index The index of the input name to get. Returns a failure status if out-of-bounds.
+ * \param[out] out Memory location into which to write the UTF-8 null-terminated string representing the input's name.
+ * \param[in,out] size Pointer to the size of the `out` buffer. See above comments for details.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.14
+ */
+ ORT_API2_STATUS(KernelInfo_GetInputName, _In_ const OrtKernelInfo* info, size_t index, _Out_ char* out,
+ _Inout_ size_t* size);
+
+ /** \brief Get the name of a ::OrtKernelInfo's output.
+ *
+ * Used in the CreateKernel callback of an OrtCustomOp to query an output's name
+ * during kernel/session creation.
+ *
+ * If `out` is nullptr, the value of `size` is set to the size of the name
+ * string (including null-terminator), and a success status is returned.
+ *
+ * If the `size` parameter is greater than or equal to the name string's size,
+ * the value of `size` is set to the true size of the string (including null-terminator),
+ * the provided memory is filled with the string's contents, and a success status is returned.
+ *
+ * If the `size` parameter is less than the actual string's size and `out`
+ * is not nullptr, the value of `size` is set to the true size of the string
+ * and a failure status is returned.
+ *
+ * \param[in] info An instance of ::OrtKernelInfo.
+ * \param[in] index The index of the output name to get. Returns a failure status if out-of-bounds.
+ * \param[out] out Memory location into which to write the UTF-8 null-terminated string representing the output's
+ * name.
+ * \param[in,out] size Pointer to the size of the `out` buffer. See above comments for details.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.14
+ */
+ ORT_API2_STATUS(KernelInfo_GetOutputName, _In_ const OrtKernelInfo* info, size_t index, _Out_ char* out,
+ _Inout_ size_t* size);
+
+ /** \brief Get the type information for a ::OrtKernelInfo's input.
+ *
+ * Used in the CreateKernel callback of an OrtCustomOp to query the shape and type information
+ * of an input during kernel/session creation.
+ *
+ * \param[in] info An instance of ::OrtKernelInfo.
+ * \param[in] index Which input to get the type information for
+ * \param[out] type_info Pointer set to the resulting ::OrtTypeInfo. Must be freed with OrtApi::ReleaseTypeInfo.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.14
+ */
+ ORT_API2_STATUS(KernelInfo_GetInputTypeInfo, _In_ const OrtKernelInfo* info, size_t index,
+ _Outptr_ OrtTypeInfo** type_info);
+
+ /** \brief Get the type information for a ::OrtKernelInfo's output.
+ *
+ * Used in the CreateKernel callback of an OrtCustomOp to query the shape and type information
+ * of an output during kernel/session creation.
+ *
+ * \param[in] info An instance of ::OrtKernelInfo.
+ * \param[in] index Which input to get the type information for
+ * \param[out] type_info Pointer set to the resulting ::OrtTypeInfo. Must be freed with OrtApi::ReleaseTypeInfo.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.14
+ */
+ ORT_API2_STATUS(KernelInfo_GetOutputTypeInfo, _In_ const OrtKernelInfo* info, size_t index,
+ _Outptr_ OrtTypeInfo** type_info);
+
+ /** \brief Get a ::OrtValue tensor stored as an attribute in the graph node.
+ *
+ * Used in the CreateKernel callback of an OrtCustomOp to get a tensor attribute.
+ *
+ * \param[in] info ::OrtKernelInfo instance.
+ * \param[in] name UTF-8 null-terminated string representing the attribute's name.
+ * \param[in] allocator Allocator used to allocate the internal tensor state.
+ * \param[out] out Returns newly created ::OrtValue. Must be freed with OrtApi::ReleaseValue,
+ * which will also free internal tensor state allocated with the provided allocator.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(KernelInfoGetAttribute_tensor, _In_ const OrtKernelInfo* info, _In_z_ const char* name,
+ _Inout_ OrtAllocator* allocator, _Outptr_ OrtValue** out);
+
+ /// @}
+ /// \name OrtSessionOptions
+ /// Custom operator APIs
+ /// @{
+
+ /** \brief Checks if the given session configuration entry exists.
+ *
+ * The config_key formats are defined in onnxruntime_session_options_config_keys.h
+ *
+ * Can be used in a custom operator library to check for session configuration entries
+ * that target one or more custom operators in the library. Example: The config entry
+ * custom_op.myop.some_key targets a custom op named "myop".
+ *
+ * \param[in] options The ::OrtSessionOptions instance.
+ * \param[in] config_key A null-terminated UTF-8 string representation of the configuration key.
+ * \param[out] out Pointer set to 1 if the entry exists and 0 otherwise.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.14
+ */
+ ORT_API2_STATUS(HasSessionConfigEntry, _In_ const OrtSessionOptions* options,
+ _In_z_ const char* config_key, _Out_ int* out);
+
+ /** \brief Get a session configuration value.
+ *
+ * Returns a failure status if the configuration key does not exist.
+ * The config_key and the format of config_value are defined in onnxruntime_session_options_config_keys.h
+ *
+ * If `config_value` is nullptr, the value of `size` is set to the true size of the string
+ * value (including null-terminator), and a success status is returned.
+ *
+ * If the `size` parameter is greater than or equal to the actual string value's size,
+ * the value of `size` is set to the true size of the string value, the provided memory
+ * is filled with the value's contents, and a success status is returned.
+ *
+ * If the `size` parameter is less than the actual string value's size and `config_value`
+ * is not nullptr, the value of `size` is set to the true size of the string value
+ * and a failure status is returned.
+ *
+ * Can be used in a custom operator library to get session configuration entries
+ * that target one or more custom operators in the library. Example: The config entry
+ * custom_op.myop.some_key targets a custom op named "myop".
+ *
+ * \param[in] options The session options.
+ * \param[in] config_key A null-terminated UTF-8 string representation of the config key.
+ * \param[in] config_value Pointer to memory where the null-terminated UTF-8 string value will be stored.
+ * \param[in,out] size Pointer to the size of the `config_value` buffer. See above comments for details.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.14
+ */
+ ORT_API2_STATUS(GetSessionConfigEntry, _In_ const OrtSessionOptions* options,
+ _In_z_ const char* config_key, _Out_ char* config_value, _Inout_ size_t* size);
+
+ /// @}
+
+ /** \brief Append dnnl provider to session options
+ *
+ * If oneDNN is not available, this function will return failure.
+ *
+ * \param[in] options
+ * \param[in] dnnl_options
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.15.
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_Dnnl,
+ _In_ OrtSessionOptions* options, _In_ const OrtDnnlProviderOptions* dnnl_options);
+
+ /** \brief Create an OrtDnnlProviderOptions
+ *
+ * \param[out] out Newly created ::OrtDnnlProviderOptions. Must be released with OrtApi::ReleaseDnnlProviderOptions
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.15.
+ */
+ ORT_API2_STATUS(CreateDnnlProviderOptions, _Outptr_ OrtDnnlProviderOptions** out);
+
+ /** \brief Set options in a oneDNN Execution Provider.
+ *
+ * Key should be in null terminated string format of the member of ::OrtDnnlProviderOptions
+ * and value should be its related range.
+ *
+ * For example, key="use_arena" and value="1"
+ *
+ * \param[in] dnnl_options
+ * \param[in] provider_options_keys Array of UTF-8 null-terminated string for provider options keys
+ * \param[in] provider_options_values Array of UTF-8 null-terminated string for provider options values
+ * \param[in] num_keys Number of elements in the `provider_option_keys` and `provider_options_values` arrays
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.15.
+ */
+ ORT_API2_STATUS(UpdateDnnlProviderOptions, _Inout_ OrtDnnlProviderOptions* dnnl_options,
+ _In_reads_(num_keys) const char* const* provider_options_keys,
+ _In_reads_(num_keys) const char* const* provider_options_values,
+ _In_ size_t num_keys);
+
+ /**
+ * Get serialized oneDNN provider options string.
+ *
+ * For example, "use_arena=1;......"
+ *
+ * \param dnnl_options - OrtDnnlProviderOptions instance
+ * \param allocator - a ptr to an instance of OrtAllocator obtained with CreateAllocator() or GetAllocatorWithDefaultOptions()
+ * the specified allocator will be used to allocate continuous buffers for output strings and lengths.
+ * \param ptr - is a UTF-8 null terminated string allocated using 'allocator'. The caller is responsible for using the same allocator to free it.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.15.
+ */
+ ORT_API2_STATUS(GetDnnlProviderOptionsAsString, _In_ const OrtDnnlProviderOptions* dnnl_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
+
+ /** \brief Release an ::OrtDnnlProviderOptions
+ *
+ * \since Version 1.15.
+ */
+ void(ORT_API_CALL* ReleaseDnnlProviderOptions)(_Frees_ptr_opt_ OrtDnnlProviderOptions* input);
+
+ /// \name OrtKernelInfo
+ /// Custom operator APIs.
+ /// @{
+
+ /** \brief Get the graph node name from ::OrtKernelInfo.
+ *
+ * If `out` is nullptr, the value of `size` is set to the size of the name
+ * string (including null-terminator), and a success status is returned.
+ *
+ * If the `size` parameter is greater than or equal to the name string's size,
+ * the value of `size` is set to the true size of the string (including null-terminator),
+ * the provided memory is filled with the string's contents, and a success status is returned.
+ *
+ * If the `size` parameter is less than the actual string's size and `out`
+ * is not nullptr, the value of `size` is set to the true size of the string
+ * and a failure status is returned.
+ *
+ * Can be used in a custom operator's CreateKernel callback to get the name of the operator's node name in the graph.
+ *
+ * \param[in] info An instance of ::OrtKernelInfo.
+ * \param[out] out Memory location into which to write the UTF-8 null-terminated string representing the name.
+ * \param[in,out] size Pointer to the size of the `out` buffer. See above comments for details.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.15
+ */
+ ORT_API2_STATUS(KernelInfo_GetNodeName, _In_ const OrtKernelInfo* info, _Out_ char* out, _Inout_ size_t* size);
+
+ /** \brief Get the session logger from ::OrtKernelInfo.
+ *
+ * Used in the CreateKernel callback of an OrtCustomOp to get a logger that can be used to log
+ * messages.
+ *
+ * \param[in] info An instance of ::OrtKernelInfo.
+ * \param[out] logger Pointer set to the session's ::OrtLogger. Owned by ONNX Runtime, so do not free.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.15
+ */
+ ORT_API2_STATUS(KernelInfo_GetLogger, _In_ const OrtKernelInfo* info, _Outptr_ const OrtLogger** logger);
+
+ /// @}
+ /// \name OrtKernelContext
+ /// Custom operator APIs.
+ /// @{
+
+ /** \brief Get the runtime logger from ::OrtKernelContext.
+ *
+ * Used in the KernelCompute callback of an OrtCustomOp to get a logger that can be used to log
+ * messages during inference.
+ *
+ * \param[in] context An instance of ::OrtKernelContext.
+ * \param[out] logger Pointer set to the kernel context's ::OrtLogger. Owned by ONNX Runtime, so do not free.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.15
+ */
+ ORT_API2_STATUS(KernelContext_GetLogger, _In_ const OrtKernelContext* context, _Outptr_ const OrtLogger** logger);
+
+ /// @}
+ /// \name OrtLogger
+ /// Custom operator APIs.
+ /// @{
+
+ /** \brief Logs a message at the given severity level using the provided ::OrtLogger.
+ *
+ * Only messages with a severity level equal or greater than the ::OrtLogger's logging severity level
+ * are logged. Use OrtApi::Logger_GetLoggingSeverityLevel to get the ::OrtLogger's logging severity
+ * level.
+ *
+ * Can be used in custom operators to log messages with the logger retrieved via OrtApi::KernelInfo_GetLogger.
+ *
+ * \param[in] logger The ::OrtLogger instance.
+ * \param[in] log_severity_level The message's severity level.
+ * \param[in] message The message to log.
+ * \param[in] file_path The filepath of the file in which the message is logged. Usually the value of ORT_FILE.
+ * \param[in] line_number The file line number in which the message is logged. Usually the value of __LINE__.
+ * \param[in] func_name The name of the function in which the message is logged. Usually the value of __FUNCTION__.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.15
+ */
+ ORT_API2_STATUS(Logger_LogMessage, _In_ const OrtLogger* logger, OrtLoggingLevel log_severity_level,
+ _In_z_ const char* message, _In_z_ const ORTCHAR_T* file_path, int line_number,
+ _In_z_ const char* func_name);
+
+ /** \brief Get the logging severity level of the ::OrtLogger.
+ *
+ * Can be used in a custom operator to get the logging serverity level of the ::OrtLogger associated with
+ * the ::OrtKernelInfo.
+ *
+ * \param[in] logger The ::OrtLogger instance.
+ * \param[out] out Pointer to variable assigned with the logging severity level on success.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ * \since Version 1.15
+ */
+ ORT_API2_STATUS(Logger_GetLoggingSeverityLevel, _In_ const OrtLogger* logger, _Out_ OrtLoggingLevel* out);
+
+ /// @}
+
+ /** \brief Get a ::OrtValue tensor stored as a constant initializer in the graph node.
+ *
+ * Used in the CreateKernel callback of an OrtCustomOp to get a tensor value.
+ *
+ * \param[in] info ::OrtKernelInfo instance.
+ * \param[in] index The node index.
+ * \param[out] is_constant Is it a constant node input or not.
+ * \param[out] out The OrtValue tensor value.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.15.
+ */
+ ORT_API2_STATUS(KernelInfoGetConstantInput_tensor, _In_ const OrtKernelInfo* info, size_t index, _Out_ int* is_constant, _Outptr_ const OrtValue** out);
+
+ /** \brief Get Optional Type information from an ::OrtTypeInfo
+ *
+ * This augments ::OrtTypeInfo to return an ::OrtOptionalTypeInfo when the type is optional.
+ * The OrtOptionalTypeInfo also has a nested ::OrtTypeInfo that describes the type of the optional value.
+ * ::OrtOptionalTypeInfo type can only appear within model metadata to describe inputs/outputs.
+ * The actual OrtValues that are supplied in place of optional type inputs should contain
+ * specific type that is described by ::OrtOptionalTypeInfo.
+ *
+ * So the picture: ::OrtTypeInfo -> ::OrtOptionalTypeInfo -> ::OrtTypeInfo (describes the type that can be supplied
+ * in place of the optional type when creating the actual ::OrtValue).
+ *
+ * \param[in] type_info
+ * \param[out] out A pointer to the ::OrtOptionalTypeInfo. Do not free this value,
+ * it is owned by OrtTypeInfo instance. When the type_info does not represent
+ * optional type, nullptr is returned in out.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.15.
+ */
+ ORT_API2_STATUS(CastTypeInfoToOptionalTypeInfo, _In_ const OrtTypeInfo* type_info,
+ _Outptr_result_maybenull_ const OrtOptionalTypeInfo** out);
+
+ /** \brief Get OrtTypeInfo for the allowed contained type from an ::OrtOptionalTypeInfo.
+ *
+ * This augments ::OrtOptionalTypeInfo to return an ::OrtTypeInfo for the contained type.
+ * The OrtOptionalTypeInfo has a nested ::OrtTypeInfo that describes the type of the optional value.
+ * ::OrtOptionalTypeInfo type can only appear within model metadata to describe inputs/outputs.
+ * The actual OrtValues that are supplied in place of optional type inputs should contain
+ * specific type that is described by the returned ::OrtTypeInfo.
+ *
+ * \param[in] optional_type_info
+ * \param[out] out A pointer to the ::OrtTypeInfo for what the optional value could be.
+ * it is owned by OrtOptionalTypeInfo instance.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.15.
+ */
+ ORT_API2_STATUS(GetOptionalContainedTypeInfo, _In_ const OrtOptionalTypeInfo* optional_type_info,
+ _Outptr_ OrtTypeInfo** out);
+
+ /** \brief Set a single string in a string tensor
+ * Do not zero terminate the string data.
+ *
+ * \param[in] value A string tensor
+ * \param[in] index - flat index of the element
+ * \param[in] length_in_bytes length of the buffer in utf-8 bytes (without the null terminator)
+ * \param[inout] buffer - address of return value
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ */
+ ORT_API2_STATUS(GetResizedStringTensorElementBuffer, _Inout_ OrtValue* value, _In_ size_t index, _In_ size_t length_in_bytes, _Inout_ char** buffer);
+
+ /** \brief Get Allocator from KernelContext for a specific memoryInfo. Please use C API ReleaseAllocator to release out object
+ *
+ * \param[in] context OrtKernelContext instance
+ * \param[in] mem_info OrtMemoryInfo instance
+ * \param[out] out A pointer to OrtAllocator.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.15.
+ */
+ ORT_API2_STATUS(KernelContext_GetAllocator, _In_ const OrtKernelContext* context, _In_ const OrtMemoryInfo* mem_info, _Outptr_ OrtAllocator** out);
+
+ /** \brief Returns a null terminated string of the build info including git info and cxx flags
+ *
+ * \return UTF-8 encoded version string. Do not deallocate the returned buffer.
+ *
+ * \since Version 1.15.
+ */
+ const char*(ORT_API_CALL* GetBuildInfoString)(void);
+
+ /// \name OrtROCMProviderOptions
+ /// @{
+
+ /** \brief Create an OrtROCMProviderOptions
+ *
+ * \param[out] out Newly created ::OrtROCMProviderOptions. Must be released with OrtApi::ReleaseROCMProviderOptions
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.16.
+ */
+ ORT_API2_STATUS(CreateROCMProviderOptions, _Outptr_ OrtROCMProviderOptions** out);
+
+ /** \brief Set options in a ROCm Execution Provider.
+ *
+ * Please refer to https://onnxruntime.ai/docs/execution-providers/ROCm-ExecutionProvider.html
+ * to know the available keys and values. Key should be in null terminated string format of the member of
+ * ::OrtROCMProviderOptions and value should be its related range.
+ *
+ * For example, key="device_id" and value="0"
+ *
+ * \param[in] rocm_options
+ * \param[in] provider_options_keys Array of UTF-8 null-terminated string for provider options keys
+ * \param[in] provider_options_values Array of UTF-8 null-terminated string for provider options values
+ * \param[in] num_keys Number of elements in the `provider_option_keys` and `provider_options_values` arrays
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.16.
+ */
+ ORT_API2_STATUS(UpdateROCMProviderOptions, _Inout_ OrtROCMProviderOptions* rocm_options,
+ _In_reads_(num_keys) const char* const* provider_options_keys,
+ _In_reads_(num_keys) const char* const* provider_options_values,
+ _In_ size_t num_keys);
+
+ /**
+ * Get serialized ROCm provider options string.
+ *
+ * For example, "device_id=0;arena_extend_strategy=0;......"
+ *
+ * \param rocm_options - OrtROCMProviderOptions instance
+ * \param allocator - a ptr to an instance of OrtAllocator obtained with CreateAllocator() or GetAllocatorWithDefaultOptions()
+ * the specified allocator will be used to allocate continuous buffers for output strings and lengths.
+ * \param ptr - is a UTF-8 null terminated string allocated using 'allocator'. The caller is responsible for using the same allocator to free it.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.16.
+ */
+ ORT_API2_STATUS(GetROCMProviderOptionsAsString, _In_ const OrtROCMProviderOptions* rocm_options, _Inout_ OrtAllocator* allocator, _Outptr_ char** ptr);
+
+ /** \brief Release an ::OrtROCMProviderOptions
+ *
+ * \note This is an exception in the naming convention of other Release* functions, as the name of the method does not have the V2 suffix, but the type does
+ *
+ * \since Version 1.16.
+ */
+ void(ORT_API_CALL* ReleaseROCMProviderOptions)(_Frees_ptr_opt_ OrtROCMProviderOptions* input);
+
+ /** \brief Create an allocator with specific type and register it with the ::OrtEnv
+ * This API enhance CreateAndRegisterAllocator that it can create an allocator with specific type, not just CPU allocator
+ * Enables sharing the allocator between multiple sessions that use the same env instance.
+ * Lifetime of the created allocator will be valid for the duration of the environment.
+ * Returns an error if an allocator with the same ::OrtMemoryInfo is already registered.
+ * \param[in] env OrtEnv instance
+ * \param[in] provider_type ExecutionProvider type
+ * \param[in] mem_info OrtMemoryInfo instance
+ * \param[in] arena_cfg Arena configuration
+ * \param[in] provider_options_keys key of the provider options map
+ * \param[in] provider_options_values value of the provider options map
+ * \param[in] num_keys Length of the provider options map
+ */
+ ORT_API2_STATUS(CreateAndRegisterAllocatorV2, _Inout_ OrtEnv* env, _In_ const char* provider_type, _In_ const OrtMemoryInfo* mem_info, _In_ const OrtArenaCfg* arena_cfg,
+ _In_reads_(num_keys) const char* const* provider_options_keys, _In_reads_(num_keys) const char* const* provider_options_values, _In_ size_t num_keys);
+
+ /** \brief Run the model asynchronously in a thread owned by intra op thread pool
+ *
+ * \param[in] session
+ * \param[in] run_options If nullptr, will use a default ::OrtRunOptions
+ * \param[in] input_names Array of null terminated UTF8 encoded strings of the input names
+ * \param[in] input Array of ::OrtValue%s of the input values
+ * \param[in] input_len Number of elements in the input_names and inputs arrays
+ * \param[in] output_names Array of null terminated UTF8 encoded strings of the output names
+ * \param[in] output_names_len Number of elements in the output_names and outputs array
+ * \param[out] output OrtValue* array of size output_names_len.
+ * On calling RunAsync, output[i] could either be a null or a pointer to a preallocated OrtValue.
+ * Later, the output array will be passed to run_async_callback with all null(s) filled with valid
+ * OrtValue pointer(s) allocated by onnxruntime.
+ * NOTE: it is customer's duty to finally release the output array and each of its member,
+ * regardless of whether the member (OrtValue*) is allocated by onnxruntime or preallocated by the customer.
+ * \param[in] run_async_callback Callback function on model run completion
+ * \param[in] user_data User data that pass back to run_async_callback
+ */
+ ORT_API2_STATUS(RunAsync, _Inout_ OrtSession* session, _In_opt_ const OrtRunOptions* run_options,
+ _In_reads_(input_len) const char* const* input_names,
+ _In_reads_(input_len) const OrtValue* const* input, size_t input_len,
+ _In_reads_(output_names_len) const char* const* output_names, size_t output_names_len,
+ _Inout_updates_all_(output_names_len) OrtValue** output,
+ _In_ RunAsyncCallbackFn run_async_callback, _In_opt_ void* user_data);
+
+ /**
+ * Update TensorRT EP provider option where its data type is pointer, for example 'user_compute_stream'.
+ * If the data type of the provider option can be represented by string please use UpdateTensorRTProviderOptions.
+ *
+ * Note: It's caller's responsibility to properly manage the lifetime of the instance pointed by this pointer.
+ *
+ * \param tensorrt_options - OrtTensorRTProviderOptionsV2 instance
+ * \param key - Name of the provider option
+ * \param value - A pointer to the instance that will be assigned to this provider option
+ *
+ * \since Version 1.16.
+ */
+ ORT_API2_STATUS(UpdateTensorRTProviderOptionsWithValue, _Inout_ OrtTensorRTProviderOptionsV2* tensorrt_options, _In_ const char* key, _In_ void* value);
+
+ /**
+ * Get TensorRT EP provider option where its data type is pointer.
+ * If the data type of the provider option can be represented by string please use GetTensorRTProviderOptionsAsString.
+ *
+ * \param tensorrt_options - OrtTensorRTProviderOptionsV2 instance
+ * \param key - Name of the provider option
+ * \param ptr - A pointer to the instance that is kept by the provider option
+ *
+ * \since Version 1.16.
+ */
+ ORT_API2_STATUS(GetTensorRTProviderOptionsByName, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options, _In_ const char* key, _Outptr_ void** ptr);
+
+ /**
+ * Update CUDA EP provider option where its data type is pointer, for example 'user_compute_stream'.
+ * If the data type of the provider option can be represented by string please use UpdateCUDAProviderOptions.
+ *
+ * Note: It's caller's responsibility to properly manage the lifetime of the instance pointed by this pointer.
+ *
+ * \param cuda_options - OrtCUDAProviderOptionsV2 instance
+ * \param key - Name of the provider option
+ * \param value - A pointer to the instance that will be assigned to this provider option
+ *
+ * \since Version 1.16.
+ */
+ ORT_API2_STATUS(UpdateCUDAProviderOptionsWithValue, _Inout_ OrtCUDAProviderOptionsV2* cuda_options, _In_ const char* key, _In_ void* value);
+
+ /**
+ * Get CUDA EP provider option where its data type is pointer.
+ * If the data type of the provider option can be represented by string please use GetCUDAProviderOptionsAsString.
+ *
+ * \param cuda_options - OrtCUDAProviderOptionsV2 instance
+ * \param key - Name of the provider option
+ * \param ptr - A pointer to the instance that is kept by the provider option
+ *
+ * \since Version 1.16.
+ */
+ ORT_API2_STATUS(GetCUDAProviderOptionsByName, _In_ const OrtCUDAProviderOptionsV2* cuda_options, _In_ const char* key, _Outptr_ void** ptr);
+
+ /**
+ * Get a EP resource.
+ * E.g. a cuda stream or a cublas handle
+ *
+ * \param context - Kernel context
+ * \param resource_version - Version of the resource
+ * \param resource_id - Type of resource
+ * \param resource - A pointer to returned resource
+ *
+ * \since Version 1.16.
+ */
+ ORT_API2_STATUS(KernelContext_GetResource, _In_ const OrtKernelContext* context, _In_ int resource_version,
+ _In_ int resource_id, _Outptr_ void** resource);
+
+ /** \brief Set user logging function
+ *
+ * By default the logger created by the CreateEnv* functions is used to create the session logger as well.
+ * This function allows a user to override this default session logger with a logger of their own choosing. This way
+ * the user doesn't have to create a separate environment with a custom logger. This addresses the problem when
+ * the user already created an env but now wants to use a different logger for a specific session (for debugging or
+ * other reasons).
+ *
+ * \param[in] options
+ * \param[in] user_logging_function A pointer to a logging function.
+ * \param[in] user_logging_param A pointer to arbitrary data passed as the ::OrtLoggingFunction `param` parameter to
+ * `user_logging_function`. This parameter is optional.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.17.
+ */
+ ORT_API2_STATUS(SetUserLoggingFunction, _Inout_ OrtSessionOptions* options,
+ _In_ OrtLoggingFunction user_logging_function, _In_opt_ void* user_logging_param);
+
+ /**
+ * Get number of input from OrtShapeInferContext
+ *
+ * \param[in] context
+ * \param[out] out The number of inputs
+ *
+ * \since Version 1.17.
+ */
+ ORT_API2_STATUS(ShapeInferContext_GetInputCount, _In_ const OrtShapeInferContext* context, _Out_ size_t* out);
+
+ /**
+ * Get type and shape info of an input
+ *
+ * \param[in] context
+ * \param[in] index The index of the input
+ * \param[out] info Type shape info of the input
+ *
+ * \since Version 1.17.
+ */
+ ORT_API2_STATUS(ShapeInferContext_GetInputTypeShape, _In_ const OrtShapeInferContext* context, _In_ size_t index, _Outptr_ OrtTensorTypeAndShapeInfo** info);
+
+ /**
+ * Get attribute from OrtShapeInferContext. Note that OrtShapeInferContext is a per-node context, one could only read attribute from current node.
+ *
+ * \param[in] context
+ * \param[in] attr_name Name of the attribute
+ * \param[out] attr Handle of the attribute fetched
+ *
+ * \since Version 1.17.
+ */
+ ORT_API2_STATUS(ShapeInferContext_GetAttribute, _In_ const OrtShapeInferContext* context, _In_ const char* attr_name, _Outptr_ const OrtOpAttr** attr);
+
+ /**
+ * Set type and shape info of an output
+ *
+ * \param[in] context
+ * \param[in] index The index of the output
+ * \param[out] info Type shape info of the output
+ *
+ * \since Version 1.17.
+ */
+ ORT_API2_STATUS(ShapeInferContext_SetOutputTypeShape, _In_ const OrtShapeInferContext* context, _In_ size_t index, _In_ const OrtTensorTypeAndShapeInfo* info);
+
+ /**
+ * Set symbolic shape to type shape info
+ *
+ * \param[in] info Type shape info
+ * \param[in] dim_params Symbolic strings
+ * \param[in] dim_params_length Number of strings
+ *
+ * \since Version 1.17.
+ */
+ ORT_API2_STATUS(SetSymbolicDimensions, _In_ OrtTensorTypeAndShapeInfo* info, _In_ const char* dim_params[], _In_ size_t dim_params_length);
+
+ /**
+ * Read contents of an attribute to data
+ *
+ * \param[in] op_attr
+ * \param[in] type Attribute type
+ * \param[out] data Memory address to save raw content of the attribute
+ * \param[in] len Number of bytes allowed to store in data
+ * \param[out] out Number of bytes required to save the data when the call failed, or the real number of bytes saved to data on success
+ *
+ * \since Version 1.17.
+ */
+ ORT_API2_STATUS(ReadOpAttr, _In_ const OrtOpAttr* op_attr, _In_ OrtOpAttrType type, _Inout_ void* data, _In_ size_t len, _Out_ size_t* out);
+
+ /** \brief Set whether to use deterministic compute.
+ *
+ * Default is false. If set to true, this will enable deterministic compute for GPU kernels where possible.
+ * Note that this most likely will have a performance cost.
+ *
+ * \param[in] options
+ * \param[in] value
+ *
+ * \since Version 1.17.
+ */
+ ORT_API2_STATUS(SetDeterministicCompute, _Inout_ OrtSessionOptions* options, bool value);
+
+ /**
+ * Run fn in parallel
+ *
+ * \param[in] context
+ * \param[in] fn Function accepting usr_data and an integer as iterator
+ * \param[in] total The number of times fn is to be invoked
+ * \param[in] num_batch Number of batches by which the "total" is to be divided in maximum. When zero, there is no limit
+ * \param[in] usr_data User data to be passed back to fn
+ *
+ * \since Version 1.17.
+ */
+ ORT_API2_STATUS(KernelContext_ParallelFor, _In_ const OrtKernelContext* context, _In_ void (*fn)(void*, size_t), _In_ size_t total, _In_ size_t num_batch, _In_ void* usr_data);
+
+ /** \brief Append OpenVINO execution provider to the session options
+ *
+ * If OpenVINO is not available (due to a non OpenVINO enabled build, or if OpenVINO is not installed on the system), this function will fail.
+ *
+ * \param[in] options
+ * \param[in] provider_options_keys
+ * \param[in] provider_options_values
+ * \param[in] num_keys
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.17.
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_OpenVINO_V2,
+ _In_ OrtSessionOptions* options,
+ _In_reads_(num_keys) const char* const* provider_options_keys,
+ _In_reads_(num_keys) const char* const* provider_options_values,
+ _In_ size_t num_keys);
+
+ /** \brief Append VitisAI provider to session options
+ *
+ * If VitisAI is not available (due to a non VitisAI enabled build, or if VitisAI is not installed on the system), this function will return failure.
+ *
+ * \param[in] options
+ * \param[in] provider_options_keys
+ * \param[in] provider_options_values
+ * \param[in] num_keys
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.18.
+ */
+ ORT_API2_STATUS(SessionOptionsAppendExecutionProvider_VitisAI,
+ _In_ OrtSessionOptions* options,
+ _In_reads_(num_keys) const char* const* provider_options_keys,
+ _In_reads_(num_keys) const char* const* provider_options_values,
+ _In_ size_t num_keys);
+
+ /** \brief Get scratch buffer from the corresponding allocator under the sepcific OrtMemoryInfo object.
+ * NOTE: callers are responsible to release this scratch buffer from the corresponding allocator
+ * \param[in] context OrtKernelContext instance
+ * \param[in] mem_info OrtMemoryInfo instance
+ * \param[in] count_or_bytes How many bytes is this scratch buffer
+ * \param[out] out A pointer to the scrach buffer
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.18.
+ */
+ ORT_API2_STATUS(KernelContext_GetScratchBuffer, _In_ const OrtKernelContext* context, _In_ const OrtMemoryInfo* mem_info, _In_ size_t count_or_bytes, _Outptr_ void** out);
+
+ /** \brief Get allocator from KernelInfo for a specific memory type. Please use C API ReleaseAllocator to release out object
+ *
+ * \param[in] info OrtKernelInfo instance
+ * \param[in] mem_type OrtMemType object
+ * \param[out] out A pointer to OrtAllocator
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.18.
+ */
+ ORT_API2_STATUS(KernelInfoGetAllocator, _In_ const OrtKernelInfo* info, _In_ OrtMemType mem_type, _Outptr_ OrtAllocator** out);
+
+ /** \brief Replace initialized Tensors with external data with the provided files in memory
+ *
+ * The function will find the initialized TensorProtos with external data in the graph with the provided
+ * external file names and the file content in memory. The API gets the external file name, offset, data length
+ * from TensorProto, and locate the tensor data from the file in memory buffer.
+ * It creates a Tensor to replace the existing Tensor in graph. The replacement
+ * will occur before any of the optimizations take place. The data will be copied into the graph
+ * since TensorProto can't refer to the user provided buffers.
+ *
+ * \param[in] options
+ * \param[in] external_initializer_file_names Array of null terminated UTF-8 encoded strings of the file names
+ * which holds the external initializers.
+ * \param[in] external_initializer_file_buffer_array Array of pointers to the buffer of the file content.
+ * The buffer can be freed after session creation.
+ * \param[in] external_initializer_file_lengths Array of size_t to indicate the length of file content
+ * \param[in] num_external_initializer_files Number of external files
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.18.
+ */
+ ORT_API2_STATUS(AddExternalInitializersFromFilesInMemory, _In_ OrtSessionOptions* options,
+ _In_reads_(num_external_initializer_files) const ORTCHAR_T* const* external_initializer_file_names,
+ _In_reads_(num_external_initializer_files) char* const* external_initializer_file_buffer_array,
+ _In_reads_(num_external_initializer_files) const size_t* external_initializer_file_lengths,
+ size_t num_external_initializer_files);
+
+ /** \brief Create an OrtLoraAdapter
+ *
+ * The function attempts to locate file specified by adapter_file_path, read it and create an OrtLoraAdapter
+ * instance. The adapter_file_path should be a valid path to a file that contains a valid Lora Adapter
+ * format. The function attempts to validate the format at load time. The file will always be memory mapped, unless
+ * the platform does not support memory mapping, in which case the file will be read into memory.
+ *
+ * \param[in] adapter_file_path adapter file path.
+ * \param[in] allocator optional pointer to a device allocator. If specified
+ * data is copied to the device at some point before Run() is invoked. If nullptr, data stays on CPU.
+ * The data would still be copied to device if required by the model at inference time.
+ * \param[out] out A pointer to a newly created OrtLoraAdapter instance. Must be released with
+ * OrtApi::ReleaseLoraAdapter.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.20.
+ */
+ ORT_API2_STATUS(CreateLoraAdapter, const ORTCHAR_T* adapter_file_path, _In_ OrtAllocator* allocator,
+ _Outptr_ OrtLoraAdapter** out);
+
+ /** \brief Create an OrtLoraAdapter
+ *
+ * The function copies the bytes from the array and creates an OrtLoraAdapter instance.
+ *
+ *
+ * \param[in] bytes pointer to a valid Lora Adapter format buffer.
+ * \param[in] num_bytes length of bytes buffer.
+ * \param[in] allocator optional pointer to a device allocator. If specified
+ * data is copied to the device at some point before Run() is invoked. If nullptr, data stays on CPU.
+ * The data would still be copied to device if required by the model at inference time.
+ * \param[out] out A pointer to a newly created OrtLoraAdapter instance. Must be released with
+ * OrtApi::ReleaseLoraAdapter.
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.20.
+ */
+ ORT_API2_STATUS(CreateLoraAdapterFromArray, _In_ const void* bytes, size_t num_bytes, _In_ OrtAllocator* allocator,
+ _Outptr_ OrtLoraAdapter** out);
+
+ /** \brief Release an ::OrtLoraAdapter obtained from OrtApi::CreateLoraAdapter
+ */
+ ORT_CLASS_RELEASE(LoraAdapter);
+
+ /** \brief Add the Lora Adapter to the list of active adapters.
+ *
+ * The function adds the Lora Adapter to the list of active adapters. The Lora Adapter must be created with
+ * OrtApi::CreateLoraAdapter or FromArray. The Lora Adapter will be used by the session to run the model.
+ * The instance of the OrtRunOptions can then be used to customize the Run() calls.
+ * More than one OrtLoraAdapter can be active at the same time. Lora Parameters that belong to different
+ * Lora adapters that will be active at the same time must not overlap.
+ * This setting does not affect RunWithBinding.
+ *
+ * \param[in] options OrtRunOptions instance
+ * \param[in] adapter OrtLoraAdapter instance
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.20.
+ */
+ ORT_API2_STATUS(RunOptionsAddActiveLoraAdapter, _Inout_ OrtRunOptions* options, _In_ const OrtLoraAdapter* adapter);
+
+ /// @}
+ /// \name OrtEpDynamicOptions
+ /// @{
+
+ /** \brief Set DynamicOptions for EPs (Execution Providers)
+ *
+ * Valid options can be found in `include\onnxruntime\core\session\onnxruntime_session_options_config_keys.h`
+ * Look for `kOrtEpDynamicOptions`
+ *
+ * \param[in] sess OrtSession
+ * \param[in] keys Array of null terminated UTF8 encoded strings of EP dynamic option keys
+ * \param[in] values Array of null terminated UTF8 encoded string of EP dynamic option values
+ * \param[in] kv_len Number of elements in the keys and values arrays
+ *
+ * \snippet{doc} snippets.dox OrtStatus Return Value
+ *
+ * \since Version 1.20.
+ */
+ ORT_API2_STATUS(SetEpDynamicOptions, _Inout_ OrtSession* sess, _In_reads_(kv_len) const char* const* keys,
+ _In_reads_(kv_len) const char* const* values, _In_ size_t kv_len);
+};
+
+/*
+ * Steps to use a custom op:
+ * 1 Create an OrtCustomOpDomain with the domain name used by the custom ops
+ * 2 Create an OrtCustomOp structure for each op and add them to the domain
+ * 3 Call OrtAddCustomOpDomain to add the custom domain of ops to the session options
+ */
+
+// Specifies some characteristics of inputs/outputs of custom ops:
+// Specify if the inputs/outputs are one of:
+// 1) Non-optional (input/output must be present in the node)
+// 2) Optional (input/output may be absent in the node)
+// 3) Variadic: A variadic input or output specifies N (i.e., the minimum arity) or more operands.
+// Only the last input or output of a custom op may be marked as variadic.
+// The homogeneity of the variadic input or output determines whether all operands must be of the same
+// tensor element type.
+typedef enum OrtCustomOpInputOutputCharacteristic {
+ INPUT_OUTPUT_REQUIRED = 0,
+ INPUT_OUTPUT_OPTIONAL,
+ INPUT_OUTPUT_VARIADIC,
+} OrtCustomOpInputOutputCharacteristic;
+
+/*
+ * The OrtCustomOp structure defines a custom op's schema and its kernel callbacks. The callbacks are filled in by
+ * the implementor of the custom op.
+ */
+struct OrtCustomOp {
+ uint32_t version; // Must be initialized to ORT_API_VERSION
+
+ // This callback creates the kernel, which is a user defined
+ // parameter that is passed to the Kernel* callbacks below. It is
+ // recommended to use CreateKernelV2 which allows for a safe error
+ // propagation by returning an OrtStatusPtr.
+ void*(ORT_API_CALL* CreateKernel)(_In_ const struct OrtCustomOp* op, _In_ const OrtApi* api,
+ _In_ const OrtKernelInfo* info);
+
+ // Returns the name of the op
+ const char*(ORT_API_CALL* GetName)(_In_ const struct OrtCustomOp* op);
+
+ // Returns the type of the execution provider, return nullptr to use CPU execution provider
+ const char*(ORT_API_CALL* GetExecutionProviderType)(_In_ const struct OrtCustomOp* op);
+
+ // Returns the count and types of the input & output tensors
+ ONNXTensorElementDataType(ORT_API_CALL* GetInputType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
+ size_t(ORT_API_CALL* GetInputTypeCount)(_In_ const struct OrtCustomOp* op);
+ ONNXTensorElementDataType(ORT_API_CALL* GetOutputType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
+ size_t(ORT_API_CALL* GetOutputTypeCount)(_In_ const struct OrtCustomOp* op);
+
+ // Perform a computation step. It is recommended to use
+ // KernelComputeV2 which allows for a safe error propagation by
+ // returning an OrtStatusPtr.
+ void(ORT_API_CALL* KernelCompute)(_In_ void* op_kernel, _In_ OrtKernelContext* context);
+ void(ORT_API_CALL* KernelDestroy)(_In_ void* op_kernel);
+
+ // Returns the characteristics of the input & output tensors
+ OrtCustomOpInputOutputCharacteristic(ORT_API_CALL* GetInputCharacteristic)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
+ OrtCustomOpInputOutputCharacteristic(ORT_API_CALL* GetOutputCharacteristic)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
+
+ // Returns the memory type of the input tensors. This API allows the custom op
+ // to place the inputs on specific devices. By default, it returns
+ // OrtMemTypeDefault, which means the input is placed on the default device for
+ // the execution provider. If the inputs need to be with different memory tyeps,
+ // this function can be overridden to return the specific memory types.
+ OrtMemType(ORT_API_CALL* GetInputMemoryType)(_In_ const struct OrtCustomOp* op, _In_ size_t index);
+
+ // Returns the minimum number of input arguments expected for the variadic input.
+ // Applicable only for custom ops that have a variadic input.
+ int(ORT_API_CALL* GetVariadicInputMinArity)(_In_ const struct OrtCustomOp* op);
+
+ // Returns true (non-zero) if all arguments of a variadic input have to be of the same type (homogeneous),
+ // and false (zero) otherwise.
+ // Applicable only for custom ops that have a variadic input.
+ int(ORT_API_CALL* GetVariadicInputHomogeneity)(_In_ const struct OrtCustomOp* op);
+
+ // Returns the minimum number of output values expected for the variadic output.
+ // Applicable only for custom ops that have a variadic output.
+ int(ORT_API_CALL* GetVariadicOutputMinArity)(_In_ const struct OrtCustomOp* op);
+
+ // Returns true (non-zero) if all outputs values of a variadic output have to be of the same type (homogeneous),
+ // and false (zero) otherwise.
+ // Applicable only for custom ops that have a variadic output.
+ int(ORT_API_CALL* GetVariadicOutputHomogeneity)(_In_ const struct OrtCustomOp* op);
+
+ // Create the kernel state which is passed to each compute call.
+ OrtStatusPtr(ORT_API_CALL* CreateKernelV2)(_In_ const struct OrtCustomOp* op, _In_ const OrtApi* api,
+ _In_ const OrtKernelInfo* info,
+ _Out_ void** kernel);
+
+ // Perform the computation step.
+ OrtStatusPtr(ORT_API_CALL* KernelComputeV2)(_In_ void* op_kernel, _In_ OrtKernelContext* context);
+
+ OrtStatusPtr(ORT_API_CALL* InferOutputShapeFn)(_In_ const struct OrtCustomOp* op, _In_ OrtShapeInferContext*);
+
+ // Get start range
+ int(ORT_API_CALL* GetStartVersion)(_In_ const struct OrtCustomOp* op);
+ int(ORT_API_CALL* GetEndVersion)(_In_ const struct OrtCustomOp* op);
+
+ // Get the inplace_map that defines which output can reuse which input
+ // Callers will provide 2 raw int* and pass in their address, this function will fill these 2 arrays
+ // when return, output (*output_index)[i] may reuse the input (*input_index[i]).
+ // The return value is the size of these 2 arrays.
+ // Callers are responsible to delete these 2 arrays after use by calling OrtCustomOp::ReleaseMayInplace().
+ size_t(ORT_API_CALL* GetMayInplace)(_Out_ int** input_index, _Out_ int** output_index);
+
+ // Release the pointer input_index and output_index allocated from GetMayInplace() function.
+ // If GetMayInplace() is defined, this function MUST be defined as well.
+ void(ORT_API_CALL* ReleaseMayInplace)(_Frees_ptr_opt_ int* input_index, _Frees_ptr_opt_ int* output_index);
+
+ // Same as GetMayInplace() and ReleaseMayInplace()
+ size_t(ORT_API_CALL* GetAliasMap)(_Out_ int** input_index, _Out_ int** output_index);
+ void(ORT_API_CALL* ReleaseAliasMap)(_Frees_ptr_opt_ int* input_index, _Frees_ptr_opt_ int* output_index);
+};
+
+/*
+ * This is the old way to add the CUDA provider to the session, please use SessionOptionsAppendExecutionProvider_CUDA above to access the latest functionality
+ * This function always exists, but will only succeed if Onnxruntime was built with CUDA support and the CUDA provider shared library exists
+ *
+ * \param device_id CUDA device id, starts from zero.
+ */
+ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessionOptions* options, int device_id);
+
+/*
+ * This is the old way to add the ROCm provider to the session, please use
+ * SessionOptionsAppendExecutionProvider_ROCM above to access the latest functionality
+ * This function always exists, but will only succeed if Onnxruntime was built with
+ * HIP support and the ROCm provider shared library exists
+ *
+ * \param device_id HIP device id, starts from zero.
+ */
+ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_ROCM, _In_ OrtSessionOptions* options, int device_id);
+
+/*
+ * This is the old way to add the MIGraphX provider to the session, please use
+ * SessionOptionsAppendExecutionProvider_MIGraphX above to access the latest functionality
+ * This function always exists, but will only succeed if Onnxruntime was built with
+ * HIP support and the MIGraphX provider shared library exists
+ *
+ * \param device_id HIP device id, starts from zero.
+ */
+ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_MIGraphX, _In_ OrtSessionOptions* options, int device_id);
+
+/*
+ * This is the old way to add the oneDNN provider to the session, please use
+ * SessionOptionsAppendExecutionProvider_oneDNN above to access the latest functionality
+ * This function always exists, but will only succeed if Onnxruntime was built with
+ * oneDNN support and the oneDNN provider shared library exists
+ *
+ * \param use_arena zero: false. non-zero: true.
+ */
+ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Dnnl, _In_ OrtSessionOptions* options, int use_arena);
+
+/*
+ * This is the old way to add the TensorRT provider to the session, please use SessionOptionsAppendExecutionProvider_TensorRT_V2 above to access the latest functionality
+ * This function always exists, but will only succeed if Onnxruntime was built with TensorRT support and the TensorRT provider shared library exists
+ *
+ * \param device_id CUDA device id, starts from zero.
+ */
+ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Tensorrt, _In_ OrtSessionOptions* options, int device_id);
+
+#ifdef __cplusplus
+}
+#endif
+/// @}
diff --git a/third_party/onnxruntime/lib/libonnxruntime.so b/third_party/onnxruntime/lib/libonnxruntime.so
new file mode 120000
index 0000000..a64790a
--- /dev/null
+++ b/third_party/onnxruntime/lib/libonnxruntime.so
@@ -0,0 +1 @@
+libonnxruntime.so.1 \ No newline at end of file
diff --git a/third_party/onnxruntime/lib/libonnxruntime.so.1 b/third_party/onnxruntime/lib/libonnxruntime.so.1
new file mode 120000
index 0000000..95a5f90
--- /dev/null
+++ b/third_party/onnxruntime/lib/libonnxruntime.so.1
@@ -0,0 +1 @@
+libonnxruntime.so.1.21.0 \ No newline at end of file
diff --git a/third_party/onnxruntime/lib/libonnxruntime.so.1.21.0 b/third_party/onnxruntime/lib/libonnxruntime.so.1.21.0
new file mode 100755
index 0000000..a643bd6
--- /dev/null
+++ b/third_party/onnxruntime/lib/libonnxruntime.so.1.21.0
Binary files differ