diff --git a/.github/actions/rust-toolchain-setup/action.yml b/.github/actions/rust-toolchain-setup/action.yml
new file mode 100644
index 0000000000000..bf73fede16c7f
--- /dev/null
+++ b/.github/actions/rust-toolchain-setup/action.yml
@@ -0,0 +1,44 @@
+# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
+
+name: 'Rust toolchain setup'
+description: 'Common setup steps for GitHub workflows for Rust projects'
+
+runs:
+ using: composite
+ steps:
+ - uses: dtolnay/rust-toolchain@1.71.0
+ with:
+ components: clippy, rustfmt
+ - uses: extractions/setup-just@v1
+ with:
+ just-version: '1.15.0' # optional semver specification, otherwise latest
+
+ ###
+ ### Linux setup
+ ###
+ - name: rustup
+ # We need to use the nightly rust tool change to enable registry-auth / to connect to ADO feeds.
+ if: ${{ (runner.os == 'Linux') }}
+ run: |
+ rustup set profile minimal
+ rustup install
+ shell: bash
+ # - name: Cargo login
+ # if: ${{ (runner.os == 'Linux') }}
+ # run: just cargo-login-ci
+ # shell: bash
+
+ ###
+ ### Windows setup
+ ###
+ - name: rustup
+ # We need to use the nightly rust tool change to enable registry-auth / to connect to ADO feeds.
+ if: ${{ (runner.os == 'Windows') }}
+ run: |
+ rustup set profile minimal
+ rustup install
+ shell: pwsh
+ # - name: Cargo login
+ # if: ${{ (runner.os == 'Windows') }}
+ # run: just cargo-login-ci-windows
+ # shell: pwsh
diff --git a/.github/workflows/rust-ci.yml b/.github/workflows/rust-ci.yml
new file mode 100644
index 0000000000000..6c3f2eb0fbbe1
--- /dev/null
+++ b/.github/workflows/rust-ci.yml
@@ -0,0 +1,132 @@
+name: Rust
+
+on: [pull_request]
+
+env:
+ CARGO_TERM_COLOR: always
+ RUST_LOG: onnxruntime=debug,onnxruntime-sys=debug
+ RUST_BACKTRACE: 1
+ MANIFEST_PATH: ${{ github.workspace }}/rust/Cargo.toml
+
+jobs:
+ fmt:
+ name: Rustfmt
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/rust-toolchain-setup
+ - name: vendor onnxruntime source
+ run: just vendor
+ - name: fmt
+ run: cargo fmt --all -- --check
+
+ download:
+ name: Download prebuilt ONNX Runtime archive from build.rs
+ runs-on: ubuntu-latest
+ env:
+ ORT_RUST_STRATEGY=download
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/rust-toolchain-setup
+ - run: rustup target install x86_64-unknown-linux-gnu
+ - run: rustup target install x86_64-apple-darwin
+ - run: rustup target install i686-pc-windows-msvc
+ - run: rustup target install x86_64-pc-windows-msvc
+ # ******************************************************************
+ - name: Download prebuilt archive (CPU, x86_64-unknown-linux-gnu)
+ run: cargo build --target x86_64-unknown-linux-gnu --manifest-path ${{ env.MANIFEST_PATH }}
+ - name: Verify prebuilt archive downloaded (CPU, x86_64-unknown-linux-gnu)
+ run: ls -lh target/x86_64-unknown-linux-gnu/debug/build/onnxruntime-sys-*/out/onnxruntime-linux-x64-1.*.tgz
+ # ******************************************************************
+ - name: Download prebuilt archive (CPU, x86_64-apple-darwin)
+ run: cargo build --target x86_64-apple-darwin --manifest-path ${{ env.MANIFEST_PATH }}
+ - name: Verify prebuilt archive downloaded (CPU, x86_64-apple-darwin)
+ run: ls -lh target/x86_64-apple-darwin/debug/build/onnxruntime-sys-*/out/onnxruntime-osx-x64-1.*.tgz
+ # ******************************************************************
+ - name: Download prebuilt archive (CPU, i686-pc-windows-msvc)
+ run: cargo build --target i686-pc-windows-msvc --manifest-path ${{ env.MANIFEST_PATH }}
+ - name: Verify prebuilt archive downloaded (CPU, i686-pc-windows-msvc)
+ run: ls -lh target/i686-pc-windows-msvc/debug/build/onnxruntime-sys-*/out/onnxruntime-win-x86-1.*.zip
+ # ******************************************************************
+ - name: Download prebuilt archive (CPU, x86_64-pc-windows-msvc)
+ run: cargo build --target x86_64-pc-windows-msvc --manifest-path ${{ env.MANIFEST_PATH }}
+ - name: Verify prebuilt archive downloaded (CPU, x86_64-pc-windows-msvc)
+ run: ls -lh target/x86_64-pc-windows-msvc/debug/build/onnxruntime-sys-*/out/onnxruntime-win-x64-1.*.zip
+ # ******************************************************************
+ - name: Download prebuilt archive (GPU, x86_64-unknown-linux-gnu)
+ env:
+ ORT_USE_CUDA: "yes"
+ run: cargo build --target x86_64-unknown-linux-gnu --manifest-path ${{ env.MANIFEST_PATH }}
+ - name: Verify prebuilt archive downloaded (GPU, x86_64-unknown-linux-gnu)
+ run: ls -lh target/x86_64-unknown-linux-gnu/debug/build/onnxruntime-sys-*/out/onnxruntime-linux-x64-gpu-1.*.tgz
+ # ******************************************************************
+ - name: Download prebuilt archive (GPU, x86_64-pc-windows-msvc)
+ env:
+ ORT_USE_CUDA: "yes"
+ run: cargo build --target x86_64-pc-windows-msvc --manifest-path ${{ env.MANIFEST_PATH }}
+ - name: Verify prebuilt archive downloaded (GPU, x86_64-pc-windows-msvc)
+ run: ls -lh target/x86_64-pc-windows-msvc/debug/build/onnxruntime-sys-*/out/onnxruntime-win-gpu-x64-1.*.zip
+
+ test:
+ name: Test Suite
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ target:
+ [
+ x86_64-unknown-linux-gnu,
+ x86_64-apple-darwin,
+ x86_64-pc-windows-msvc,
+ i686-pc-windows-msvc,
+ ]
+ include:
+ - target: x86_64-unknown-linux-gnu
+ os: ubuntu-latest
+ - target: x86_64-apple-darwin
+ os: macos-latest
+ - target: x86_64-pc-windows-msvc
+ os: windows-latest
+ - target: i686-pc-windows-msvc
+ os: windows-latest
+ env:
+ CARGO_BUILD_TARGET: ${{ matrix.target }}
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/rust-toolchain-setup
+ - name: vendor onnxruntime source
+ run: just vendor
+ - run: rustup target install ${{ matrix.target }}
+ - name: Install additional packages (macOS)
+ if: contains(matrix.target, 'x86_64-apple-darwin')
+ run: brew install libomp
+ - name: Build (cargo build)
+ run: cargo build --all --manifest-path ${{ env.MANIFEST_PATH }}
+ - name: Build tests (cargo test)
+ run: cargo test --no-run --manifest-path ${{ env.MANIFEST_PATH }}
+ - name: Build onnxruntime with 'model-fetching' feature
+ run: cargo build --manifest-path ${{ env.MANIFEST_PATH }} --features model-fetching
+ - name: Test onnxruntime-sys
+ run: cargo build --package onnxruntime-sys -- --test-threads=1 --nocapture
+ - name: Test onnxruntime
+ run: cargo test --manifest-path ${{ env.MANIFEST_PATH }} --features model-fetching -- --test-threads=1 --nocapture
+
+ clippy:
+ name: Clippy
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/rust-toolchain-setup
+ - name: vendor onnxruntime source
+ run: just vendor
+ - run: clippy --all-features --manifest-path ${{ env.MANIFEST_PATH }} -- -D warnings
+
+ package-sys:
+ name: Package onnxruntime-sys
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: ./.github/actions/rust-toolchain-setup
+ - name: vendor onnxruntime source
+ run: just vendor
+ - run: cargo package --allow-dirty --package onnxruntime-sys
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index e49e0921af434..95607f297c6bd 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -13,14 +13,15 @@ jobs:
issues: write
pull-requests: write
steps:
- - uses: actions/stale@v4.1.1
+ - uses: actions/stale@v8.0.0
with:
# Comma separated list of labels that can be assigned to issues to exclude them from being marked as stale
exempt-issue-labels: contributions welcome, feature request, regression
# Override exempt-all-assignees but only to exempt the issues with an assignee to be marked as stale automatically
exempt-all-issue-assignees: true
# Used to ignore the issues and pull requests created before the start date
- start-date: 20220419
+ # Start date should be April 19, 2022 - corresponds to the day previous stale bot stopped working
+ start-date: '2022-04-19T00:00:00Z'
# Number of days without activity before the actions/stale action labels an issue
days-before-issue-stale: 30
# Number of days without activity before the actions/stale action closes an issue
diff --git a/.vscode/settings.json b/.vscode/settings.json
index fd28e2d7b335c..c4a08e3232a82 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -16,25 +16,6 @@
},
// Enable Python linting and Pylance type checking
"python.analysis.typeCheckingMode": "basic",
- "python.formatting.provider": "black",
- "python.formatting.blackArgs": [
- "--line-length",
- "120"
- ],
- "python.sortImports.args": [
- "--profile",
- "black",
- "--line-length",
- "120"
- ],
- "python.linting.enabled": true,
- "python.linting.flake8Enabled": true,
- "python.linting.pylintEnabled": true,
- "python.linting.pydocstyleEnabled": true,
- "python.linting.pydocstyleArgs": [
- "--convention=google"
- ],
- "python.linting.banditEnabled": true,
"cpplint.lineLength": 120,
"cpplint.filters": [
"-build/include_subdir",
diff --git a/cgmanifests/generated/cgmanifest.json b/cgmanifests/generated/cgmanifest.json
index 0886a29fa573e..12fbb291c3a70 100644
--- a/cgmanifests/generated/cgmanifest.json
+++ b/cgmanifests/generated/cgmanifest.json
@@ -286,7 +286,7 @@
"component": {
"type": "git",
"git": {
- "commitHash": "c4f6b8c6bc94ff69048492fb34df0dfaf1983933",
+ "commitHash": "6f47420213f757831fae65c686aa471749fa8d60",
"repositoryUrl": "https://github.com/NVIDIA/cutlass.git"
},
"comments": "cutlass"
@@ -316,7 +316,7 @@
"component": {
"type": "git",
"git": {
- "commitHash": "d52ec01652b7d620386251db92455968d8d90bdc",
+ "commitHash": "a4f72a314a85732ed67d5aa8d1088d207a7e0e61",
"repositoryUrl": "https://github.com/ROCmSoftwarePlatform/composable_kernel.git"
},
"comments": "composable_kernel"
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 94181448fd21c..5796db03fed7c 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -114,9 +114,7 @@ option(onnxruntime_ENABLE_LTO "Enable link time optimization" OFF)
option(onnxruntime_CROSS_COMPILING "Cross compiling onnx runtime" OFF)
option(onnxruntime_GCOV_COVERAGE "Compile with options necessary to run code coverage" OFF)
option(onnxruntime_DONT_VECTORIZE "Do not vectorize operations in Eigen" OFF)
-
-#It's preferred to turn it OFF when onnxruntime is dynamically linked to PROTOBUF. But Tensort always required the full version of protobuf.
-cmake_dependent_option(onnxruntime_USE_FULL_PROTOBUF "Link to libprotobuf instead of libprotobuf-lite when this option is ON" OFF "NOT onnxruntime_USE_TENSORRT" ON)
+option(onnxruntime_USE_FULL_PROTOBUF "Link to libprotobuf instead of libprotobuf-lite when this option is ON" OFF)
option(tensorflow_C_PACKAGE_PATH "Path to tensorflow C package installation dir")
option(onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS "Enable operator implemented in language other than cpp" OFF)
option(onnxruntime_DEBUG_NODE_INPUTS_OUTPUTS "Dump debug information about node inputs and outputs when executing the model." OFF)
@@ -526,7 +524,21 @@ if(NOT WIN32 AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
find_package(Iconv REQUIRED)
set(ICONV_LIB Iconv::Iconv)
endif()
+
find_package(Patch)
+if (WIN32 AND NOT Patch_FOUND)
+ # work around CI machines missing patch from the git install by falling back to the binary in this repo.
+ # replicate what happens in https://github.com/Kitware/CMake/blob/master/Modules/FindPatch.cmake but without
+ # the hardcoded suffixes in the path to the patch binary.
+ find_program(Patch_EXECUTABLE NAMES patch PATHS ${PROJECT_SOURCE_DIR}/external/git.Win32.2.41.03.patch)
+ if(Patch_EXECUTABLE)
+ set(Patch_FOUND 1)
+ if (NOT TARGET Patch::patch)
+ add_executable(Patch::patch IMPORTED)
+ set_property(TARGET Patch::patch PROPERTY IMPORTED_LOCATION ${Patch_EXECUTABLE})
+ endif()
+ endif()
+endif()
if(Patch_FOUND)
message("Patch found: ${Patch_EXECUTABLE}")
endif()
diff --git a/cmake/deps.txt b/cmake/deps.txt
index 275b5eaf6b976..49142372ab86e 100644
--- a/cmake/deps.txt
+++ b/cmake/deps.txt
@@ -51,7 +51,7 @@ pytorch_cpuinfo;https://github.com/pytorch/cpuinfo/archive/959002f82d7962a473d8b
re2;https://github.com/google/re2/archive/refs/tags/2022-06-01.zip;aa77313b76e91b531ee7f3e45f004c6a502a5374
safeint;https://github.com/dcleblanc/SafeInt/archive/refs/tags/3.0.28.zip;23f252040ff6cb9f1fd18575b32fa8fb5928daac
tensorboard;https://github.com/tensorflow/tensorboard/archive/373eb09e4c5d2b3cc2493f0949dc4be6b6a45e81.zip;67b833913605a4f3f499894ab11528a702c2b381
-cutlass;https://github.com/NVIDIA/cutlass/archive/refs/tags/v3.0.0.zip;0f95b3c1fc1bd1175c4a90b2c9e39074d1bccefd
+cutlass;https://github.com/NVIDIA/cutlass/archive/refs/tags/v3.1.0.zip;757f90a795034a89d4f48a79d1f009f7a04c8dee
utf8_range;https://github.com/protocolbuffers/utf8_range/archive/72c943dea2b9240cd09efde15191e144bc7c7d38.zip;9925739c9debc0efa2adcb194d371a35b6a03156
extensions;https://github.com/microsoft/onnxruntime-extensions/archive/94142d8391c9791ec71c38336436319a2d4ac7a0.zip;4365ac5140338b4cb75a39944a4be276e3829b3c
-composable_kernel;https://github.com/ROCmSoftwarePlatform/composable_kernel/archive/d52ec01652b7d620386251db92455968d8d90bdc.zip;6b5ce8edf3625f8817086c194fbf94b664e1b0e0
+composable_kernel;https://github.com/ROCmSoftwarePlatform/composable_kernel/archive/a4f72a314a85732ed67d5aa8d1088d207a7e0e61.zip;f57357ab6d300e207a632d034ebc8aa036a090d9
diff --git a/cmake/external/abseil-cpp.natvis b/cmake/external/abseil-cpp.natvis
index 708d6ba18750b..1e5a36fb9efb9 100644
--- a/cmake/external/abseil-cpp.natvis
+++ b/cmake/external/abseil-cpp.natvis
@@ -30,7 +30,6 @@
- empty
size={ _size() }
size=({_size()})
diff --git a/cmake/external/composable_kernel.cmake b/cmake/external/composable_kernel.cmake
index 7168cd1a22c53..b4e6c834c83ab 100644
--- a/cmake/external/composable_kernel.cmake
+++ b/cmake/external/composable_kernel.cmake
@@ -12,13 +12,14 @@ if(NOT composable_kernel_POPULATED)
FetchContent_Populate(composable_kernel)
set(BUILD_DEV OFF CACHE BOOL "Disable -Weverything, otherwise, error: 'constexpr' specifier is incompatible with C++98 [-Werror,-Wc++98-compat]" FORCE)
# Exclude i8 device gemm instances due to excessive long compilation time and not being used
- set(DTYPES fp32 fp16 bf16)
+ set(DTYPES fp32 fp16 bf16 fp8)
set(INSTANCES_ONLY ON)
add_subdirectory(${composable_kernel_SOURCE_DIR} ${composable_kernel_BINARY_DIR} EXCLUDE_FROM_ALL)
add_library(onnxruntime_composable_kernel_includes INTERFACE)
target_include_directories(onnxruntime_composable_kernel_includes INTERFACE
${composable_kernel_SOURCE_DIR}/include
+ ${composable_kernel_BINARY_DIR}/include
${composable_kernel_SOURCE_DIR}/library/include)
target_compile_definitions(onnxruntime_composable_kernel_includes INTERFACE __fp32__ __fp16__ __bf16__)
endif()
diff --git a/cmake/external/cutlass.cmake b/cmake/external/cutlass.cmake
index 8c5d81d638ced..983eecdd88235 100644
--- a/cmake/external/cutlass.cmake
+++ b/cmake/external/cutlass.cmake
@@ -4,7 +4,6 @@ if (onnxruntime_USE_FLASH_ATTENTION OR onnxruntime_USE_MEMORY_EFFICIENT_ATTENTIO
cutlass
URL ${DEP_URL_cutlass}
URL_HASH SHA1=${DEP_SHA1_cutlass}
- PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/cutlass/cutlass.patch
)
FetchContent_GetProperties(cutlass)
diff --git a/cmake/external/eigen.cmake b/cmake/external/eigen.cmake
index c0f7ddc50eb98..b123adb624fa4 100644
--- a/cmake/external/eigen.cmake
+++ b/cmake/external/eigen.cmake
@@ -1,23 +1,14 @@
-
if (onnxruntime_USE_PREINSTALLED_EIGEN)
add_library(eigen INTERFACE)
file(TO_CMAKE_PATH ${eigen_SOURCE_PATH} eigen_INCLUDE_DIRS)
target_include_directories(eigen INTERFACE ${eigen_INCLUDE_DIRS})
else ()
- if (onnxruntime_USE_ACL)
- FetchContent_Declare(
- eigen
- URL ${DEP_URL_eigen}
- URL_HASH SHA1=${DEP_SHA1_eigen}
- PATCH_COMMAND ${Patch_EXECUTABLE} --ignore-space-change --ignore-whitespace < ${PROJECT_SOURCE_DIR}/patches/eigen/Fix_Eigen_Build_Break.patch
- )
- else()
- FetchContent_Declare(
- eigen
- URL ${DEP_URL_eigen}
- URL_HASH SHA1=${DEP_SHA1_eigen}
- )
- endif()
+ FetchContent_Declare(
+ eigen
+ URL ${DEP_URL_eigen}
+ URL_HASH SHA1=${DEP_SHA1_eigen}
+ )
+
FetchContent_Populate(eigen)
set(eigen_INCLUDE_DIRS "${eigen_SOURCE_DIR}")
endif()
diff --git a/cmake/external/git.Win32.2.41.03.patch/msys-2.0.dll b/cmake/external/git.Win32.2.41.03.patch/msys-2.0.dll
new file mode 100644
index 0000000000000..686afedb50bf3
Binary files /dev/null and b/cmake/external/git.Win32.2.41.03.patch/msys-2.0.dll differ
diff --git a/cmake/external/git.Win32.2.41.03.patch/msys-gcc_s-1.dll b/cmake/external/git.Win32.2.41.03.patch/msys-gcc_s-1.dll
new file mode 100644
index 0000000000000..1750b9ce92d72
Binary files /dev/null and b/cmake/external/git.Win32.2.41.03.patch/msys-gcc_s-1.dll differ
diff --git a/cmake/external/git.Win32.2.41.03.patch/patch.exe b/cmake/external/git.Win32.2.41.03.patch/patch.exe
new file mode 100644
index 0000000000000..8d784cb5d7e40
Binary files /dev/null and b/cmake/external/git.Win32.2.41.03.patch/patch.exe differ
diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake
index 019c6341d2e46..0fa5163dc06bf 100644
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
@@ -335,6 +335,7 @@ if(onnxruntime_USE_CUDA)
URL ${DEP_URL_microsoft_gsl}
URL_HASH SHA1=${DEP_SHA1_microsoft_gsl}
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/gsl/1064.patch
+ FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL
)
else()
FetchContent_Declare(
diff --git a/cmake/onnxruntime.cmake b/cmake/onnxruntime.cmake
index 9d9b006c595bb..c900f4d4b09a5 100644
--- a/cmake/onnxruntime.cmake
+++ b/cmake/onnxruntime.cmake
@@ -282,11 +282,7 @@ endif()
# Assemble the Apple static framework (iOS and macOS)
if(onnxruntime_BUILD_APPLE_FRAMEWORK)
- if(${CMAKE_SYSTEM_NAME} STREQUAL "iOS")
- set(STATIC_FRAMEWORK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}-${CMAKE_OSX_SYSROOT})
- else() # macOS
- set(STATIC_FRAMEWORK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
- endif()
+ set(STATIC_FRAMEWORK_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}-${CMAKE_OSX_SYSROOT})
# Setup the various directories required. Remove any existing ones so we start with a clean directory.
set(STATIC_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/static_libraries)
diff --git a/cmake/onnxruntime_mlas.cmake b/cmake/onnxruntime_mlas.cmake
index a62b1b259d109..04efa5c2b4f6d 100644
--- a/cmake/onnxruntime_mlas.cmake
+++ b/cmake/onnxruntime_mlas.cmake
@@ -33,6 +33,7 @@ onnxruntime_add_static_library(onnxruntime_mlas
${MLAS_SRC_DIR}/qpostprocessor.cpp
${MLAS_SRC_DIR}/qlgavgpool.cpp
${MLAS_SRC_DIR}/qdwconv_kernelsize.cpp
+ ${MLAS_SRC_DIR}/sqnbitgemm.cpp
)
if (NOT onnxruntime_ORT_MINIMAL_BUILD)
@@ -68,6 +69,7 @@ function(setup_mlas_source_for_windows)
${MLAS_SRC_DIR}/qgemm_kernel_neon.cpp
${MLAS_SRC_DIR}/qgemm_kernel_udot.cpp
${MLAS_SRC_DIR}/qgemm_kernel_sdot.cpp
+ ${MLAS_SRC_DIR}/sqnbitgemm_kernel_neon.cpp
)
set(mlas_platform_preprocess_srcs
@@ -334,6 +336,7 @@ else()
${MLAS_SRC_DIR}/qgemm_kernel_neon.cpp
${MLAS_SRC_DIR}/qgemm_kernel_udot.cpp
${MLAS_SRC_DIR}/qgemm_kernel_sdot.cpp
+ ${MLAS_SRC_DIR}/sqnbitgemm_kernel_neon.cpp
)
if (NOT APPLE)
set(mlas_platform_srcs
diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake
index a9a78668b4810..345ef2b504aa4 100644
--- a/cmake/onnxruntime_python.cmake
+++ b/cmake/onnxruntime_python.cmake
@@ -339,9 +339,6 @@ configure_file(${ONNXRUNTIME_ROOT}/python/_pybind_state.py.in
${CMAKE_BINARY_DIR}/onnxruntime/capi/_pybind_state.py)
if (onnxruntime_ENABLE_TRAINING)
- file(GLOB onnxruntime_python_capi_training_srcs CONFIGURE_DEPENDS
- "${ORTTRAINING_SOURCE_DIR}/python/deprecated/*.py"
- )
file(GLOB onnxruntime_python_root_srcs CONFIGURE_DEPENDS
"${ORTTRAINING_SOURCE_DIR}/python/training/*.py"
)
@@ -419,10 +416,6 @@ if (onnxruntime_ENABLE_TRAINING)
"${ORTTRAINING_SOURCE_DIR}/python/training/onnxblock/optim/*"
)
endif()
-else()
- file(GLOB onnxruntime_python_capi_training_srcs CONFIGURE_DEPENDS
- "${ONNXRUNTIME_ROOT}/python/training/*.py"
- )
endif()
if (onnxruntime_BUILD_UNIT_TESTS)
@@ -443,6 +436,9 @@ if (onnxruntime_BUILD_UNIT_TESTS)
file(GLOB onnxruntime_python_transformers_testdata_whisper CONFIGURE_DEPENDS
"${ONNXRUNTIME_ROOT}/test/python/transformers/test_data/models/whisper/*.onnx"
)
+ file(GLOB onnxruntime_python_transformers_testdata_conformer CONFIGURE_DEPENDS
+ "${ONNXRUNTIME_ROOT}/test/python/transformers/test_data/models/conformer/*.onnx"
+ )
endif()
file(GLOB onnxruntime_python_tools_srcs CONFIGURE_DEPENDS
@@ -556,6 +552,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E make_directory $/transformers/test_data/models
COMMAND ${CMAKE_COMMAND} -E make_directory $/transformers/test_data/models/whisper
COMMAND ${CMAKE_COMMAND} -E make_directory $/eager_test
+ COMMAND ${CMAKE_COMMAND} -E make_directory $/transformers/test_data/models/conformer
COMMAND ${CMAKE_COMMAND} -E copy
${ONNXRUNTIME_ROOT}/__init__.py
$/onnxruntime/
@@ -577,9 +574,6 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_BINARY_DIR}/onnxruntime/capi/_pybind_state.py
$/onnxruntime/capi/
- COMMAND ${CMAKE_COMMAND} -E copy
- ${onnxruntime_python_capi_training_srcs}
- $/onnxruntime/capi/training/
COMMAND ${CMAKE_COMMAND} -E copy
$
$/onnxruntime/capi/
@@ -711,6 +705,9 @@ if (onnxruntime_BUILD_UNIT_TESTS)
COMMAND ${CMAKE_COMMAND} -E copy
${onnxruntime_python_transformers_testdata_whisper}
$/transformers/test_data/models/whisper/
+ COMMAND ${CMAKE_COMMAND} -E copy
+ ${onnxruntime_python_transformers_testdata_conformer}
+ $/transformers/test_data/models/conformer/
)
endif()
@@ -750,9 +747,6 @@ if (onnxruntime_ENABLE_TRAINING)
COMMAND ${CMAKE_COMMAND} -E make_directory $/onnxruntime/training/utils
COMMAND ${CMAKE_COMMAND} -E make_directory $/onnxruntime/training/utils/data/
COMMAND ${CMAKE_COMMAND} -E make_directory $/onnxruntime/training/utils/hooks/
- COMMAND ${CMAKE_COMMAND} -E copy
- ${onnxruntime_python_capi_training_srcs}
- $/onnxruntime/capi/training/
COMMAND ${CMAKE_COMMAND} -E copy
${onnxruntime_python_root_srcs}
$/onnxruntime/training/
diff --git a/cmake/onnxruntime_rocm_hipify.cmake b/cmake/onnxruntime_rocm_hipify.cmake
index ce27bf756f247..980bd59b22c3f 100644
--- a/cmake/onnxruntime_rocm_hipify.cmake
+++ b/cmake/onnxruntime_rocm_hipify.cmake
@@ -51,6 +51,7 @@ set(contrib_ops_excluded_files
"math/gemm_float8.cc"
"math/gemm_float8.cu"
"math/gemm_float8.h"
+ "moe/*"
"quantization/attention_quantization.cc"
"quantization/attention_quantization.h"
"quantization/attention_quantization_impl.cu"
diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake
index bdb0230a8ebd0..a52e941b235b4 100644
--- a/cmake/onnxruntime_unittests.cmake
+++ b/cmake/onnxruntime_unittests.cmake
@@ -906,7 +906,7 @@ if (onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set_target_properties(onnxruntime_test_all PROPERTIES LINK_DEPENDS ${TEST_SRC_DIR}/wasm/onnxruntime_test_all_adapter.js)
- set_target_properties(onnxruntime_test_all PROPERTIES LINK_FLAGS "-s STACK_SIZE=5242880 -s ALLOW_MEMORY_GROWTH=1 --pre-js \"${TEST_SRC_DIR}/wasm/onnxruntime_test_all_adapter.js\" -s \"EXPORTED_RUNTIME_METHODS=['FS']\" --preload-file ${CMAKE_CURRENT_BINARY_DIR}/testdata@/testdata -s EXIT_RUNTIME=1 -s DEMANGLE_SUPPORT=1")
+ set_target_properties(onnxruntime_test_all PROPERTIES LINK_FLAGS "-s STACK_SIZE=5242880 -s ALLOW_MEMORY_GROWTH=1 -s MAXIMUM_MEMORY=4294967296 --pre-js \"${TEST_SRC_DIR}/wasm/onnxruntime_test_all_adapter.js\" -s \"EXPORTED_RUNTIME_METHODS=['FS']\" --preload-file ${CMAKE_CURRENT_BINARY_DIR}/testdata@/testdata -s EXIT_RUNTIME=1 -s DEMANGLE_SUPPORT=1")
if (onnxruntime_ENABLE_WEBASSEMBLY_THREADS)
set_property(TARGET onnxruntime_test_all APPEND_STRING PROPERTY LINK_FLAGS " -s DEFAULT_PTHREAD_STACK_SIZE=131072 -s PROXY_TO_PTHREAD=1")
endif()
diff --git a/cmake/patches/composable_kernel/Fix_Clang_Build.patch b/cmake/patches/composable_kernel/Fix_Clang_Build.patch
index d564ffba914fe..02b30af9eef52 100644
--- a/cmake/patches/composable_kernel/Fix_Clang_Build.patch
+++ b/cmake/patches/composable_kernel/Fix_Clang_Build.patch
@@ -1,17 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
-index 514b98fde..59c8a568a 100644
+index b09da41a8..fca2bdf69 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
-@@ -1,7 +1,7 @@
- cmake_minimum_required(VERSION 3.14)
+@@ -19,7 +19,7 @@ endif()
+ set(version 1.1.0)
# Check support for CUDA/HIP in Cmake
--project(composable_kernel)
-+project(composable_kernel LANGUAGES CXX HIP)
+-project(composable_kernel VERSION ${version})
++project(composable_kernel VERSION ${version} LANGUAGES CXX HIP)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
-@@ -94,27 +94,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+@@ -173,27 +173,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
message("CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
@@ -39,7 +39,7 @@ index 514b98fde..59c8a568a 100644
## HIP
find_package(HIP REQUIRED)
# Override HIP version in config.h, if necessary.
-@@ -136,8 +115,6 @@ if( DEFINED CK_OVERRIDE_HIP_VERSION_PATCH )
+@@ -215,8 +194,6 @@ if( DEFINED CK_OVERRIDE_HIP_VERSION_PATCH )
message(STATUS "CK_HIP_VERSION_PATCH overriden with ${CK_OVERRIDE_HIP_VERSION_PATCH}")
endif()
message(STATUS "Build with HIP ${HIP_VERSION}")
@@ -48,7 +48,7 @@ index 514b98fde..59c8a568a 100644
## tidy
include(EnableCompilerWarnings)
-@@ -391,11 +368,3 @@ rocm_install(FILES
+@@ -489,11 +466,3 @@ rocm_install(FILES
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RPM_PACKAGE_LICENSE "MIT")
@@ -61,20 +61,21 @@ index 514b98fde..59c8a568a 100644
- HEADER_ONLY
-)
diff --git a/library/src/tensor_operation_instance/gpu/CMakeLists.txt b/library/src/tensor_operation_instance/gpu/CMakeLists.txt
-index 1d54a141b..4edd7dbfb 100644
+index a0478c9f0..1e7782cd4 100644
--- a/library/src/tensor_operation_instance/gpu/CMakeLists.txt
+++ b/library/src/tensor_operation_instance/gpu/CMakeLists.txt
-@@ -1,7 +1,13 @@
- function(add_instance_library INSTANCE_NAME)
- message("adding instance ${INSTANCE_NAME}")
-+ set_source_files_properties(${ARGN} PROPERTIES LANGUAGE HIP)
- add_library(${INSTANCE_NAME} OBJECT ${ARGN})
-+ # Always disable debug symbol and C debug assert due to
-+ # - Linker error: ... relocation truncated to fit ..., caused by object files to be linked are too huge.
-+ # - https://github.com/ROCmSoftwarePlatform/composable_kernel/issues/622
-+ target_compile_options(${INSTANCE_NAME} PRIVATE -g0 -DNDEBUG)
- target_compile_features(${INSTANCE_NAME} PUBLIC)
-+ target_compile_definitions(${INSTANCE_NAME} PRIVATE "__HIP_PLATFORM_AMD__=1" "__HIP_PLATFORM_HCC__=1")
- set_target_properties(${INSTANCE_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
- clang_tidy_check(${INSTANCE_NAME})
- endfunction(add_instance_library INSTANCE_NAME)
+@@ -44,8 +44,14 @@ function(add_instance_library INSTANCE_NAME)
+ endforeach()
+ #only continue if there are some source files left on the list
+ if(ARGN)
++ set_source_files_properties(${ARGN} PROPERTIES LANGUAGE HIP)
+ add_library(${INSTANCE_NAME} OBJECT ${ARGN})
++ # Always disable debug symbol and C debug assert due to
++ # - Linker error: ... relocation truncated to fit ..., caused by object files to be linked are too huge.
++ # - https://github.com/ROCmSoftwarePlatform/composable_kernel/issues/622
++ target_compile_options(${INSTANCE_NAME} PRIVATE -g0 -DNDEBUG)
+ target_compile_features(${INSTANCE_NAME} PUBLIC)
++ target_compile_definitions(${INSTANCE_NAME} PRIVATE "__HIP_PLATFORM_AMD__=1" "__HIP_PLATFORM_HCC__=1")
+ set_target_properties(${INSTANCE_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
+ clang_tidy_check(${INSTANCE_NAME})
+ set(result 0)
diff --git a/cmake/patches/cutlass/cutlass.patch b/cmake/patches/cutlass/cutlass.patch
deleted file mode 100644
index bda1de8b46916..0000000000000
--- a/cmake/patches/cutlass/cutlass.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-diff --git a/include/cute/numeric/complex.hpp b/include/cute/numeric/complex.hpp
-index 3790ebd3..cf727d09 100644
---- a/include/cute/numeric/complex.hpp
-+++ b/include/cute/numeric/complex.hpp
-@@ -41,10 +41,14 @@
- // With CUDA 11.4, builds show spurious "-Wconversion" warnings
- // on line 656 of thrust/detail/type_traits.h.
- // These pragmas suppress the warnings.
-+#ifdef __GNUC__
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wconversion"
-+#endif
- #include
-+#ifdef __GNUC__
- #pragma GCC diagnostic pop
-+#endif
-
- #include
-
-diff --git a/include/cutlass/functional.h b/include/cutlass/functional.h
-index 59aec46a..8f2a913a 100644
---- a/include/cutlass/functional.h
-+++ b/include/cutlass/functional.h
-@@ -89,7 +89,7 @@ struct multiplies {
- }
- };
-
--#if defined(__CUDA_ARCH__)
-+#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 530)
- /// Partial specializations needed when __CUDA_NO_HALF2_OPERATORS__ is set
- template<>
- struct plus<__half2> {
-@@ -143,12 +143,12 @@ struct multiplies<__half> {
-
-
- // Maximum with nan propogation
--// To propgate the NANs, the "max" of a two element that contains NaNs should also return a NaN
-+// To propgate the NANs, the "max" of a two element that contains NaNs should also return a NaN
- template
- struct maximum_with_nan_propogation {
- CUTLASS_HOST_DEVICE
- T operator()(T const &lhs, T const &rhs) const {
-- return lhs > rhs or std::isnan(lhs) ? lhs : rhs;
-+ return lhs > rhs or isnan(lhs) ? lhs : rhs;
- }
- };
-
-@@ -160,7 +160,7 @@ struct maximum_with_nan_propogation {
- #if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ >= 800)
- asm volatile("max.NaN.f32 %0, %1, %2;\n" : "=f"(res) : "f"(lhs), "f"(rhs));
- #else
-- res = lhs > rhs or std::isnan(lhs) ? lhs : rhs;
-+ res = lhs > rhs or isnan(lhs) ? lhs : rhs;
- #endif
- return res;
- }
-@@ -233,7 +233,7 @@ struct negate {
- }
- };
-
--/// Greater equal
-+/// Greater equal
- template
- struct greater_equal {
- CUTLASS_HOST_DEVICE
-@@ -242,7 +242,7 @@ struct greater_equal {
- }
- };
-
--/// Greater
-+/// Greater
- template
- struct greater {
- CUTLASS_HOST_DEVICE
-@@ -251,7 +251,7 @@ struct greater {
- }
- };
-
--/// Less equal
-+/// Less equal
- template
- struct less_equal {
- CUTLASS_HOST_DEVICE
-@@ -260,7 +260,7 @@ struct less_equal {
- }
- };
-
--/// Less
-+/// Less
- template
- struct less {
- CUTLASS_HOST_DEVICE
diff --git a/cmake/patches/eigen/Fix_Eigen_Build_Break.patch b/cmake/patches/eigen/Fix_Eigen_Build_Break.patch
deleted file mode 100644
index ca0e0fd23ddee..0000000000000
--- a/cmake/patches/eigen/Fix_Eigen_Build_Break.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-diff -Naur git_org/cmake/external/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h git/cmake/external/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h
---- git_org/cmake/external/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h 2019-07-17 15:27:59.540667336 -0500
-+++ git/cmake/external/eigen/Eigen/src/Core/products/GeneralBlockPanelKernel.h 2019-07-17 15:30:16.000000000 -0500
-@@ -1076,8 +1076,9 @@
- dest = *b;
- }
-
-- EIGEN_STRONG_INLINE void updateRhs(const RhsScalar* b, RhsPacketx4& dest) const
-- {}
-+ EIGEN_STRONG_INLINE void updateRhs(const RhsScalar*, RhsPacketx4&) const
-+ {
-+ }
-
- EIGEN_STRONG_INLINE void loadRhsQuad(const RhsScalar* b, RhsPacket& dest) const
- {
-@@ -1145,8 +1146,9 @@
- loadRhs(b,dest);
- }
-
-- EIGEN_STRONG_INLINE void updateRhs(const RhsScalar* b, RhsPacketx4& dest) const
-- {}
-+ EIGEN_STRONG_INLINE void updateRhs(const RhsScalar*, RhsPacketx4&) const
-+ {
-+ }
-
- EIGEN_STRONG_INLINE void loadRhsQuad(const RhsScalar* b, RhsPacket& dest) const
- {
diff --git a/cmake/patches/xnnpack/AddEmscriptenAndIosSupport.patch b/cmake/patches/xnnpack/AddEmscriptenAndIosSupport.patch
index 460b4d97c499b..736fffb1e384c 100644
--- a/cmake/patches/xnnpack/AddEmscriptenAndIosSupport.patch
+++ b/cmake/patches/xnnpack/AddEmscriptenAndIosSupport.patch
@@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
-index dba9b4687..bcaa18ad7 100755
+index dba9b4687..a4345898d 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -122,7 +122,7 @@ ENDIF()
@@ -25,3 +25,15 @@ index dba9b4687..bcaa18ad7 100755
SET_TARGET_PROPERTIES(XNNPACK PROPERTIES C_EXTENSIONS YES)
ENDIF()
IF(NOT MSVC)
+@@ -543,8 +548,9 @@ ENDIF()
+ IF(XNNPACK_TARGET_PROCESSOR STREQUAL "arm")
+ SET_PROPERTY(SOURCE ${ALL_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -marm ")
+ SET_PROPERTY(SOURCE ${PROD_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -marm ")
+- SET_PROPERTY(SOURCE ${ALL_ARMSIMD32_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv6 -mfpu=vfp -munaligned-access ")
+- SET_PROPERTY(SOURCE ${PROD_ARMSIMD32_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv6 -mfpu=vfp -munaligned-access ")
++ # set this to armv7-a to workaround build issue. we don't target armv6 so it shouldn't matter
++ SET_PROPERTY(SOURCE ${ALL_ARMSIMD32_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=vfp -munaligned-access ")
++ SET_PROPERTY(SOURCE ${PROD_ARMSIMD32_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=vfp -munaligned-access ")
+ SET_PROPERTY(SOURCE ${ALL_NEON_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=neon ")
+ SET_PROPERTY(SOURCE ${PROD_NEON_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=neon ")
+ SET_PROPERTY(SOURCE ${ALL_NEONFP16_MICROKERNEL_SRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -march=armv7-a -mfpu=neon-fp16 ")
diff --git a/csharp/OnnxRuntime.CSharp.proj b/csharp/OnnxRuntime.CSharp.proj
index 69bfd9896f1e4..5e43756ced7b1 100644
--- a/csharp/OnnxRuntime.CSharp.proj
+++ b/csharp/OnnxRuntime.CSharp.proj
@@ -92,6 +92,13 @@ CMake creates a target to this project
+
+
+
+
+
-
@@ -109,9 +116,9 @@ CMake creates a target to this project
@@ -119,11 +126,11 @@ CMake creates a target to this project
diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.shared.cs b/csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.shared.cs
index f722ca9d30fa4..4128524b30483 100644
--- a/csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.shared.cs
+++ b/csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.shared.cs
@@ -373,7 +373,7 @@ static NativeMethods()
OrtAddSessionConfigEntry = (DOrtAddSessionConfigEntry)Marshal.GetDelegateForFunctionPointer(api_.AddSessionConfigEntry, typeof(DOrtAddSessionConfigEntry));
OrtAddInitializer = (DOrtAddInitializer)Marshal.GetDelegateForFunctionPointer(api_.AddInitializer, typeof(DOrtAddInitializer));
SessionOptionsAppendExecutionProvider_TensorRT = (DSessionOptionsAppendExecutionProvider_TensorRT)Marshal.GetDelegateForFunctionPointer(
- api_.SessionOptionsAppendExecutionProvider_TensorRT, typeof(DSessionOptionsAppendExecutionProvider_TensorRT));
+ api_.SessionOptionsAppendExecutionProvider_TensorRT, typeof(DSessionOptionsAppendExecutionProvider_TensorRT));
OrtCreateRunOptions = (DOrtCreateRunOptions)Marshal.GetDelegateForFunctionPointer(api_.CreateRunOptions, typeof(DOrtCreateRunOptions));
OrtReleaseRunOptions = (DOrtReleaseRunOptions)Marshal.GetDelegateForFunctionPointer(api_.ReleaseRunOptions, typeof(DOrtReleaseRunOptions));
@@ -487,27 +487,26 @@ static NativeMethods()
OrtReleasePrepackedWeightsContainer = (DOrtReleasePrepackedWeightsContainer)Marshal.GetDelegateForFunctionPointer(api_.ReleasePrepackedWeightsContainer, typeof(DOrtReleasePrepackedWeightsContainer));
SessionOptionsAppendExecutionProvider_TensorRT_V2 = (DSessionOptionsAppendExecutionProvider_TensorRT_V2)Marshal.GetDelegateForFunctionPointer(
- api_.SessionOptionsAppendExecutionProvider_TensorRT_V2, typeof(DSessionOptionsAppendExecutionProvider_TensorRT_V2));
+ api_.SessionOptionsAppendExecutionProvider_TensorRT_V2, typeof(DSessionOptionsAppendExecutionProvider_TensorRT_V2));
OrtCreateTensorRTProviderOptions = (DOrtCreateTensorRTProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.CreateTensorRTProviderOptions, typeof(DOrtCreateTensorRTProviderOptions));
OrtUpdateTensorRTProviderOptions = (DOrtUpdateTensorRTProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.UpdateTensorRTProviderOptions, typeof(DOrtUpdateTensorRTProviderOptions));
OrtGetTensorRTProviderOptionsAsString = (DOrtGetTensorRTProviderOptionsAsString)Marshal.GetDelegateForFunctionPointer(api_.GetTensorRTProviderOptionsAsString, typeof(DOrtGetTensorRTProviderOptionsAsString));
OrtReleaseTensorRTProviderOptions = (DOrtReleaseTensorRTProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.ReleaseTensorRTProviderOptions, typeof(DOrtReleaseTensorRTProviderOptions));
SessionOptionsAppendExecutionProvider_CUDA = (DSessionOptionsAppendExecutionProvider_CUDA)Marshal.GetDelegateForFunctionPointer(
- api_.SessionOptionsAppendExecutionProvider_CUDA, typeof(DSessionOptionsAppendExecutionProvider_CUDA));
+ api_.SessionOptionsAppendExecutionProvider_CUDA, typeof(DSessionOptionsAppendExecutionProvider_CUDA));
SessionOptionsAppendExecutionProvider_CUDA_V2 = (DSessionOptionsAppendExecutionProvider_CUDA_V2)Marshal.GetDelegateForFunctionPointer(
- api_.SessionOptionsAppendExecutionProvider_CUDA_V2, typeof(DSessionOptionsAppendExecutionProvider_CUDA_V2));
+ api_.SessionOptionsAppendExecutionProvider_CUDA_V2, typeof(DSessionOptionsAppendExecutionProvider_CUDA_V2));
OrtCreateCUDAProviderOptions = (DOrtCreateCUDAProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.CreateCUDAProviderOptions, typeof(DOrtCreateCUDAProviderOptions));
OrtUpdateCUDAProviderOptions = (DOrtUpdateCUDAProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.UpdateCUDAProviderOptions, typeof(DOrtUpdateCUDAProviderOptions));
OrtGetCUDAProviderOptionsAsString = (DOrtGetCUDAProviderOptionsAsString)Marshal.GetDelegateForFunctionPointer(api_.GetCUDAProviderOptionsAsString, typeof(DOrtGetCUDAProviderOptionsAsString));
OrtReleaseCUDAProviderOptions = (DOrtReleaseCUDAProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.ReleaseCUDAProviderOptions, typeof(DOrtReleaseCUDAProviderOptions));
- SessionOptionsAppendExecutionProvider
- = (DSessionOptionsAppendExecutionProvider)Marshal.GetDelegateForFunctionPointer(
- api_.SessionOptionsAppendExecutionProvider,
- typeof(DSessionOptionsAppendExecutionProvider));
+ SessionOptionsAppendExecutionProvider = (DSessionOptionsAppendExecutionProvider)Marshal.GetDelegateForFunctionPointer(
+ api_.SessionOptionsAppendExecutionProvider,
+ typeof(DSessionOptionsAppendExecutionProvider));
OrtUpdateEnvWithCustomLogLevel = (DOrtUpdateEnvWithCustomLogLevel)Marshal.GetDelegateForFunctionPointer(api_.UpdateEnvWithCustomLogLevel, typeof(DOrtUpdateEnvWithCustomLogLevel));
SessionOptionsAppendExecutionProvider_ROCM = (DSessionOptionsAppendExecutionProvider_ROCM)Marshal.GetDelegateForFunctionPointer(
- api_.SessionOptionsAppendExecutionProvider_ROCM, typeof(DSessionOptionsAppendExecutionProvider_ROCM));
+ api_.SessionOptionsAppendExecutionProvider_ROCM, typeof(DSessionOptionsAppendExecutionProvider_ROCM));
OrtCreateROCMProviderOptions = (DOrtCreateROCMProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.CreateROCMProviderOptions, typeof(DOrtCreateROCMProviderOptions));
OrtUpdateROCMProviderOptions = (DOrtUpdateROCMProviderOptions)Marshal.GetDelegateForFunctionPointer(api_.UpdateROCMProviderOptions, typeof(DOrtUpdateROCMProviderOptions));
OrtGetROCMProviderOptionsAsString = (DOrtGetROCMProviderOptionsAsString)Marshal.GetDelegateForFunctionPointer(api_.GetROCMProviderOptionsAsString, typeof(DOrtGetROCMProviderOptionsAsString));
@@ -532,10 +531,10 @@ internal class NativeLib
[DllImport(NativeLib.DllName, CharSet = CharSet.Ansi)]
public static extern ref OrtApiBase OrtGetApiBase();
- #region Runtime/Environment API
+#region Runtime / Environment API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtCreateEnv(
+ public delegate IntPtr /* OrtStatus* */ DOrtCreateEnv(
OrtLoggingLevel defaultLoggingLevel,
byte[] /*const char* */ logId,
out IntPtr /*(OrtEnv*)*/ env);
@@ -543,7 +542,7 @@ internal class NativeLib
public static DOrtCreateEnv OrtCreateEnv;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtCreateEnvWithCustomLogger(
+ public delegate IntPtr /* OrtStatus* */ DOrtCreateEnvWithCustomLogger(
IntPtr /* (OrtLoggingFunction*) */ loggingFunction,
IntPtr /* (void*) */ loggerParam,
OrtLoggingLevel defaultLoggingLevel,
@@ -553,7 +552,7 @@ internal class NativeLib
public static DOrtCreateEnvWithCustomLogger OrtCreateEnvWithCustomLogger;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtCreateEnvWithGlobalThreadPools(
+ public delegate IntPtr /* OrtStatus* */ DOrtCreateEnvWithGlobalThreadPools(
OrtLoggingLevel defaultWarningLevel,
byte[] /*const char* */ logId,
IntPtr /*(const OrtThreadingOptions *) */ threadingOptions,
@@ -564,7 +563,7 @@ internal class NativeLib
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus* */ DOrtCreateEnvWithCustomLoggerAndGlobalThreadPools(
IntPtr /* OrtLoggingFunction */ loggingFunction,
- IntPtr /* void* */loggerParam,
+ IntPtr /* void* */ loggerParam,
OrtLoggingLevel logSeverityLevel,
byte[] /* const char* */ logId,
IntPtr /*(const OrtThreadingOptions *) */ threadingOptions,
@@ -578,27 +577,27 @@ internal class NativeLib
public static DOrtReleaseEnv OrtReleaseEnv;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtEnableTelemetryEvents(IntPtr /*(OrtEnv*)*/ env);
+ public delegate IntPtr /* OrtStatus* */ DOrtEnableTelemetryEvents(IntPtr /*(OrtEnv*)*/ env);
public static DOrtEnableTelemetryEvents OrtEnableTelemetryEvents;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtDisableTelemetryEvents(IntPtr /*(OrtEnv*)*/ env);
+ public delegate IntPtr /* OrtStatus* */ DOrtDisableTelemetryEvents(IntPtr /*(OrtEnv*)*/ env);
public static DOrtDisableTelemetryEvents OrtDisableTelemetryEvents;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtUpdateEnvWithCustomLogLevel(IntPtr /*(OrtEnv*)*/ env, OrtLoggingLevel custom_log_level);
+ public delegate IntPtr /* OrtStatus* */ DOrtUpdateEnvWithCustomLogLevel(IntPtr /*(OrtEnv*)*/ env, OrtLoggingLevel custom_log_level);
public static DOrtUpdateEnvWithCustomLogLevel OrtUpdateEnvWithCustomLogLevel;
- #endregion Runtime/Environment API
+#endregion Runtime / Environment API
- #region Provider Options API
+#region Provider Options API
///
/// Creates native OrtTensorRTProviderOptions instance
///
/// (output) native instance of OrtTensorRTProviderOptions
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtCreateTensorRTProviderOptions(
+ public delegate IntPtr /* OrtStatus* */ DOrtCreateTensorRTProviderOptions(
out IntPtr /*(OrtTensorRTProviderOptions**)*/ trtProviderOptionsInstance);
public static DOrtCreateTensorRTProviderOptions OrtCreateTensorRTProviderOptions;
@@ -610,7 +609,7 @@ internal class NativeLib
/// configuration values of OrtTensorRTProviderOptions
/// number of configuration keys
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtUpdateTensorRTProviderOptions(
+ public delegate IntPtr /* OrtStatus* */ DOrtUpdateTensorRTProviderOptions(
IntPtr /*(OrtTensorRTProviderOptions*)*/ trtProviderOptionsInstance,
IntPtr[] /*(const char* const *)*/ providerOptionsKeys,
IntPtr[] /*(const char* const *)*/ providerOptionsValues,
@@ -623,10 +622,10 @@ internal class NativeLib
/// instance of OrtAllocator
/// is a UTF-8 null terminated string allocated using 'allocator'
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtGetTensorRTProviderOptionsAsString(
+ public delegate IntPtr /* OrtStatus* */ DOrtGetTensorRTProviderOptionsAsString(
IntPtr /*(OrtTensorRTProviderOptionsV2**)*/ trtProviderOptionsInstance,
IntPtr /*(OrtAllocator*)*/ allocator,
- out IntPtr /*(char**)*/ptr);
+ out IntPtr /*(char**)*/ ptr);
public static DOrtGetTensorRTProviderOptionsAsString OrtGetTensorRTProviderOptionsAsString;
///
@@ -642,7 +641,7 @@ internal class NativeLib
///
/// (output) native instance of OrtCUDAProviderOptions
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtCreateCUDAProviderOptions(
+ public delegate IntPtr /* OrtStatus* */ DOrtCreateCUDAProviderOptions(
out IntPtr /*(OrtCUDAProviderOptions**)*/ cudaProviderOptionsInstance);
public static DOrtCreateCUDAProviderOptions OrtCreateCUDAProviderOptions;
@@ -654,7 +653,7 @@ internal class NativeLib
/// configuration values of OrtCUDAProviderOptions
/// number of configuration keys
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtUpdateCUDAProviderOptions(
+ public delegate IntPtr /* OrtStatus* */ DOrtUpdateCUDAProviderOptions(
IntPtr /*(OrtCUDAProviderOptions*)*/ cudaProviderOptionsInstance,
IntPtr[] /*(const char* const *)*/ providerOptionsKeys,
IntPtr[] /*(const char* const *)*/ providerOptionsValues,
@@ -667,10 +666,10 @@ internal class NativeLib
/// instance of OrtAllocator
/// is a UTF-8 null terminated string allocated using 'allocator'
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtGetCUDAProviderOptionsAsString(
+ public delegate IntPtr /* OrtStatus* */ DOrtGetCUDAProviderOptionsAsString(
IntPtr /*(OrtCUDAProviderOptionsV2**)*/ cudaProviderOptionsInstance,
IntPtr /*(OrtAllocator*)*/ allocator,
- out IntPtr /*(char**)*/ptr);
+ out IntPtr /*(char**)*/ ptr);
public static DOrtGetCUDAProviderOptionsAsString OrtGetCUDAProviderOptionsAsString;
///
@@ -686,7 +685,7 @@ internal class NativeLib
///
/// (output) native instance of OrtROCMProviderOptions
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtCreateROCMProviderOptions(
+ public delegate IntPtr /* OrtStatus* */ DOrtCreateROCMProviderOptions(
out IntPtr /*(OrtROCMProviderOptions**)*/ rocmProviderOptionsInstance);
public static DOrtCreateROCMProviderOptions OrtCreateROCMProviderOptions;
@@ -698,7 +697,7 @@ internal class NativeLib
/// configuration values of OrtROCMProviderOptions
/// number of configuration keys
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtUpdateROCMProviderOptions(
+ public delegate IntPtr /* OrtStatus* */ DOrtUpdateROCMProviderOptions(
IntPtr /*(OrtROCMProviderOptions*)*/ rocmProviderOptionsInstance,
IntPtr[] /*(const char* const *)*/ providerOptionsKeys,
IntPtr[] /*(const char* const *)*/ providerOptionsValues,
@@ -711,10 +710,10 @@ internal class NativeLib
/// instance of OrtAllocator
/// is a UTF-8 null terminated string allocated using 'allocator'
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtGetROCMProviderOptionsAsString(
+ public delegate IntPtr /* OrtStatus* */ DOrtGetROCMProviderOptionsAsString(
IntPtr /*(OrtROCMProviderOptions**)*/ rocmProviderOptionsInstance,
IntPtr /*(OrtAllocator*)*/ allocator,
- out IntPtr /*(char**)*/ptr);
+ out IntPtr /*(char**)*/ ptr);
public static DOrtGetROCMProviderOptionsAsString OrtGetROCMProviderOptionsAsString;
///
@@ -725,34 +724,34 @@ internal class NativeLib
public delegate void DOrtReleaseROCMProviderOptions(IntPtr /*(OrtROCMProviderOptions*)*/ rocmProviderOptionsInstance);
public static DOrtReleaseROCMProviderOptions OrtReleaseROCMProviderOptions;
- #endregion
+#endregion
- #region Status API
+#region Status API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate ErrorCode DOrtGetErrorCode(IntPtr /*(OrtStatus*)*/status);
+ public delegate ErrorCode DOrtGetErrorCode(IntPtr /*(OrtStatus*)*/ status);
public static DOrtGetErrorCode OrtGetErrorCode;
// returns char*, need to convert to string by the caller.
// does not free the underlying OrtStatus*
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* char* */DOrtGetErrorMessage(IntPtr /* (OrtStatus*) */status);
+ public delegate IntPtr /* char* */ DOrtGetErrorMessage(IntPtr /* (OrtStatus*) */ status);
public static DOrtGetErrorMessage OrtGetErrorMessage;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate void DOrtReleaseStatus(IntPtr /*(OrtStatus*)*/ statusPtr);
public static DOrtReleaseStatus OrtReleaseStatus;
- #endregion Status API
+#endregion Status API
- #region InferenceSession API
+#region InferenceSession API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtCreateSession(
- IntPtr /* (OrtEnv*) */ environment,
- //[MarshalAs(UnmanagedType.LPStr)]string modelPath
- byte[] modelPath,
- IntPtr /* (OrtSessionOptions*) */sessopnOptions,
- out IntPtr /**/ session);
+ public delegate IntPtr /* OrtStatus* */ DOrtCreateSession(
+ IntPtr /* (OrtEnv*) */ environment,
+ //[MarshalAs(UnmanagedType.LPStr)]string modelPath
+ byte[] modelPath,
+ IntPtr /* (OrtSessionOptions*) */ sessopnOptions,
+ out IntPtr /**/ session);
public static DOrtCreateSession OrtCreateSession;
@@ -765,22 +764,22 @@ internal class NativeLib
/// Native OrtPrepackedWeightsContainer instance
/// (Output) Created native OrtSession instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtCreateSessionWithPrepackedWeightsContainer(
- IntPtr /* (OrtEnv*) */ environment,
- byte[] modelPath,
- IntPtr /* (OrtSessionOptions*) */sessionOptions,
- IntPtr /* (OrtPrepackedWeightsContainer*) */prepackedWeightsContainer,
- out IntPtr /* (OrtSession**) */ session);
+ public delegate IntPtr /* OrtStatus* */ DOrtCreateSessionWithPrepackedWeightsContainer(
+ IntPtr /* (OrtEnv*) */ environment,
+ byte[] modelPath,
+ IntPtr /* (OrtSessionOptions*) */ sessionOptions,
+ IntPtr /* (OrtPrepackedWeightsContainer*) */ prepackedWeightsContainer,
+ out IntPtr /* (OrtSession**) */ session);
public static DOrtCreateSessionWithPrepackedWeightsContainer OrtCreateSessionWithPrepackedWeightsContainer;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtCreateSessionFromArray(
- IntPtr /* (OrtEnv*) */ environment,
- byte[] modelData,
- UIntPtr modelSize,
- IntPtr /* (OrtSessionOptions*) */ sessionOptions,
- out IntPtr /**/ session);
+ public delegate IntPtr /* OrtStatus* */ DOrtCreateSessionFromArray(
+ IntPtr /* (OrtEnv*) */ environment,
+ byte[] modelData,
+ UIntPtr modelSize,
+ IntPtr /* (OrtSessionOptions*) */ sessionOptions,
+ out IntPtr /**/ session);
public static DOrtCreateSessionFromArray OrtCreateSessionFromArray;
///
@@ -793,169 +792,167 @@ internal class NativeLib
/// Native OrtPrepackedWeightsContainer instance
/// (Output) Created native OrtSession instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /* OrtStatus* */DOrtCreateSessionFromArrayWithPrepackedWeightsContainer(
- IntPtr /* (OrtEnv*) */ environment,
- byte[] /* (void*) */ modelData,
- UIntPtr /* (size_t) */ modelSize,
- IntPtr /* (OrtSessionOptions*) */ sessionOptions,
- IntPtr /* (OrtPrepackedWeightsContainer*) */prepackedWeightsContainer,
- out IntPtr /* (OrtSession**) */ session);
+ public delegate IntPtr /* OrtStatus* */ DOrtCreateSessionFromArrayWithPrepackedWeightsContainer(
+ IntPtr /* (OrtEnv*) */ environment,
+ byte[] /* (void*) */ modelData,
+ UIntPtr /* (size_t) */ modelSize,
+ IntPtr /* (OrtSessionOptions*) */ sessionOptions,
+ IntPtr /* (OrtPrepackedWeightsContainer*) */ prepackedWeightsContainer,
+ out IntPtr /* (OrtSession**) */ session);
public static DOrtCreateSessionFromArrayWithPrepackedWeightsContainer OrtCreateSessionFromArrayWithPrepackedWeightsContainer;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(ONNStatus*)*/ DOrtRun(
- IntPtr /*(OrtSession*)*/ session,
- IntPtr /*(OrtSessionRunOptions*)*/ runOptions, // can be null to use the default options
- IntPtr[] inputNames,
- IntPtr[] /* (OrtValue*[])*/ inputValues,
- UIntPtr inputCount,
- IntPtr[] outputNames,
- UIntPtr outputCount,
- IntPtr[] outputValues /* An array of output value pointers. Array must be allocated by the caller */
- );
+ IntPtr /*(OrtSession*)*/ session,
+ IntPtr /*(OrtSessionRunOptions*)*/ runOptions, // can be null to use the default options
+ IntPtr[] inputNames,
+ IntPtr[] /* (OrtValue*[])*/ inputValues,
+ UIntPtr inputCount,
+ IntPtr[] outputNames,
+ UIntPtr outputCount,
+ IntPtr[] outputValues /* An array of output value pointers. Array must be allocated by the caller */
+ );
public static DOrtRun OrtRun;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(ONNStatus*)*/ DOrtRunWithBinding(
- IntPtr /*(OrtSession*)*/ session,
- IntPtr /*(OrtSessionRunOptions*)*/ runOptions, // can not be null
- IntPtr /*(const OrtIoBinding*)*/ io_binding
- );
+ IntPtr /*(OrtSession*)*/ session,
+ IntPtr /*(OrtSessionRunOptions*)*/ runOptions, // can not be null
+ IntPtr /*(const OrtIoBinding*)*/ io_binding);
public static DOrtRunWithBinding OrtRunWithBinding;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetInputCount(
- IntPtr /*(OrtSession*)*/ session,
- out UIntPtr count);
+ IntPtr /*(OrtSession*)*/ session,
+ out UIntPtr count);
public static DOrtSessionGetInputCount OrtSessionGetInputCount;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetOutputCount(
- IntPtr /*(OrtSession*)*/ session,
- out UIntPtr count);
+ IntPtr /*(OrtSession*)*/ session,
+ out UIntPtr count);
public static DOrtSessionGetOutputCount OrtSessionGetOutputCount;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetOverridableInitializerCount(
- IntPtr /*(OrtSession*)*/ session,
- out UIntPtr count);
+ IntPtr /*(OrtSession*)*/ session,
+ out UIntPtr count);
public static DOrtSessionGetOverridableInitializerCount OrtSessionGetOverridableInitializerCount;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetInputName(
- IntPtr /*(OrtSession*)*/ session,
- UIntPtr index,
- IntPtr /*(OrtAllocator*)*/ allocator,
- out IntPtr /*(char**)*/name);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetInputName(
+ IntPtr /*(OrtSession*)*/ session,
+ UIntPtr index,
+ IntPtr /*(OrtAllocator*)*/ allocator,
+ out IntPtr /*(char**)*/ name);
public static DOrtSessionGetInputName OrtSessionGetInputName;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetOutputName(
- IntPtr /*(OrtSession*)*/ session,
- UIntPtr index,
- IntPtr /*(OrtAllocator*)*/ allocator,
- out IntPtr /*(char**)*/name);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetOutputName(
+ IntPtr /*(OrtSession*)*/ session,
+ UIntPtr index,
+ IntPtr /*(OrtAllocator*)*/ allocator,
+ out IntPtr /*(char**)*/ name);
public static DOrtSessionGetOutputName OrtSessionGetOutputName;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtSessionEndProfiling(
- IntPtr /*(const OrtSession*)*/ session,
- IntPtr /*(OrtAllocator*)*/ allocator,
- out IntPtr /*(char**)*/profile_file);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionEndProfiling(
+ IntPtr /*(const OrtSession*)*/ session,
+ IntPtr /*(OrtAllocator*)*/ allocator,
+ out IntPtr /*(char**)*/ profile_file);
public static DOrtSessionEndProfiling OrtSessionEndProfiling;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetOverridableInitializerName(
- IntPtr /*(OrtSession*)*/ session,
- UIntPtr index,
- IntPtr /*(OrtAllocator*)*/ allocator,
- out IntPtr /*(char**)*/name);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetOverridableInitializerName(
+ IntPtr /*(OrtSession*)*/ session,
+ UIntPtr index,
+ IntPtr /*(OrtAllocator*)*/ allocator,
+ out IntPtr /*(char**)*/ name);
public static DOrtSessionGetOverridableInitializerName OrtSessionGetOverridableInitializerName;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetInputTypeInfo(
- IntPtr /*(const OrtSession*)*/ session,
- UIntPtr index,
- out IntPtr /*(struct OrtTypeInfo**)*/ typeInfo);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetInputTypeInfo(
+ IntPtr /*(const OrtSession*)*/ session,
+ UIntPtr index,
+ out IntPtr /*(struct OrtTypeInfo**)*/ typeInfo);
public static DOrtSessionGetInputTypeInfo OrtSessionGetInputTypeInfo;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetOutputTypeInfo(
- IntPtr /*(const OrtSession*)*/ session,
- UIntPtr index,
- out IntPtr /* (struct OrtTypeInfo**)*/ typeInfo);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetOutputTypeInfo(
+ IntPtr /*(const OrtSession*)*/ session,
+ UIntPtr index,
+ out IntPtr /* (struct OrtTypeInfo**)*/ typeInfo);
public static DOrtSessionGetOutputTypeInfo OrtSessionGetOutputTypeInfo;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtSessionGetOverridableInitializerTypeInfo(
- IntPtr /*(const OrtSession*)*/ session,
- UIntPtr index,
- out IntPtr /* (struct OrtTypeInfo**)*/ typeInfo);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetOverridableInitializerTypeInfo(
+ IntPtr /*(const OrtSession*)*/ session,
+ UIntPtr index,
+ out IntPtr /* (struct OrtTypeInfo**)*/ typeInfo);
public static DOrtSessionGetOverridableInitializerTypeInfo OrtSessionGetOverridableInitializerTypeInfo;
// release the typeinfo using OrtReleaseTypeInfo
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate void DOrtReleaseTypeInfo(IntPtr /*(OrtTypeInfo*)*/session);
+ public delegate void DOrtReleaseTypeInfo(IntPtr /*(OrtTypeInfo*)*/ session);
public static DOrtReleaseTypeInfo OrtReleaseTypeInfo;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate void DOrtReleaseSession(IntPtr /*(OrtSession*)*/session);
+ public delegate void DOrtReleaseSession(IntPtr /*(OrtSession*)*/ session);
public static DOrtReleaseSession OrtReleaseSession;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSessionGetProfilingStartTimeNs(
- IntPtr /*(const OrtSession*)*/ session,
- out UIntPtr /*(ulong* out)*/ startTime);
+ IntPtr /*(const OrtSession*)*/ session,
+ out UIntPtr /*(ulong* out)*/ startTime);
public static DOrtSessionGetProfilingStartTimeNs OrtSessionGetProfilingStartTimeNs;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(ONNStatus*)*/ DCreateAndRegisterAllocatorV2(
- IntPtr /* (OrtEnv*) */ environment,
- IntPtr /*(char*)*/ provider_type,
- IntPtr /*(OrtMemoryInfo*)*/ mem_info,
- IntPtr /*(OrtArenaCfg*)*/ arena_cfg,
- IntPtr /*(char**)*/ provider_options_keys,
- IntPtr /*(char**)*/ provider_options_values,
- UIntPtr /*(size_t)*/num_keys);
+ IntPtr /* (OrtEnv*) */ environment,
+ IntPtr /*(char*)*/ provider_type,
+ IntPtr /*(OrtMemoryInfo*)*/ mem_info,
+ IntPtr /*(OrtArenaCfg*)*/ arena_cfg,
+ IntPtr /*(char**)*/ provider_options_keys,
+ IntPtr /*(char**)*/ provider_options_values,
+ UIntPtr /*(size_t)*/ num_keys);
public static DCreateAndRegisterAllocatorV2 OrtCreateAndRegisterAllocatorV2;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(ONNStatus*)*/ DOrtRunAsync(
- IntPtr /*(OrtSession*)*/ session,
- IntPtr /*(OrtSessionRunOptions*)*/ runOptions, // can be null to use the default options
- IntPtr[] /*(char**)*/ inputNames,
- IntPtr[] /*(OrtValue*[])*/ inputValues,
- UIntPtr /*(size_t)*/ inputCount,
- IntPtr[] /*(char**)*/ outputNames,
- UIntPtr /*(size_t)*/ outputCount,
- IntPtr[] /*(OrtValue*[])*/ outputValues,
- IntPtr /*(void (*RunAsyncCallbackFn)(void* user_data, OrtValue** outputs, size_t num_outputs, OrtStatusPtr status))*/ callback, // callback function
- IntPtr /*(void*)*/ user_data
- );
+ IntPtr /*(OrtSession*)*/ session,
+ IntPtr /*(OrtSessionRunOptions*)*/ runOptions, // can be null to use the default options
+ IntPtr[] /*(char**)*/ inputNames,
+ IntPtr[] /*(OrtValue*[])*/ inputValues,
+ UIntPtr /*(size_t)*/ inputCount,
+ IntPtr[] /*(char**)*/ outputNames,
+ UIntPtr /*(size_t)*/ outputCount,
+ IntPtr[] /*(OrtValue*[])*/ outputValues,
+ IntPtr /*(void (*RunAsyncCallbackFn)(void* user_data, OrtValue** outputs, size_t num_outputs, OrtStatusPtr status))*/ callback, // callback function
+ IntPtr /*(void*)*/ user_data);
public static DOrtRunAsync OrtRunAsync;
- #endregion InferenceSession API
+#endregion InferenceSession API
- #region SessionOptions API
+#region SessionOptions API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtCreateSessionOptions(out IntPtr /*(OrtSessionOptions**)*/ sessionOptions);
public static DOrtCreateSessionOptions OrtCreateSessionOptions;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate void DOrtReleaseSessionOptions(IntPtr /*(OrtSessionOptions*)*/session);
+ public delegate void DOrtReleaseSessionOptions(IntPtr /*(OrtSessionOptions*)*/ session);
public static DOrtReleaseSessionOptions OrtReleaseSessionOptions;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
@@ -964,7 +961,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSetSessionExecutionMode(IntPtr /*(OrtSessionOptions*)*/ options,
- ExecutionMode execution_mode);
+ ExecutionMode execution_mode);
public static DOrtSetSessionExecutionMode OrtSetSessionExecutionMode;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
@@ -996,7 +993,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
public static DOrtDisableCpuMemArena OrtDisableCpuMemArena;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/ DOrtSetSessionLogId(IntPtr /* OrtSessionOptions* */ options, byte[] /* const char* */logId);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtSetSessionLogId(IntPtr /* OrtSessionOptions* */ options, byte[] /* const char* */ logId);
public static DOrtSetSessionLogId OrtSetSessionLogId;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
@@ -1027,7 +1024,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Config value
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtAddSessionConfigEntry(IntPtr /* OrtSessionOptions* */ options,
- byte[] /* const char* */configKey,
+ byte[] /* const char* */ configKey,
byte[] /* const char* */ configValue);
public static DOrtAddSessionConfigEntry OrtAddSessionConfigEntry;
@@ -1090,9 +1087,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Native OrtSessionOptions instance
/// Native OrtTensorRTProviderOptions instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DSessionOptionsAppendExecutionProvider_TensorRT(
- IntPtr /*(OrtSessionOptions*)*/ options,
- IntPtr /*(const OrtTensorRTProviderOptions*)*/ trtProviderOptions);
+ public delegate IntPtr /*(OrtStatus*)*/ DSessionOptionsAppendExecutionProvider_TensorRT(
+ IntPtr /*(OrtSessionOptions*)*/ options,
+ IntPtr /*(const OrtTensorRTProviderOptions*)*/ trtProviderOptions);
public static DSessionOptionsAppendExecutionProvider_TensorRT SessionOptionsAppendExecutionProvider_TensorRT;
@@ -1102,9 +1099,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Native OrtSessionOptions instance
/// Native OrtTensorRTProviderOptionsV2 instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DSessionOptionsAppendExecutionProvider_TensorRT_V2(
- IntPtr /*(OrtSessionOptions*)*/ options,
- IntPtr /*(const OrtTensorRTProviderOptionsV2*)*/ trtProviderOptions);
+ public delegate IntPtr /*(OrtStatus*)*/ DSessionOptionsAppendExecutionProvider_TensorRT_V2(
+ IntPtr /*(OrtSessionOptions*)*/ options,
+ IntPtr /*(const OrtTensorRTProviderOptionsV2*)*/ trtProviderOptions);
public static DSessionOptionsAppendExecutionProvider_TensorRT_V2 SessionOptionsAppendExecutionProvider_TensorRT_V2;
@@ -1114,9 +1111,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Native OrtSessionOptions instance
/// Native OrtCUDAProviderOptions instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DSessionOptionsAppendExecutionProvider_CUDA(
- IntPtr /*(OrtSessionOptions*)*/ options,
- IntPtr /*(const OrtCUDAProviderOptions*)*/ cudaProviderOptions);
+ public delegate IntPtr /*(OrtStatus*)*/ DSessionOptionsAppendExecutionProvider_CUDA(
+ IntPtr /*(OrtSessionOptions*)*/ options,
+ IntPtr /*(const OrtCUDAProviderOptions*)*/ cudaProviderOptions);
public static DSessionOptionsAppendExecutionProvider_CUDA SessionOptionsAppendExecutionProvider_CUDA;
@@ -1126,9 +1123,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Native OrtSessionOptions instance
/// Native OrtCUDAProviderOptionsV2 instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DSessionOptionsAppendExecutionProvider_CUDA_V2(
- IntPtr /*(OrtSessionOptions*)*/ options,
- IntPtr /*(const OrtCUDAProviderOptionsV2*)*/ cudaProviderOptions);
+ public delegate IntPtr /*(OrtStatus*)*/ DSessionOptionsAppendExecutionProvider_CUDA_V2(
+ IntPtr /*(OrtSessionOptions*)*/ options,
+ IntPtr /*(const OrtCUDAProviderOptionsV2*)*/ cudaProviderOptions);
public static DSessionOptionsAppendExecutionProvider_CUDA_V2 SessionOptionsAppendExecutionProvider_CUDA_V2;
@@ -1138,9 +1135,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Native OrtSessionOptions instance
/// Native OrtROCMProviderOptions instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DSessionOptionsAppendExecutionProvider_ROCM(
- IntPtr /*(OrtSessionOptions*)*/ options,
- IntPtr /*(const OrtROCMProviderOptions*)*/ rocmProviderOptions);
+ public delegate IntPtr /*(OrtStatus*)*/ DSessionOptionsAppendExecutionProvider_ROCM(
+ IntPtr /*(OrtSessionOptions*)*/ options,
+ IntPtr /*(const OrtROCMProviderOptions*)*/ rocmProviderOptions);
public static DSessionOptionsAppendExecutionProvider_ROCM SessionOptionsAppendExecutionProvider_ROCM;
@@ -1151,9 +1148,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Dimension denotation
/// Dimension value
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtAddFreeDimensionOverride(IntPtr /*(OrtSessionOptions*)*/ options,
- byte[] /*(const char*)*/ dimDenotation,
- long dimValue);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtAddFreeDimensionOverride(IntPtr /*(OrtSessionOptions*)*/ options,
+ byte[] /*(const char*)*/ dimDenotation,
+ long dimValue);
public static DOrtAddFreeDimensionOverride OrtAddFreeDimensionOverride;
@@ -1164,9 +1161,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Dimension name
/// Dimension value
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtAddFreeDimensionOverrideByName(IntPtr /*(OrtSessionOptions*)*/ options,
- byte[] /*(const char*)*/ dimName,
- long dimValue);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtAddFreeDimensionOverrideByName(IntPtr /*(OrtSessionOptions*)*/ options,
+ byte[] /*(const char*)*/ dimName,
+ long dimValue);
public static DOrtAddFreeDimensionOverrideByName OrtAddFreeDimensionOverrideByName;
@@ -1177,9 +1174,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Library path
/// (out) Native library handle
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtRegisterCustomOpsLibrary(IntPtr /*(OrtSessionOptions*) */ options,
- byte[] /*(const char*)*/ libraryPath,
- out IntPtr /*(void**)*/ libraryHandle);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtRegisterCustomOpsLibrary(IntPtr /*(OrtSessionOptions*) */ options,
+ byte[] /*(const char*)*/ libraryPath,
+ out IntPtr /*(void**)*/ libraryHandle);
public static DOrtRegisterCustomOpsLibrary OrtRegisterCustomOpsLibrary;
@@ -1189,8 +1186,8 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Native SessionOptions instance
/// Library path
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtRegisterCustomOpsLibrary_V2(IntPtr /*(OrtSessionOptions*) */ options,
- byte[] /*(const ORTCHAR_T*)*/ libraryPath);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtRegisterCustomOpsLibrary_V2(IntPtr /*(OrtSessionOptions*) */ options,
+ byte[] /*(const ORTCHAR_T*)*/ libraryPath);
public static DOrtRegisterCustomOpsLibrary_V2 OrtRegisterCustomOpsLibrary_V2;
@@ -1201,9 +1198,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Name of the initializer
/// Native OrtValue instnce
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtAddInitializer(IntPtr /*(OrtSessionOptions*)*/ options,
- byte[] /*(const char*)*/ name,
- IntPtr /*(OrtValue*)*/ ortValue);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtAddInitializer(IntPtr /*(OrtSessionOptions*)*/ options,
+ byte[] /*(const char*)*/ name,
+ IntPtr /*(OrtValue*)*/ ortValue);
public static DOrtAddInitializer OrtAddInitializer;
@@ -1220,25 +1217,25 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Configuration values to add
/// Number of configuration keys
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DSessionOptionsAppendExecutionProvider(
- IntPtr /*(OrtSessionOptions*)*/ options,
- byte[] /*(const char*)*/ providerName,
- IntPtr[] /*(const char* const *)*/ providerOptionsKeys,
- IntPtr[] /*(const char* const *)*/ providerOptionsValues,
- UIntPtr /*(size_t)*/ numKeys);
+ public delegate IntPtr /*(OrtStatus*)*/ DSessionOptionsAppendExecutionProvider(
+ IntPtr /*(OrtSessionOptions*)*/ options,
+ byte[] /*(const char*)*/ providerName,
+ IntPtr[] /*(const char* const *)*/ providerOptionsKeys,
+ IntPtr[] /*(const char* const *)*/ providerOptionsValues,
+ UIntPtr /*(size_t)*/ numKeys);
public static DSessionOptionsAppendExecutionProvider SessionOptionsAppendExecutionProvider;
- #endregion
+#endregion
- #region RunOptions API
+#region RunOptions API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtCreateRunOptions(out IntPtr /* OrtRunOptions** */ runOptions);
public static DOrtCreateRunOptions OrtCreateRunOptions;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate void DOrtReleaseRunOptions(IntPtr /*(OrtRunOptions*)*/options);
+ public delegate void DOrtReleaseRunOptions(IntPtr /*(OrtRunOptions*)*/ options);
public static DOrtReleaseRunOptions OrtReleaseRunOptions;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
@@ -1259,11 +1256,11 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtRunOptionsGetRunLogSeverityLevel(IntPtr /* OrtRunOptions* */ options,
- out OrtLoggingLevel severityLevel);
+ out OrtLoggingLevel severityLevel);
public static DOrtRunOptionsGetRunLogSeverityLevel OrtRunOptionsGetRunLogSeverityLevel;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/ DOrtRunOptionsGetRunTag(IntPtr /* const OrtRunOptions* */options, out IntPtr /* const char** */ runtag);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtRunOptionsGetRunTag(IntPtr /* const OrtRunOptions* */ options, out IntPtr /* const char** */ runtag);
public static DOrtRunOptionsGetRunTag OrtRunOptionsGetRunTag;
// Set a flag so that any running OrtRun* calls that are using this instance of OrtRunOptions
@@ -1276,7 +1273,6 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
public delegate IntPtr /*(OrtStatus*)*/ DOrtRunOptionsUnsetTerminate(IntPtr /* OrtRunOptions* */ options);
public static DOrtRunOptionsUnsetTerminate OrtRunOptionsUnsetTerminate;
-
///
/// Add run config entry
///
@@ -1285,13 +1281,13 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Config value
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtAddRunConfigEntry(IntPtr /* OrtRunOptions* */ options,
- byte[] /* const char* */configKey,
+ byte[] /* const char* */ configKey,
byte[] /* const char* */ configValue);
public static DOrtAddRunConfigEntry OrtAddRunConfigEntry;
- #endregion
+#endregion
- #region ThreadingOptions API
+#region ThreadingOptions API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtCreateThreadingOptions(out IntPtr /* OrtCreateThreadingOptions** */ threadingOptions);
@@ -1316,27 +1312,26 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtThreadingOptionsSetGlobalSpinControl(IntPtr /* OrtThreadingOptions* */ threadingOptions, int allowSpinning);
public static DOrtThreadingOptionsSetGlobalSpinControl OrtThreadingOptionsSetGlobalSpinControl;
- #endregion
+#endregion
- #region Allocator/MemoryInfo API
+#region Allocator / MemoryInfo API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* (OrtStatus*)*/ DOrtCreateMemoryInfo(
- byte[] /*(const char*) */name,
- OrtAllocatorType allocatorType,
- int identifier,
- OrtMemType memType,
- out IntPtr /*(OrtMemoryInfo*)*/ allocatorInfo // memory ownership transfered to caller
- );
+ byte[] /*(const char*) */ name,
+ OrtAllocatorType allocatorType,
+ int identifier,
+ OrtMemType memType,
+ out IntPtr /*(OrtMemoryInfo*)*/ allocatorInfo // memory ownership transfered to caller
+ );
public static DOrtCreateMemoryInfo OrtCreateMemoryInfo;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* (OrtStatus*)*/ DOrtCreateCpuMemoryInfo(
- OrtAllocatorType allocatorType,
- OrtMemType memoryType,
- out IntPtr /*(OrtMemoryInfo*)*/ allocatorInfo
- );
+ OrtAllocatorType allocatorType,
+ OrtMemType memoryType,
+ out IntPtr /*(OrtMemoryInfo*)*/ allocatorInfo);
public static DOrtCreateCpuMemoryInfo OrtCreateCpuMemoryInfo;
@@ -1347,15 +1342,15 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtCompareMemoryInfo(
- IntPtr /*(const OrtMemoryInfo*)*/ info1,
- IntPtr /*(const OrtMemoryInfo*)*/ info2,
- out int /*(int* out)*/ result);
+ IntPtr /*(const OrtMemoryInfo*)*/ info1,
+ IntPtr /*(const OrtMemoryInfo*)*/ info2,
+ out int /*(int* out)*/ result);
public static DOrtCompareMemoryInfo OrtCompareMemoryInfo;
/**
- * Do not free the returned value
- */
+ * Do not free the returned value
+ */
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtMemoryInfoGetName(IntPtr /*(const OrtMemoryInfo* ptr)*/ mem_info, out IntPtr /*(const char**)*/ name);
@@ -1368,26 +1363,25 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtMemoryInfoGetMemType(
- IntPtr /*(const OrtMemoryInfo* ptr)*/ mem_info,
- out OrtMemType /*(OrtMemType*)*/ mem_type);
+ IntPtr /*(const OrtMemoryInfo* ptr)*/ mem_info,
+ out OrtMemType /*(OrtMemType*)*/ mem_type);
public static DOrtMemoryInfoGetMemType OrtMemoryInfoGetMemType;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtMemoryInfoGetType(
- IntPtr /*(const OrtMemoryInfo* ptr)*/ mem_info,
- out OrtAllocatorType /*(OrtAllocatorType*)*/ alloc_type
- );
+ IntPtr /*(const OrtMemoryInfo* ptr)*/ mem_info,
+ out OrtAllocatorType /*(OrtAllocatorType*)*/ alloc_type);
public static DOrtMemoryInfoGetType OrtMemoryInfoGetType;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtGetAllocatorWithDefaultOptions(out IntPtr /*(OrtAllocator**)*/ allocator);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtGetAllocatorWithDefaultOptions(out IntPtr /*(OrtAllocator**)*/ allocator);
public static DOrtGetAllocatorWithDefaultOptions OrtGetAllocatorWithDefaultOptions;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/DOrtAllocatorGetInfo(IntPtr /*(const OrtAllocator*)*/ ptr, out IntPtr /*(const struct OrtMemoryInfo**)*/info);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtAllocatorGetInfo(IntPtr /*(const OrtAllocator*)*/ ptr, out IntPtr /*(const struct OrtMemoryInfo**)*/ info);
public static DOrtAllocatorGetInfo OrtAllocatorGetInfo;
@@ -1402,8 +1396,8 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// Pointer to a native OrtStatus instance indicating success/failure of config creation
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtCreateArenaCfg(UIntPtr /*(size_t)*/ maxMemory, int /*(int)*/ arenaExtendStrategy,
- int /*(int)*/ initialChunkSizeBytes, int /*(int)*/ maxDeadBytesPerChunk,
- out IntPtr /*(OrtArenaCfg**)*/ arenaCfg);
+ int /*(int)*/ initialChunkSizeBytes, int /*(int)*/ maxDeadBytesPerChunk,
+ out IntPtr /*(OrtArenaCfg**)*/ arenaCfg);
public static DOrtCreateArenaCfg OrtCreateArenaCfg;
@@ -1457,9 +1451,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
public static DOrtAllocatorFree OrtAllocatorFree;
- #endregion Allocator/MemoryInfo API
+#endregion Allocator / MemoryInfo API
- #region IoBinding API
+#region IoBinding API
///
/// Create OrtIoBinding instance that is used to bind memory that is allocated
@@ -1634,7 +1628,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtCreateAndRegisterAllocator(IntPtr /*(OrtEnv*)*/ env,
IntPtr /*(const OrtMemoryInfo*)*/ memInfo,
- IntPtr/*(const OrtArenaCfg*)*/ arenaCfg);
+ IntPtr /*(const OrtArenaCfg*)*/ arenaCfg);
public static DOrtCreateAndRegisterAllocator OrtCreateAndRegisterAllocator;
@@ -1644,13 +1638,13 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// the source projected language
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtSetLanguageProjection(IntPtr /* (OrtEnv*) */ environment,
- int projection);
+ int projection);
public static DOrtSetLanguageProjection OrtSetLanguageProjection;
- #endregion IoBinding API
+#endregion IoBinding API
- #region ModelMetadata API
+#region ModelMetadata API
///
/// Gets the ModelMetadata associated with an InferenceSession
@@ -1670,7 +1664,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// (output) producer name from the ModelMetadata instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* (OrtStatus*) */ DOrtModelMetadataGetProducerName(IntPtr /* (const OrtModelMetadata*) */ modelMetadata,
- IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char**) */ value);
+ IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char**) */ value);
public static DOrtModelMetadataGetProducerName OrtModelMetadataGetProducerName;
@@ -1682,7 +1676,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// (output) graph name from the ModelMetadata instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* (OrtStatus*) */ DOrtModelMetadataGetGraphName(IntPtr /* (const OrtModelMetadata*) */ modelMetadata,
- IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char**) */ value);
+ IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char**) */ value);
public static DOrtModelMetadataGetGraphName OrtModelMetadataGetGraphName;
@@ -1694,7 +1688,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// (output) domain from the ModelMetadata instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* (OrtStatus*) */ DOrtModelMetadataGetDomain(IntPtr /* (const OrtModelMetadata*) */ modelMetadata,
- IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char**) */ value);
+ IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char**) */ value);
public static DOrtModelMetadataGetDomain OrtModelMetadataGetDomain;
@@ -1706,7 +1700,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// (output) description from the ModelMetadata instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* (OrtStatus*) */ DOrtModelMetadataGetDescription(IntPtr /* (const OrtModelMetadata*) */ modelMetadata,
- IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char**) */ value);
+ IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char**) */ value);
public static DOrtModelMetadataGetDescription OrtModelMetadataGetDescription;
@@ -1718,7 +1712,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// (output) graph description from the ModelMetadata instance
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* (OrtStatus*) */ DOrtModelMetadataGetGraphDescription(IntPtr /* (const OrtModelMetadata*) */ modelMetadata,
- IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char**) */ value);
+ IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char**) */ value);
public static DOrtModelMetadataGetGraphDescription OrtModelMetadataGetGraphDescription;
@@ -1742,7 +1736,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// (output) number of keys in the custom metadata map
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* (OrtStatus*) */ DOrtModelMetadataGetCustomMetadataMapKeys(IntPtr /* (const OrtModelMetadata*) */ modelMetadata,
- IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char***) */ keys, out long /* (int64_t*) */ numKeys);
+ IntPtr /* (OrtAllocator*) */ allocator, out IntPtr /* (char***) */ keys, out long /* (int64_t*) */ numKeys);
public static DOrtModelMetadataGetCustomMetadataMapKeys OrtModelMetadataGetCustomMetadataMapKeys;
@@ -1755,7 +1749,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// (output) value for the key in the custom metadata map
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* (OrtStatus*) */ DOrtModelMetadataLookupCustomMetadataMap(IntPtr /* (const OrtModelMetadata*) */ modelMetadata,
- IntPtr /* (OrtAllocator*) */ allocator, IntPtr /* (const char*) */ key, out IntPtr /* (char**) */ value);
+ IntPtr /* (OrtAllocator*) */ allocator, IntPtr /* (const char*) */ key, out IntPtr /* (char**) */ value);
public static DOrtModelMetadataLookupCustomMetadataMap OrtModelMetadataLookupCustomMetadataMap;
@@ -1768,9 +1762,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
public static DOrtReleaseModelMetadata OrtReleaseModelMetadata;
- #endregion ModelMetadata API
+#endregion ModelMetadata API
- #region OrtValue API
+#region OrtValue API
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtHasValue(IntPtr /*(OrtValue*)*/ value, out IntPtr /*(int*)*/ hasValue);
@@ -1779,9 +1773,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtGetValue(IntPtr /*(OrtValue*)*/ value,
- int index,
- IntPtr /*(OrtAllocator*)*/ allocator,
- out IntPtr /*(OrtValue**)*/ outputValue);
+ int index,
+ IntPtr /*(OrtAllocator*)*/ allocator,
+ out IntPtr /*(OrtValue**)*/ outputValue);
public static DOrtGetValue OrtGetValue;
@@ -1801,8 +1795,8 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
public static DOrtGetValueCount OrtGetValueCount;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr/*(OrtStatus*)*/ DOrtCreateValue(IntPtr[] /* const OrtValue* const* in */ values,
- UIntPtr /* size_t */ num_values, IntPtr /* (OnnxValueType */ onnxValueType, out IntPtr /* OrtValue** */ ortValue);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtCreateValue(IntPtr[] /* const OrtValue* const* in */ values,
+ UIntPtr /* size_t */ num_values, IntPtr /* (OnnxValueType */ onnxValueType, out IntPtr /* OrtValue** */ ortValue);
public static DOrtCreateValue OrtCreateValue;
@@ -1813,23 +1807,23 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtCreateTensorAsOrtValue(
- IntPtr /*_Inout_ OrtAllocator* */ allocator,
- long[] /*_In_ const int64_t* */ shape,
- UIntPtr /*size_t*/ shape_len,
- Tensors.TensorElementType type,
- out IntPtr /* OrtValue** */ outputValue);
+ IntPtr /*_Inout_ OrtAllocator* */ allocator,
+ long[] /*_In_ const int64_t* */ shape,
+ UIntPtr /*size_t*/ shape_len,
+ Tensors.TensorElementType type,
+ out IntPtr /* OrtValue** */ outputValue);
public static DOrtCreateTensorAsOrtValue OrtCreateTensorAsOrtValue;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /* OrtStatus */ DOrtCreateTensorWithDataAsOrtValue(
- IntPtr /* (const OrtMemoryInfo*) */ allocatorInfo,
- IntPtr /* (void*) */dataBufferHandle,
- UIntPtr dataLength,
- long[] shape,
- UIntPtr shapeLength,
- Tensors.TensorElementType type,
- out IntPtr /* OrtValue** */ outputValue);
+ IntPtr /* (const OrtMemoryInfo*) */ allocatorInfo,
+ IntPtr /* (void*) */ dataBufferHandle,
+ UIntPtr dataLength,
+ long[] shape,
+ UIntPtr shapeLength,
+ Tensors.TensorElementType type,
+ out IntPtr /* OrtValue** */ outputValue);
public static DOrtCreateTensorWithDataAsOrtValue OrtCreateTensorWithDataAsOrtValue;
@@ -1854,9 +1848,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
/// \param len total data length, not including the trailing '\0' chars.
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtFillStringTensor(
- IntPtr /* OrtValue */ value,
- IntPtr[] /* const char* const* */s,
- UIntPtr /* size_t */ s_len);
+ IntPtr /* OrtValue */ value,
+ IntPtr[] /* const char* const* */ s,
+ UIntPtr /* size_t */ s_len);
public static DOrtFillStringTensor OrtFillStringTensor;
@@ -1876,7 +1870,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtGetStringTensorContent(
IntPtr /*(OrtValue*)*/ value,
- byte[] /*(void*)*/ dst_buffer,
+ byte[] /*(void*)*/ dst_buffer,
UIntPtr dst_buffer_len,
UIntPtr[] offsets,
UIntPtr offsets_len);
@@ -1913,7 +1907,7 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtGetTensorTypeAndShape(
- IntPtr /*(OrtValue*)*/ value,
+ IntPtr /*(OrtValue*)*/ value,
out IntPtr /*(struct OrtTensorTypeAndShapeInfo*)*/ typeAndShapeInfo);
public static DOrtGetTensorTypeAndShape OrtGetTensorTypeAndShape;
@@ -1932,35 +1926,35 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtGetDimensionsCount(
- IntPtr /*(const struct OrtTensorTypeAndShapeInfo*)*/ typeAndShapeInfo,
+ IntPtr /*(const struct OrtTensorTypeAndShapeInfo*)*/ typeAndShapeInfo,
out UIntPtr output);
public static DOrtGetDimensionsCount OrtGetDimensionsCount;
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtGetDimensions(
- IntPtr /*(const struct OrtTensorTypeAndShapeInfo*)*/ typeAndShapeInfo,
- long[] dim_values,
- UIntPtr dim_values_length);
+ IntPtr /*(const struct OrtTensorTypeAndShapeInfo*)*/ typeAndShapeInfo,
+ long[] dim_values,
+ UIntPtr dim_values_length);
public static DOrtGetDimensions OrtGetDimensions;
/**
- * Get the symbolic dimension names for dimensions with a value of -1.
- * Order and number of entries is the same as values returned by GetDimensions.
- * The name may be empty for an unnamed symbolic dimension.
- * e.g.
- * If OrtGetDimensions returns [-1, -1, 2], OrtGetSymbolicDimensions would return an array with 3 entries.
- * If the values returned were ['batch', '', ''] it would indicate that
- * - the first dimension was a named symbolic dimension (-1 dim value and name in symbolic dimensions),
- * - the second dimension was an unnamed symbolic dimension (-1 dim value and empty string),
- * - the entry for the third dimension should be ignored as it is not a symbolic dimension (dim value >= 0).
- */
+ * Get the symbolic dimension names for dimensions with a value of -1.
+ * Order and number of entries is the same as values returned by GetDimensions.
+ * The name may be empty for an unnamed symbolic dimension.
+ * e.g.
+ * If OrtGetDimensions returns [-1, -1, 2], OrtGetSymbolicDimensions would return an array with 3 entries.
+ * If the values returned were ['batch', '', ''] it would indicate that
+ * - the first dimension was a named symbolic dimension (-1 dim value and name in symbolic dimensions),
+ * - the second dimension was an unnamed symbolic dimension (-1 dim value and empty string),
+ * - the entry for the third dimension should be ignored as it is not a symbolic dimension (dim value >= 0).
+ */
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtGetSymbolicDimensions(
- IntPtr /*(const struct OrtTensorTypeAndShapeInfo*)*/ typeAndShapeInfo,
- IntPtr[] dim_params, /* const char* values, converted to string by caller */
- UIntPtr dim_params_length);
+ IntPtr /*(const struct OrtTensorTypeAndShapeInfo*)*/ typeAndShapeInfo,
+ IntPtr[] dim_params, /* const char* values, converted to string by caller */
+ UIntPtr dim_params_length);
public static DOrtGetSymbolicDimensions OrtGetSymbolicDimensions;
@@ -1975,15 +1969,15 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
*/
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtGetTensorShapeElementCount(IntPtr /*(const struct OrtTensorTypeAndShapeInfo*)*/ typeAndShapeInfo,
- out UIntPtr /* size_t */ output);
+ out UIntPtr /* size_t */ output);
public static DOrtGetTensorShapeElementCount OrtGetTensorShapeElementCount;
- [UnmanagedFunctionPointer(CallingConvention.Winapi)]
// The out ortMemoryInfo must not be destroyed/deallocated. The pointer points to an object owned by
// the contained Tensor/SparseTensor.
+ [UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DOrtGetTensorMemoryInfo(IntPtr /* const OrtValue* */ ortValue,
- out IntPtr /* const OrtMemoryInfo** */ ortMemoryInfo);
+ out IntPtr /* const OrtMemoryInfo** */ ortMemoryInfo);
public static DOrtGetTensorMemoryInfo OrtGetTensorMemoryInfo;
@@ -1993,10 +1987,12 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
public static DCastTypeInfoToMapTypeInfo OrtCastTypeInfoToMapTypeInfo;
+ [UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DGetMapKeyType(IntPtr /*const OrtMapTypeInfo* */ mapTypeInfo, out IntPtr /*(TensorElementType*)*/ tensorElementType);
public static DGetMapKeyType OrtGetMapKeyType;
+ [UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DGetMapValueType(IntPtr /* const OrtMapTypeInfo* */ map_type_info, out IntPtr /* OrtTypeInfo** */ type_info);
public static DGetMapValueType OrtGetMapValueType;
@@ -2007,13 +2003,14 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
public static DCastTypeInfoToSequenceTypeInfo OrtCastTypeInfoToSequenceTypeInfo;
+ [UnmanagedFunctionPointer(CallingConvention.Winapi)]
public delegate IntPtr /*(OrtStatus*)*/ DGetSequenceElementType(IntPtr /* const OrtSequenceTypeInfo* */ sequenceTypeInfo, out IntPtr /* OrtTypeInfo** */ elementTypeInfo);
public static DGetSequenceElementType OrtGetSequenceElementType;
// OptionalTypeInfo
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
- public delegate IntPtr /*(OrtStatus*)*/ DOrtCastTypeInfoToOptionalTypeInfo(IntPtr /*(struct OrtTypeInfo*)*/ typeInfo, out IntPtr /* const struct OrtOptionalTypeInfo** */ optionalTypeInfo);
+ public delegate IntPtr /*(OrtStatus*)*/ DOrtCastTypeInfoToOptionalTypeInfo(IntPtr /*(struct OrtTypeInfo*)*/ typeInfo, out IntPtr /* const struct OrtOptionalTypeInfo** */ optionalTypeInfo);
public static DOrtCastTypeInfoToOptionalTypeInfo OrtCastTypeInfoToOptionalTypeInfo;
@@ -2027,10 +2024,9 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
public static DOrtReleaseValue OrtReleaseValue;
- #endregion
+#endregion
-
- #region Misc API
+#region Misc API
///
/// Queries all the execution providers supported in the native onnxruntime shared library
@@ -2070,8 +2066,8 @@ IntPtr[] outputValues /* An array of output value pointers. Array must be alloca
public static DOrtReleasePrepackedWeightsContainer OrtReleasePrepackedWeightsContainer;
- #endregion
- } //class NativeMethods
+#endregion
+ } // class NativeMethods
// onnxruntime-extensions helpers to make usage simpler.
// The onnxruntime-extensions nuget package containing the native library can be optionally added to the app.
@@ -2092,7 +2088,5 @@ internal static class OrtExtensionsNativeMethods
CallingConvention = CallingConvention.Winapi)]
public static extern IntPtr /* OrtStatus* */ RegisterCustomOps(IntPtr /* OrtSessionOptions* */ sessionOptions,
ref OrtApiBase /* OrtApiBase* */ ortApiBase);
-
-
}
-} //namespace
+} // namespace
diff --git a/csharp/tools/ValidateNativeDelegateAttributes.py b/csharp/tools/ValidateNativeDelegateAttributes.py
new file mode 100644
index 0000000000000..acd6c173bfeb0
--- /dev/null
+++ b/csharp/tools/ValidateNativeDelegateAttributes.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python3
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License.
+
+import argparse
+import pathlib
+
+
+def check_all_delegates_have_unmanaged_function_pointer_attribute(file: pathlib.Path):
+ """
+ Check that all 'public delegate' declarations have a matching UnmanagedFunctionPointer attribute.
+ :param file: C# source file to check.
+ :return: Number of errors
+ """
+
+ print(f"Checking {file!s}")
+
+ errors = 0
+ line_num = 0
+ with open(str(file.resolve(strict=True))) as f:
+ prev_line = ""
+ for line in f.readlines():
+ line_num += 1
+
+ # strip so it's easier to deal with commented out lines.
+ line = line.strip() # noqa
+ if line.startswith("public delegate ") and not prev_line.startswith("[UnmanagedFunctionPointer"):
+ errors += 1
+ print(f"Line {line_num} is missing UnmanagedFunctionPointer attribute:\n\t{prev_line}\n\t{line}")
+
+ prev_line = line
+
+ return errors
+
+
+def main():
+ arg_parser = argparse.ArgumentParser(
+ "Script to validate that the native delegates for the ONNX Runtime C# managed projects have the required "
+ "attributes for iOS AOT. Paths are inferred from the script location."
+ "Errors of this nature can only be detected at runtime, in a release build, of a Xamarin/MAUI app, "
+ "on an actual iOS device. Due to that we take extra steps to identify problems early."
+ )
+
+ # no real args. just using this to provide description as help message
+ _ = arg_parser.parse_args()
+
+ # CI needs resolve() as __file__ is a relative path when the script is run there
+ script_dir = pathlib.Path(__file__).resolve().parent
+ csharp_root = script_dir.parent
+
+ managed_dir = csharp_root / "src" / "Microsoft.ML.OnnxRuntime"
+ native_methods = managed_dir / "NativeMethods.shared.cs"
+ training_native_methods = managed_dir / "Training" / "NativeTrainingMethods.shared.cs"
+ errors = check_all_delegates_have_unmanaged_function_pointer_attribute(native_methods)
+ errors += check_all_delegates_have_unmanaged_function_pointer_attribute(training_native_methods)
+
+ if errors:
+ raise ValueError(f"{errors} errors were found. Please check output for specifics.")
+
+
+if __name__ == "__main__":
+ main()
diff --git a/docs/ContribOperators.md b/docs/ContribOperators.md
index 169737c9138c3..c73f978bdf404 100644
--- a/docs/ContribOperators.md
+++ b/docs/ContribOperators.md
@@ -54,6 +54,7 @@ Do not modify directly.*
* com.microsoft.MatMulIntegerToFloat
* com.microsoft.MatMulNBits
* com.microsoft.MaxpoolWithMask
+ * com.microsoft.MoE
* com.microsoft.MulInteger
* com.microsoft.MultiHeadAttention
* com.microsoft.MurmurHash3
@@ -2384,7 +2385,7 @@ This version of the operator has been available since version 1 of the 'com.micr
Group Query Self/Cross Attention.
- Supports different number of heads for q and kv.
+ Supports different number of heads for q and kv. Only supports causal or local attention.
#### Version
@@ -2395,6 +2396,8 @@ This version of the operator has been available since version 1 of the 'com.micr
- kv_num_heads : int (required)
- Number of attention heads for k and v
+- local_window_size : int
+- left_window_size for local attention (like Mistral). Default value is -1 meaning unused.
- num_heads : int (required)
- Number of attention heads for q
- scale : float
@@ -2646,8 +2649,8 @@ This version of the operator has been available since version 1 of the 'com.micr
#### Type Constraints
-- T1 : tensor(float), tensor(float16)
-- Constrain input and output types to float/half_float tensors.
+- T1 : tensor(float), tensor(float16), tensor(bfloat16)
+- Constrain input and output types to float/half_float/brain_float tensors.
- T2 : tensor(uint8)
- Constrain quantized weight types to uint8.
@@ -2904,6 +2907,58 @@ This version of the operator has been available since version 1 of the 'com.micr
+### **com.microsoft.MoE**
+
+ Mixture of experts. Examples: Switch transformer(https://arxiv.org/pdf/2101.03961.pdf) use top 1,
+ GLaM(https://arxiv.org/abs/2112.06905) activates top 2 FFN, and Vision MOE(https://arxiv.org/pdf/2106.05974.pdf)
+ usually uses top 32 experts.
+
+
+#### Version
+
+This version of the operator has been available since version 1 of the 'com.microsoft' operator set.
+
+#### Attributes
+
+
+- activation_type : string
+- Activation function to use. Choose from relu, gelu, silu and identity. Default is relu
+- k : int
+- Number of top experts to select from expert pool
+
+
+#### Inputs (4 - 6)
+
+
+- input : T
+- 2D input tensor with shape (num_rows, hidden_size) or 3D input tensor with shape (batch_size, sequence_length, hidden_size)
+- router_probs : T
+- 2D input tensor with shape (num_rows, num_experts)
+- fc1_experts_weights : T
+- 3D input tensor with shape (num_experts, hidden_size, inter_size)
+- fc2_experts_weights : T
+- 3D input tensor with shape (num_experts, inter_size, hidden_size)
+- fc1_experts_bias (optional) : T
+- 2D optional input tensor with shape (num_experts, inter_size)
+- fc2_experts_bias (optional) : T
+- 2D optional input tensor with shape (num_experts, hidden_size)
+
+
+#### Outputs
+
+
+- output : T
+- 2D input tensor with shape (num_rows, hidden_size) or 3D input tensor with shape (batch_size, sequence_length, hidden_size)
+
+
+#### Type Constraints
+
+
+- T : tensor(float), tensor(float16)
+- Constrain input and output types to float or float16 tensors.
+
+
+
### **com.microsoft.MulInteger**
Performs element-wise binary quantized multiplication (with Numpy-style broadcasting support).
@@ -4968,7 +5023,7 @@ This version of the operator has been available since version 1 of the 'com.micr
- input : T
-- 3D tensor with shape (batch_size, sequence_length, hidden_size)
+- 3D tensor with shape (batch_size, sequence_length, hidden_size) or 4D with shape (batch_size, num_heads, sequence_length, head_size)
- position_ids : M
- 1D tensor with shape (1) or 2D tensor with shape (batch_size, sequence_length)
- cos_cache : T
@@ -4981,7 +5036,7 @@ This version of the operator has been available since version 1 of the 'com.micr
- output : T
-- 3D tensor with shape (batch_size, sequence_length, hidden_size)
+- tensor with same shape as input.
#### Type Constraints
diff --git a/docs/OperatorKernels.md b/docs/OperatorKernels.md
index 38783ac044c22..16df788c284ee 100644
--- a/docs/OperatorKernels.md
+++ b/docs/OperatorKernels.md
@@ -665,7 +665,7 @@ Do not modify directly.*
|Mul|*in* A:**T**
*in* B:**T**
*out* C:**T**|14+|**T** = tensor(bfloat16), tensor(double), tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint32), tensor(uint64)|
|||13|**T** = tensor(bfloat16), tensor(double), tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint32), tensor(uint64)|
|||[7, 12]|**T** = tensor(double), tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint32), tensor(uint64)|
-|Neg|*in* X:**T**
*out* Y:**T**|13+|**T** = tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8)|
+|Neg|*in* X:**T**
*out* Y:**T**|13+|**T** = tensor(bfloat16), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8)|
|||[6, 12]|**T** = tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8)|
|NonZero|*in* X:**T**
*out* Y:**tensor(int64)**|13+|**T** = tensor(bool), tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint8)|
|||[9, 12]|**T** = tensor(bool), tensor(float), tensor(float16), tensor(int32), tensor(int64), tensor(uint8)|
@@ -840,8 +840,9 @@ Do not modify directly.*
|Inverse|*in* X:**T**
*out* Y:**T**|1+|**T** = tensor(double), tensor(float), tensor(float16)|
|Irfft|*in* X:**T**
*out* Y:**T**|1+|**T** = tensor(double), tensor(float), tensor(float16)|
|LongformerAttention|*in* input:**T**
*in* weight:**T**
*in* bias:**T**
*in* mask:**T**
*in* global_weight:**T**
*in* global_bias:**T**
*in* global:**G**
*out* output:**T**|1+|**T** = tensor(float), tensor(float16)|
-|MatMulBnb4|*in* A:**T1**
*in* B:**T2**
*in* absmax:**T1**
*out* Y:**T1**|1+|**T1** = tensor(float), tensor(float16)
**T2** = tensor(uint8)|
+|MatMulBnb4|*in* A:**T1**
*in* B:**T2**
*in* absmax:**T1**
*out* Y:**T1**|1+|**T1** = tensor(bfloat16), tensor(float), tensor(float16)
**T2** = tensor(uint8)|
|MatMulNBits|*in* A:**T1**
*in* B:**T2**
*in* scales:**T1**
*in* zero_points:**T2**
*out* Y:**T1**|1+|**T1** = tensor(float), tensor(float16)
**T2** = tensor(uint8)|
+|MoE|*in* input:**T**
*in* router_probs:**T**
*in* fc1_experts_weights:**T**
*in* fc2_experts_weights:**T**
*in* fc1_experts_bias:**T**
*in* fc2_experts_bias:**T**
*out* output:**T**|1+|**T** = tensor(float), tensor(float16)|
|MultiHeadAttention|*in* query:**T**
*in* key:**T**
*in* value:**T**
*in* bias:**T**
*in* key_padding_mask:**M**
*in* relative_position_bias:**T**
*in* past_key:**T**
*in* past_value:**T**
*out* output:**T**
*out* present_key:**T**
*out* present_value:**T**|1+|**T** = tensor(float), tensor(float16)|
|NGramRepeatBlock|*in* input_ids:**Tid**
*in* scores:**T**
*out* scores_out:**T**|1+|**T** = tensor(float)
**Tid** = tensor(int64)|
|NhwcConv|*in* X:**T**
*in* W:**T**
*in* B:**T**
*out* Y:**T**|1+|**T** = tensor(float), tensor(float16)|
diff --git a/include/onnxruntime/core/framework/op_node_proto_helper.h b/include/onnxruntime/core/framework/op_node_proto_helper.h
index 700e1edc0cb7d..e7ac01947af41 100644
--- a/include/onnxruntime/core/framework/op_node_proto_helper.h
+++ b/include/onnxruntime/core/framework/op_node_proto_helper.h
@@ -10,20 +10,6 @@
#include "core/common/gsl.h"
#endif
-#ifdef __has_attribute
-#define ORT_HAVE_ATTRIBUTE(x) __has_attribute(x)
-#else
-#define ORT_HAVE_ATTRIBUTE(x) 0
-#endif
-
-#if ORT_HAVE_ATTRIBUTE(nodiscard)
-#define MUST_USE_RESULT [[nodiscard]]
-#elif defined(__clang__) && ORT_HAVE_ATTRIBUTE(warn_unused_result)
-#define MUST_USE_RESULT __attribute__((warn_unused_result))
-#else
-#define MUST_USE_RESULT
-#endif
-
class IMLOpKernel;
namespace onnxruntime {
@@ -43,14 +29,26 @@ class OpNodeProtoHelper {
Call this function for a required attribute or when a default value for an optional attribute is specified in the op schema
*/
template
- MUST_USE_RESULT Status GetAttr(const std::string& name, T* value) const;
+ Status GetAttr(const std::string& name, T* value) const;
+
+ /**
+ Get a single attribute
+ Call this function for a required attribute or when a default value for an optional attribute is specified in the op schema
+ Throws if an attribute with the specified type doesn't exist
+ */
+ template
+ [[nodiscard]] T GetAttr(const std::string& name) const {
+ T value;
+ ORT_THROW_IF_ERROR(GetAttr(name, &value));
+ return value;
+ }
/**
Get a single attribute
Call this function only when a default value for an optional attribute isn't specified in the op schema
*/
template
- T GetAttrOrDefault(const std::string& name, const T& default_value) const {
+ [[nodiscard]] T GetAttrOrDefault(const std::string& name, const T& default_value) const {
T tmp;
return GetAttr(name, &tmp).IsOK() ? tmp : default_value;
}
@@ -70,7 +68,8 @@ class OpNodeProtoHelper {
Call this function only when a default value for an optional attribute isn't specified in the op schema
*/
template
- MUST_USE_RESULT std::vector GetAttrsOrDefault(const std::string& name, const std::vector& default_value = std::vector{}) const {
+ [[nodiscard]] std::vector GetAttrsOrDefault(const std::string& name,
+ const std::vector& default_value = {}) const {
std::vector tmp;
return GetAttrs(name, tmp).IsOK() ? tmp : default_value;
}
@@ -87,11 +86,12 @@ class OpNodeProtoHelper {
/// Attribute data in a span, out parameter
/// Status
template
- MUST_USE_RESULT Status GetAttrsAsSpan(const std::string& name, gsl::span& values) const;
+ Status GetAttrsAsSpan(const std::string& name, gsl::span& values) const;
- MUST_USE_RESULT Status GetAttrs(const std::string& name, TensorShapeVector& out) const;
+ Status GetAttrs(const std::string& name, TensorShapeVector& out) const;
- MUST_USE_RESULT TensorShapeVector GetAttrsOrDefault(const std::string& name, const TensorShapeVector& default_value = TensorShapeVector{}) const {
+ [[nodiscard]] TensorShapeVector GetAttrsOrDefault(const std::string& name,
+ const TensorShapeVector& default_value = {}) const {
TensorShapeVector tmp;
return GetAttrs(name, tmp).IsOK() ? tmp : default_value;
}
@@ -100,43 +100,43 @@ class OpNodeProtoHelper {
Get repeated attributes
*/
template
- MUST_USE_RESULT Status GetAttrs(const std::string& name, std::vector& values) const;
+ Status GetAttrs(const std::string& name, std::vector& values) const;
template
- MUST_USE_RESULT Status GetAttrs(const std::string& name, gsl::span values) const;
+ Status GetAttrs(const std::string& name, gsl::span values) const;
- MUST_USE_RESULT Status GetAttrsStringRefs(const std::string& name,
- std::vector>& refs) const;
+ Status GetAttrsStringRefs(const std::string& name,
+ std::vector>& refs) const;
- uint32_t GetPrimitiveAttrElementCount(ONNX_NAMESPACE::AttributeProto_AttributeType type,
- const std::string& name) const noexcept;
+ [[nodiscard]] uint32_t GetPrimitiveAttrElementCount(ONNX_NAMESPACE::AttributeProto_AttributeType type,
+ const std::string& name) const noexcept;
- bool HasPrimitiveAttribute(ONNX_NAMESPACE::AttributeProto_AttributeType type,
- const std::string& name) const noexcept;
+ [[nodiscard]] bool HasPrimitiveAttribute(ONNX_NAMESPACE::AttributeProto_AttributeType type,
+ const std::string& name) const noexcept;
- uint32_t GetInputCount() const {
+ [[nodiscard]] uint32_t GetInputCount() const {
return gsl::narrow_cast(impl_->getNumInputs());
}
- uint32_t GetOutputCount() const {
+ [[nodiscard]] uint32_t GetOutputCount() const {
return gsl::narrow_cast(impl_->getNumOutputs());
}
- const ONNX_NAMESPACE::TypeProto* GetInputType(size_t index) const {
+ [[nodiscard]] const ONNX_NAMESPACE::TypeProto* GetInputType(size_t index) const {
return impl_->getInputType(index);
}
- const ONNX_NAMESPACE::TypeProto* GetOutputType(size_t index) const {
+ [[nodiscard]] const ONNX_NAMESPACE::TypeProto* GetOutputType(size_t index) const {
// Work around lack of a const method from the onnx InferenceContext interface
return const_cast(impl_)->getOutputType(index);
}
// Try to query an attribute, returning nullptr if it doesn't exist
- const ONNX_NAMESPACE::AttributeProto* TryGetAttribute(const std::string& name) const {
+ [[nodiscard]] const ONNX_NAMESPACE::AttributeProto* TryGetAttribute(const std::string& name) const {
return impl_->getAttribute(name);
}
- const ONNX_NAMESPACE::AttributeProto* GetAttribute(const std::string& name) const {
+ [[nodiscard]] const ONNX_NAMESPACE::AttributeProto* GetAttribute(const std::string& name) const {
const ONNX_NAMESPACE::AttributeProto* attr = TryGetAttribute(name);
ORT_ENFORCE(attr != nullptr);
return attr;
diff --git a/include/onnxruntime/core/framework/tensor_shape.h b/include/onnxruntime/core/framework/tensor_shape.h
index b3783696b8d78..82a1c1de83523 100644
--- a/include/onnxruntime/core/framework/tensor_shape.h
+++ b/include/onnxruntime/core/framework/tensor_shape.h
@@ -2,34 +2,17 @@
// Licensed under the MIT License.
#pragma once
-#include
-#include
+
#include
-#include
#include
-#include "core/common/gsl.h"
-#include "onnxruntime_config.h"
-
-#ifndef DISABLE_ABSEIL
-// Need to include abseil inlined_vector.h header directly here
-// as hash tables cause CUDA 10.2 compilers to fail. inlined_vector.h is fine.
-#ifdef _MSC_VER
-#pragma warning(push)
-// C4127: conditional expression is constant
-#pragma warning(disable : 4127)
-// C4324: structure was padded due to alignment specifier
-// Usage of alignas causes some internal padding in places.
-#pragma warning(disable : 4324)
-#endif
-
-#include
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-#endif // DISABLE_ABSEIL
+#include
+#include
+#include
+#include "core/common/gsl.h"
+#include "core/common/inlined_containers_fwd.h"
#include "core/common/span_utils.h"
+#include "onnxruntime_config.h"
namespace onnxruntime {
#ifdef __GNUC__
@@ -41,18 +24,10 @@ namespace onnxruntime {
constexpr size_t kTensorShapeSmallBufferElementsSize = 5;
-#ifndef DISABLE_ABSEIL
// Use this type to build a shape and then create TensorShape.
-using TensorShapeVector = absl::InlinedVector;
-#else
-class TensorShapeVector : public std::vector {
- using Base = std::vector;
-
- public:
- using Base::Base;
-};
-
-#endif // DISABLE_ABSEIL
+// We opt to re-use a common instantiation instead of a typedef with kTensorShapeSmallBufferElementsSize
+// To reduce on binary size.
+using TensorShapeVector = InlinedVector;
inline TensorShapeVector ToShapeVector(const gsl::span& span) {
TensorShapeVector out;
@@ -194,9 +169,7 @@ class TensorShape {
friend struct ProviderHostImpl; // So that the shared provider interface can access Allocate
};
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
-#endif
+
// operator<< to nicely output to a stream
std::ostream& operator<<(std::ostream& out, const TensorShape& shape);
diff --git a/include/onnxruntime/core/graph/graph.h b/include/onnxruntime/core/graph/graph.h
index 462d410e13769..fe0734c51f807 100644
--- a/include/onnxruntime/core/graph/graph.h
+++ b/include/onnxruntime/core/graph/graph.h
@@ -397,6 +397,10 @@ class Node {
#if !defined(ORT_MINIMAL_BUILD) || defined(ORT_EXTENDED_MINIMAL_BUILD)
/** Remove the specified attribute from this Node */
bool ClearAttribute(const std::string& attr_name);
+
+ /** Gets the Node's mutable attributes. */
+ NodeAttributes& GetMutableAttributes() noexcept { return attributes_; }
+
#endif // !defined(ORT_MINIMAL_BUILD) || defined(ORT_EXTENDED_MINIMAL_BUILD)
/**
@@ -406,8 +410,6 @@ class Node {
int PruneRemovableAttributes(gsl::span removable_attributes);
#if !defined(ORT_MINIMAL_BUILD)
- /** Gets the Node's mutable attributes. */
- NodeAttributes& GetMutableAttributes() noexcept { return attributes_; }
/** Gets the Graph instance that is instantiated from a GraphProto attribute during Graph::Resolve.
@param attr_name Attribute name for the GraphProto attribute.
@@ -441,6 +443,13 @@ class Node {
return attr_to_subgraph_map_;
}
+ /** Gets a map of attribute name to the mutable Graph instances for all subgraphs of the Node.
+ * @returns a mutable map of mutable subgraphs.
+ */
+ std::unordered_map>& GetMutableMapOfAttributeNameToSubgraph() {
+ return attr_to_subgraph_map_;
+ }
+
/** Gets a map of attribute name to the const Graph instances for all subgraphs of the Node.
@returns Map of the attribute name that defines the subgraph to the subgraph's Graph instance.
nullptr if the Node has no subgraphs.
@@ -586,7 +595,7 @@ class Node {
// create a Graph instance for an attribute that contains a GraphProto
void CreateSubgraph(const std::string& attr_name);
- const std::vector>& MutableSubgraphs() noexcept { return subgraphs_; }
+ std::vector>& MutableSubgraphs() noexcept { return subgraphs_; }
// validate and update the input arg count
common::Status UpdateInputArgCount();
@@ -1134,6 +1143,26 @@ class Graph {
*/
Node& FuseSubGraph(const IndexedSubGraph& sub_graph, const std::string& fused_node_name);
+ /**
+ Directly insert one of the If node branches into this Graph.
+ `If` node condition must be a constant. The function would
+ rename the nodes of the corresponding subgraph to make sure there is no conflict.
+
+ Explicit and implicit inputs references stay the same.
+
+ All of the outputs of the subgraph being inlined should be renamed
+ to the outputs of the If node.
+
+ The function will process any subgraphs in each of the nodes being inlined,
+ and will rename any references to the new names introduced.
+
+ @param condition_value If condition value
+ @param if_node - the node that contains the graph_to_inline. This node is going
+ to be deleted and replaced by the corresponding graph (either then or else)
+ @param logger
+ */
+ Status InlineIfSubgraph(bool condition_value, Node& if_node, const logging::Logger& logger);
+
/**
Directly insert the nodes in the function Node provided into this Graph.
The Graph needs to be Resolve()d after this call.
diff --git a/include/onnxruntime/core/providers/cuda/cuda_context.h b/include/onnxruntime/core/providers/cuda/cuda_context.h
index 646f33ed952a4..d73d551920d47 100644
--- a/include/onnxruntime/core/providers/cuda/cuda_context.h
+++ b/include/onnxruntime/core/providers/cuda/cuda_context.h
@@ -1,5 +1,13 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
+
+// This header is to expose a context for cuda custom ops.
+// By the context, a custom cuda operator could fetch existing resources,
+// such as cuda stream and cudnn handle, for reusing.
+
+// For concrete usage, pls find page here:
+// https://onnxruntime.ai/docs/reference/operators/add-custom-op.html#custom-ops-for-cuda-and-rocm
+
#pragma once
#define ORT_CUDA_CTX
@@ -21,7 +29,7 @@ struct CudaContext : public CustomOpContext {
cublasHandle_t cublas_handle = {};
OrtAllocator* deferred_cpu_allocator = {};
- void Init(const OrtKernelContext& kernel_ctx) override {
+ void Init(const OrtKernelContext& kernel_ctx) {
const auto& ort_api = Ort::GetApi();
void* resource = {};
OrtStatus* status = nullptr;
diff --git a/include/onnxruntime/core/providers/custom_op_context.h b/include/onnxruntime/core/providers/custom_op_context.h
index 547f9a90aff85..8f3d2476d4fdb 100644
--- a/include/onnxruntime/core/providers/custom_op_context.h
+++ b/include/onnxruntime/core/providers/custom_op_context.h
@@ -3,11 +3,8 @@
#pragma once
-#include
-
// CustomOpContext defines an interface allowing a custom op to access ep-specific resources.
struct CustomOpContext {
CustomOpContext() = default;
virtual ~CustomOpContext(){};
- virtual void Init(const OrtKernelContext&){};
};
\ No newline at end of file
diff --git a/include/onnxruntime/core/providers/dml/dml_provider_factory.h b/include/onnxruntime/core/providers/dml/dml_provider_factory.h
index cf3ddc3f125f9..7d7f05193f486 100644
--- a/include/onnxruntime/core/providers/dml/dml_provider_factory.h
+++ b/include/onnxruntime/core/providers/dml/dml_provider_factory.h
@@ -37,9 +37,13 @@ enum OrtDmlPerformancePreference {
};
enum OrtDmlDeviceFilter : uint32_t {
+#ifdef ENABLE_NPU_ADAPTER_ENUMERATION
Any = 0xffffffff,
Gpu = 1 << 0,
Npu = 1 << 1,
+#else
+ Gpu = 1 << 0,
+#endif
};
inline OrtDmlDeviceFilter operator~(OrtDmlDeviceFilter a) { return (OrtDmlDeviceFilter) ~(int)a; }
diff --git a/include/onnxruntime/core/providers/rocm/rocm_context.h b/include/onnxruntime/core/providers/rocm/rocm_context.h
index ff62094f3f439..5f04289a8c6e0 100644
--- a/include/onnxruntime/core/providers/rocm/rocm_context.h
+++ b/include/onnxruntime/core/providers/rocm/rocm_context.h
@@ -18,7 +18,7 @@ struct RocmContext : public CustomOpContext {
miopenHandle_t miopen_handle = {};
rocblas_handle rblas_handle = {};
- void Init(const OrtKernelContext& kernel_ctx) override {
+ void Init(const OrtKernelContext& kernel_ctx) {
const auto& ort_api = Ort::GetApi();
void* resource = {};
OrtStatus* status = nullptr;
diff --git a/include/onnxruntime/core/session/onnxruntime_c_api.h b/include/onnxruntime/core/session/onnxruntime_c_api.h
index 1d02b72342722..cddad732104ed 100644
--- a/include/onnxruntime/core/session/onnxruntime_c_api.h
+++ b/include/onnxruntime/core/session/onnxruntime_c_api.h
@@ -599,9 +599,11 @@ typedef struct OrtTensorRTProviderOptions {
* \see OrtApi::SessionOptionsAppendExecutionProvider_MIGraphX
*/
typedef struct OrtMIGraphXProviderOptions {
- int device_id; // hip device id.
- int migraphx_fp16_enable; // enable MIGraphX FP16 precision. Default 0 = false, nonzero = true
- int migraphx_int8_enable; // enable MIGraphX INT8 precision. Default 0 = false, nonzero = true
+ 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
} OrtMIGraphXProviderOptions;
/** \brief OpenVINO Provider Options
@@ -3604,6 +3606,7 @@ struct OrtApi {
* "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.
diff --git a/include/onnxruntime/core/session/onnxruntime_lite_custom_op.h b/include/onnxruntime/core/session/onnxruntime_lite_custom_op.h
index 443710884743a..0c0af16d4e20c 100644
--- a/include/onnxruntime/core/session/onnxruntime_lite_custom_op.h
+++ b/include/onnxruntime/core/session/onnxruntime_lite_custom_op.h
@@ -399,6 +399,15 @@ struct TensorArray : public ArgBase {
using Variadic = TensorArray;
+/*
+Note:
+OrtLiteCustomOp inherits from OrtCustomOp to bridge tween a custom func/struct and ort core.
+The lifetime of an OrtLiteCustomOp instance is managed by customer code, not ort, so:
+1. DO NOT cast OrtLiteCustomOp to OrtCustomOp and release since there is no virtual destructor in the hierachy.
+2. OrtLiteCustomFunc and OrtLiteCustomStruct, as two sub-structs, can be released in form of OrtLiteCustomOp since all members are kept in the OrtLiteCustomOp,
+ hence memory could still be recycled properly.
+Further, OrtCustomOp is a c struct bearing no v-table, so offspring structs are by design to be of zero virtual functions to maintain cast safety.
+*/
struct OrtLiteCustomOp : public OrtCustomOp {
using ConstOptionalFloatTensor = std::optional&>;
using OptionalFloatTensor = std::optional>;
@@ -774,10 +783,13 @@ struct OrtLiteCustomOp : public OrtCustomOp {
OrtLiteCustomOp(const char* op_name,
const char* execution_provider,
- int start_ver = 1, int end_ver = MAX_CUSTOM_OP_END_VER) : op_name_(op_name),
- execution_provider_(execution_provider),
- start_ver_(start_ver),
- end_ver_(end_ver) {
+ ShapeInferFn shape_infer_fn,
+ int start_ver = 1,
+ int end_ver = MAX_CUSTOM_OP_END_VER) : op_name_(op_name),
+ execution_provider_(execution_provider),
+ shape_infer_fn_(shape_infer_fn),
+ start_ver_(start_ver),
+ end_ver_(end_ver) {
OrtCustomOp::version = ORT_API_VERSION;
OrtCustomOp::GetName = [](const OrtCustomOp* op) { return static_cast(op)->op_name_.c_str(); };
@@ -858,8 +870,13 @@ struct OrtLiteCustomOp : public OrtCustomOp {
std::vector input_types_;
std::vector output_types_;
+ ShapeInferFn shape_infer_fn_ = {};
+
int start_ver_ = 1;
int end_ver_ = MAX_CUSTOM_OP_END_VER;
+
+ void* compute_fn_ = {};
+ void* compute_fn_return_status_ = {};
};
//////////////////////////// OrtLiteCustomFunc ////////////////////////////////
@@ -891,9 +908,8 @@ struct OrtLiteCustomFunc : public OrtLiteCustomOp {
ComputeFn compute_fn,
ShapeInferFn shape_infer_fn = {},
int start_ver = 1,
- int end_ver = MAX_CUSTOM_OP_END_VER) : OrtLiteCustomOp(op_name, execution_provider, start_ver, end_ver),
- compute_fn_(compute_fn),
- shape_infer_fn_(shape_infer_fn) {
+ int end_ver = MAX_CUSTOM_OP_END_VER) : OrtLiteCustomOp(op_name, execution_provider, shape_infer_fn, start_ver, end_ver) {
+ compute_fn_ = reinterpret_cast(compute_fn);
ParseArgs(input_types_, output_types_);
OrtCustomOp::KernelCompute = [](void* op_kernel, OrtKernelContext* context) {
@@ -905,7 +921,8 @@ struct OrtLiteCustomFunc : public OrtLiteCustomOp {
OrtCustomOp::CreateKernel = [](const OrtCustomOp* this_, const OrtApi* ort_api, const OrtKernelInfo* info) {
auto kernel = std::make_unique();
- kernel->compute_fn_ = static_cast(this_)->compute_fn_;
+ auto me = static_cast(this_);
+ kernel->compute_fn_ = reinterpret_cast(me->compute_fn_);
Ort::ThrowOnError(ort_api->KernelInfo_GetInputCount(info, &kernel->num_input_));
Ort::ThrowOnError(ort_api->KernelInfo_GetOutputCount(info, &kernel->num_output_));
auto self = static_cast(this_);
@@ -931,9 +948,8 @@ struct OrtLiteCustomFunc : public OrtLiteCustomOp {
ComputeFnReturnStatus compute_fn_return_status,
ShapeInferFn shape_infer_fn = {},
int start_ver = 1,
- int end_ver = MAX_CUSTOM_OP_END_VER) : OrtLiteCustomOp(op_name, execution_provider, start_ver, end_ver),
- compute_fn_return_status_(compute_fn_return_status),
- shape_infer_fn_(shape_infer_fn) {
+ int end_ver = MAX_CUSTOM_OP_END_VER) : OrtLiteCustomOp(op_name, execution_provider, shape_infer_fn, start_ver, end_ver) {
+ compute_fn_return_status_ = reinterpret_cast(compute_fn_return_status);
ParseArgs(input_types_, output_types_);
OrtCustomOp::KernelComputeV2 = [](void* op_kernel, OrtKernelContext* context) -> OrtStatusPtr {
@@ -945,7 +961,8 @@ struct OrtLiteCustomFunc : public OrtLiteCustomOp {
OrtCustomOp::CreateKernel = [](const OrtCustomOp* this_, const OrtApi* ort_api, const OrtKernelInfo* info) {
auto kernel = std::make_unique();
- kernel->compute_fn_return_status_ = static_cast(this_)->compute_fn_return_status_;
+ auto me = static_cast(this_);
+ kernel->compute_fn_return_status_ = reinterpret_cast(me->compute_fn_return_status_);
Ort::ThrowOnError(ort_api->KernelInfo_GetInputCount(info, &kernel->num_input_));
Ort::ThrowOnError(ort_api->KernelInfo_GetOutputCount(info, &kernel->num_output_));
auto self = static_cast(this_);
@@ -965,10 +982,6 @@ struct OrtLiteCustomFunc : public OrtLiteCustomOp {
};
}
}
-
- ComputeFn compute_fn_ = {};
- ComputeFnReturnStatus compute_fn_return_status_ = {};
- ShapeInferFn shape_infer_fn_ = {};
}; // struct OrtLiteCustomFunc
/////////////////////////// OrtLiteCustomStruct ///////////////////////////
@@ -1007,7 +1020,7 @@ struct OrtLiteCustomStruct : public OrtLiteCustomOp {
OrtLiteCustomStruct(const char* op_name,
const char* execution_provider,
int start_ver = 1,
- int end_ver = MAX_CUSTOM_OP_END_VER) : OrtLiteCustomOp(op_name, execution_provider, start_ver, end_ver) {
+ int end_ver = MAX_CUSTOM_OP_END_VER) : OrtLiteCustomOp(op_name, execution_provider, {}, start_ver, end_ver) {
SetCompute(&CustomOp::Compute);
OrtCustomOp::CreateKernel = [](const OrtCustomOp* this_, const OrtApi* ort_api, const OrtKernelInfo* info) {
diff --git a/js/.eslintrc.js b/js/.eslintrc.js
index 56d2d45ee5d4f..0bf47c5264f61 100644
--- a/js/.eslintrc.js
+++ b/js/.eslintrc.js
@@ -5,10 +5,18 @@
module.exports = {
root: true,
- ignorePatterns: ['**/*.js', 'ort-schema/', 'common/test/type-tests/', 'test/data/', 'node_modules/', 'dist/'],
+ ignorePatterns: [
+ '**/*.js',
+ 'node_modules/',
+ 'ort-schema/',
+ 'common/test/type-tests/',
+ 'web/types.d.ts',
+ 'test/data/',
+ 'dist/',
+ ],
env: { 'es6': true },
parser: '@typescript-eslint/parser',
- parserOptions: { 'project': 'tsconfig.json', 'sourceType': 'module' },
+ parserOptions: { 'project': true, 'sourceType': 'module' },
plugins: ['@typescript-eslint', 'prefer-arrow', 'header', 'import', 'unicorn', 'jsdoc'],
rules: {
'unicorn/filename-case': 'error',
@@ -145,7 +153,54 @@ module.exports = {
}
}, {
files: ['web/lib/**/*.ts'], rules: {
- 'no-underscore-dangle': 'off',
+ 'no-underscore-dangle': ['error', {
+ 'allow': [
+ '_free',
+ '_malloc',
+ '_JsepGetNodeName',
+ '_JsepOutput',
+ '_OrtAddFreeDimensionOverride',
+ '_OrtAddRunConfigEntry',
+ '_OrtAddSessionConfigEntry',
+ '_OrtAppendExecutionProvider',
+ '_OrtBindInput',
+ '_OrtBindOutput',
+ '_OrtClearBoundOutputs',
+ '_OrtCreateBinding',
+ '_OrtCreateRunOptions',
+ '_OrtCreateSession',
+ '_OrtCreateSessionOptions',
+ '_OrtCreateTensor',
+ '_OrtEndProfiling',
+ '_OrtFree',
+ '_OrtGetInputName',
+ '_OrtGetInputOutputCount',
+ '_OrtGetLastError',
+ '_OrtGetOutputName',
+ '_OrtGetTensorData',
+ '_OrtInit',
+ '_OrtReleaseBinding',
+ '_OrtReleaseRunOptions',
+ '_OrtReleaseSession',
+ '_OrtReleaseSessionOptions',
+ '_OrtReleaseTensor',
+ '_OrtRun',
+ '_OrtRunWithBinding',
+ '_OrtTrainingCopyParametersFromBuffer',
+ '_OrtTrainingCopyParametersToBuffer',
+ '_OrtTrainingCreateSession',
+ '_OrtTrainingEvalStep',
+ '_OrtTrainingGetModelInputOutputCount',
+ '_OrtTrainingGetModelInputOutputName',
+ '_OrtTrainingGetParametersSize',
+ '_OrtTrainingLazyResetGrad',
+ '_OrtTrainingLoadCheckpoint',
+ '_OrtTrainingOptimizerStep',
+ '_OrtTrainingReleaseCheckpoint',
+ '_OrtTrainingReleaseSession',
+ '_OrtTrainingRunTrainStep'
+ ]
+ }]
}
}, {
files: ['web/lib/onnxjs/**/*.ts'], rules: {
@@ -158,6 +213,7 @@ module.exports = {
'import/no-internal-modules': 'off',
'prefer-arrow/prefer-arrow-functions': 'off',
'no-param-reassign': 'off',
+ 'no-underscore-dangle': 'off',
'guard-for-in': 'off'
}
}, {
diff --git a/js/README.md b/js/README.md
index 7e6681e6bd897..1662de6d4ac78 100644
--- a/js/README.md
+++ b/js/README.md
@@ -344,13 +344,13 @@ From ORT v1.13 onwards the 'full' ONNX Runtime package is used. It supports both
Full build:
```sh
- python tools/ci_build/github/apple/build_ios_framework.py tools/ci_build/github/apple/default_full_ios_framework_build_settings.json --config Release
+ python tools/ci_build/github/apple/build_apple_framework.py tools/ci_build/github/apple/default_full_apple_framework_build_settings.json --config Release
```
Reduced size build:
```sh
- python tools/ci_build/github/apple/build_ios_framework.py tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json --config MinSizeRel --include_ops_by_config --enable_reduced_operator_type_support
+ python tools/ci_build/github/apple/build_apple_framework.py tools/ci_build/github/apple/default_mobile_ios_framework_build_settings.json --config MinSizeRel --include_ops_by_config --enable_reduced_operator_type_support
```
The build creates `Headers`, `LICENSE`, and `onnxruntime.xcframework` in `build/iOS_framework/framework_out` directory. From `framework_out` directory, create an archive file named `onnxruntime-c.zip` for a full build or `onnxruntime-mobile-c.zip` for a reduced size build and copy to `/js/react_native/local_pods` directory.
diff --git a/js/common/lib/inference-session.ts b/js/common/lib/inference-session.ts
index 8c1e69a68ca7e..c7760692eed00 100644
--- a/js/common/lib/inference-session.ts
+++ b/js/common/lib/inference-session.ts
@@ -241,6 +241,7 @@ export declare namespace InferenceSession {
export interface WebNNExecutionProviderOption extends ExecutionProviderOption {
readonly name: 'webnn';
deviceType?: 'cpu'|'gpu';
+ numThreads?: number;
powerPreference?: 'default'|'low-power'|'high-performance';
}
export interface CoreMLExecutionProviderOption extends ExecutionProviderOption {
diff --git a/js/common/tsconfig.json b/js/common/tsconfig.json
index 4751cd7564f5d..d7bb3a593f66f 100644
--- a/js/common/tsconfig.json
+++ b/js/common/tsconfig.json
@@ -4,8 +4,7 @@
"outDir": "./dist/esm",
"declaration": true,
"declarationMap": true,
- "esModuleInterop": false,
- "noUnusedParameters": true
+ "esModuleInterop": false
},
"include": ["lib"]
}
diff --git a/js/node/package-lock.json b/js/node/package-lock.json
index ce390aa88c0aa..c1cf8af4bb80e 100644
--- a/js/node/package-lock.json
+++ b/js/node/package-lock.json
@@ -22,7 +22,7 @@
"jsonc": "^2.0.0",
"minimist": "^1.2.8",
"node-addon-api": "^6.0.0",
- "onnx-proto": "^8.0.1"
+ "protobufjs": "^7.2.4"
}
},
"../common": {
@@ -97,12 +97,6 @@
"integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==",
"dev": true
},
- "node_modules/@types/long": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz",
- "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==",
- "dev": true
- },
"node_modules/@types/minimist": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz",
@@ -165,9 +159,9 @@
"dev": true
},
"node_modules/axios": {
- "version": "1.3.4",
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.3.4.tgz",
- "integrity": "sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==",
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz",
+ "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==",
"dev": true,
"dependencies": {
"follow-redirects": "^1.15.0",
@@ -528,9 +522,9 @@
"dev": true
},
"node_modules/long": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
- "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==",
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz",
+ "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==",
"dev": true
},
"node_modules/lru-cache": {
@@ -663,15 +657,6 @@
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
}
},
- "node_modules/onnx-proto": {
- "version": "8.0.1",
- "resolved": "https://registry.npmjs.org/onnx-proto/-/onnx-proto-8.0.1.tgz",
- "integrity": "sha512-ZpPTqp5dneh2bvavk/QpDsf20JJRArjqTkiMfshGmxR8ocjmfTk80fkW00FwLO7qRtybo9NPugcWQrumHYctLQ==",
- "dev": true,
- "dependencies": {
- "protobufjs": "^6.11.2"
- }
- },
"node_modules/onnxruntime-common": {
"resolved": "../common",
"link": true
@@ -690,9 +675,9 @@
}
},
"node_modules/protobufjs": {
- "version": "6.11.4",
- "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.4.tgz",
- "integrity": "sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw==",
+ "version": "7.2.5",
+ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz",
+ "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
@@ -706,13 +691,11 @@
"@protobufjs/path": "^1.1.2",
"@protobufjs/pool": "^1.1.0",
"@protobufjs/utf8": "^1.1.0",
- "@types/long": "^4.0.1",
"@types/node": ">=13.7.0",
- "long": "^4.0.0"
+ "long": "^5.0.0"
},
- "bin": {
- "pbjs": "bin/pbjs",
- "pbts": "bin/pbts"
+ "engines": {
+ "node": ">=12.0.0"
}
},
"node_modules/proxy-from-env": {
@@ -789,9 +772,9 @@
]
},
"node_modules/semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.5.4",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
+ "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -1070,12 +1053,6 @@
"integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==",
"dev": true
},
- "@types/long": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz",
- "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==",
- "dev": true
- },
"@types/minimist": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.2.tgz",
@@ -1126,9 +1103,9 @@
"dev": true
},
"axios": {
- "version": "1.3.4",
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.3.4.tgz",
- "integrity": "sha512-toYm+Bsyl6VC5wSkfkbbNB6ROv7KY93PEBBL6xyDczaIHasAiv4wPqQ/c4RjoQzipxRD2W5g21cOqQulZ7rHwQ==",
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.1.tgz",
+ "integrity": "sha512-vfBmhDpKafglh0EldBEbVuoe7DyAavGSLWhuSm5ZSEKQnHhBf0xAAwybbNH1IkrJNGnS/VG4I5yxig1pCEXE4g==",
"dev": true,
"requires": {
"follow-redirects": "^1.15.0",
@@ -1413,9 +1390,9 @@
"dev": true
},
"long": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
- "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==",
+ "version": "5.2.3",
+ "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz",
+ "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==",
"dev": true
},
"lru-cache": {
@@ -1523,15 +1500,6 @@
"set-blocking": "^2.0.0"
}
},
- "onnx-proto": {
- "version": "8.0.1",
- "resolved": "https://registry.npmjs.org/onnx-proto/-/onnx-proto-8.0.1.tgz",
- "integrity": "sha512-ZpPTqp5dneh2bvavk/QpDsf20JJRArjqTkiMfshGmxR8ocjmfTk80fkW00FwLO7qRtybo9NPugcWQrumHYctLQ==",
- "dev": true,
- "requires": {
- "protobufjs": "^6.11.2"
- }
- },
"onnxruntime-common": {
"version": "file:../common",
"requires": {
@@ -1549,9 +1517,9 @@
}
},
"protobufjs": {
- "version": "6.11.4",
- "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.4.tgz",
- "integrity": "sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw==",
+ "version": "7.2.5",
+ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz",
+ "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==",
"dev": true,
"requires": {
"@protobufjs/aspromise": "^1.1.2",
@@ -1564,9 +1532,8 @@
"@protobufjs/path": "^1.1.2",
"@protobufjs/pool": "^1.1.0",
"@protobufjs/utf8": "^1.1.0",
- "@types/long": "^4.0.1",
"@types/node": ">=13.7.0",
- "long": "^4.0.0"
+ "long": "^5.0.0"
}
},
"proxy-from-env": {
@@ -1619,9 +1586,9 @@
"dev": true
},
"semver": {
- "version": "7.3.8",
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
- "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
+ "version": "7.5.4",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
+ "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
diff --git a/js/node/package.json b/js/node/package.json
index 0f8f0e9d2260c..8e591d8f46b9d 100644
--- a/js/node/package.json
+++ b/js/node/package.json
@@ -19,6 +19,7 @@
},
"scripts": {
"buildr": "tsc && node ./script/build --config=RelWithDebInfo",
+ "preprepare": "node -e \"require('node:fs').copyFileSync('./node_modules/long/index.d.ts', './node_modules/long/umd/index.d.ts')\"",
"prepare": "tsc --build script test .",
"rebuild": "tsc && node ./script/build --rebuild",
"rebuildd": "tsc && node ./script/build --rebuild --config=Debug",
@@ -39,7 +40,7 @@
"jsonc": "^2.0.0",
"minimist": "^1.2.8",
"node-addon-api": "^6.0.0",
- "onnx-proto": "^8.0.1"
+ "protobufjs": "^7.2.4"
},
"main": "dist/index.js",
"os": [
diff --git a/js/node/test/ort-schema/protobuf/.gitignore b/js/node/test/ort-schema/protobuf/.gitignore
new file mode 100644
index 0000000000000..092bb6c1c9fb4
--- /dev/null
+++ b/js/node/test/ort-schema/protobuf/.gitignore
@@ -0,0 +1,2 @@
+!onnx.js
+!onnx.d.ts
diff --git a/js/node/test/ort-schema/protobuf/README.md b/js/node/test/ort-schema/protobuf/README.md
new file mode 100644
index 0000000000000..f5f52c602f1ad
--- /dev/null
+++ b/js/node/test/ort-schema/protobuf/README.md
@@ -0,0 +1,21 @@
+# ONNX protobuf
+
+This directory contains generated protobuf definition for onnx:
+
+- onnx.js
+- onnx.d.ts
+
+These files are generated from [a fork of onnx-proto](https://github.com/fs-eire/onnx-proto/tree/update-v9).
+
+The ONNX protobuf uses protobufjs@7.2.4, which depends on long@5.2.3, the version contains 2 bugs:
+
+- type export does not work with commonjs. described in https://github.com/dcodeIO/long.js/pull/124. added a "postinstall" script to fix.
+- in the generated typescript declaration file 'onnx.d.ts', the following line:
+ ```ts
+ import Long = require("long");
+ ```
+ need to be replaced to fix type import error:
+ ```ts
+ import Long from "long";
+ ```
+ this replacement is done and code format is also applied to file 'onnx.d.ts'.
diff --git a/js/node/test/ort-schema/protobuf/onnx.d.ts b/js/node/test/ort-schema/protobuf/onnx.d.ts
new file mode 100644
index 0000000000000..c60264dca2a8d
--- /dev/null
+++ b/js/node/test/ort-schema/protobuf/onnx.d.ts
@@ -0,0 +1,2627 @@
+import Long from 'long';
+import * as $protobuf from 'protobufjs';
+
+/** Namespace onnx. */
+export namespace onnx {
+
+ /** Version enum. */
+ enum Version {
+ _START_VERSION = 0,
+ IR_VERSION_2017_10_10 = 1,
+ IR_VERSION_2017_10_30 = 2,
+ IR_VERSION_2017_11_3 = 3,
+ IR_VERSION_2019_1_22 = 4,
+ IR_VERSION_2019_3_18 = 5,
+ IR_VERSION_2019_9_19 = 6,
+ IR_VERSION_2020_5_8 = 7,
+ IR_VERSION_2021_7_30 = 8,
+ IR_VERSION = 9
+ }
+
+ /** Properties of an AttributeProto. */
+ interface IAttributeProto {
+ /** AttributeProto name */
+ name?: (string|null);
+
+ /** AttributeProto refAttrName */
+ refAttrName?: (string|null);
+
+ /** AttributeProto docString */
+ docString?: (string|null);
+
+ /** AttributeProto type */
+ type?: (onnx.AttributeProto.AttributeType|null);
+
+ /** AttributeProto f */
+ f?: (number|null);
+
+ /** AttributeProto i */
+ i?: (number|Long|null);
+
+ /** AttributeProto s */
+ s?: (Uint8Array|null);
+
+ /** AttributeProto t */
+ t?: (onnx.ITensorProto|null);
+
+ /** AttributeProto g */
+ g?: (onnx.IGraphProto|null);
+
+ /** AttributeProto sparseTensor */
+ sparseTensor?: (onnx.ISparseTensorProto|null);
+
+ /** AttributeProto tp */
+ tp?: (onnx.ITypeProto|null);
+
+ /** AttributeProto floats */
+ floats?: (number[]|null);
+
+ /** AttributeProto ints */
+ ints?: ((number | Long)[]|null);
+
+ /** AttributeProto strings */
+ strings?: (Uint8Array[]|null);
+
+ /** AttributeProto tensors */
+ tensors?: (onnx.ITensorProto[]|null);
+
+ /** AttributeProto graphs */
+ graphs?: (onnx.IGraphProto[]|null);
+
+ /** AttributeProto sparseTensors */
+ sparseTensors?: (onnx.ISparseTensorProto[]|null);
+
+ /** AttributeProto typeProtos */
+ typeProtos?: (onnx.ITypeProto[]|null);
+ }
+
+ /** Represents an AttributeProto. */
+ class AttributeProto implements IAttributeProto {
+ /**
+ * Constructs a new AttributeProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.IAttributeProto);
+
+ /** AttributeProto name. */
+ public name: string;
+
+ /** AttributeProto refAttrName. */
+ public refAttrName: string;
+
+ /** AttributeProto docString. */
+ public docString: string;
+
+ /** AttributeProto type. */
+ public type: onnx.AttributeProto.AttributeType;
+
+ /** AttributeProto f. */
+ public f: number;
+
+ /** AttributeProto i. */
+ public i: (number|Long);
+
+ /** AttributeProto s. */
+ public s: Uint8Array;
+
+ /** AttributeProto t. */
+ public t?: (onnx.ITensorProto|null);
+
+ /** AttributeProto g. */
+ public g?: (onnx.IGraphProto|null);
+
+ /** AttributeProto sparseTensor. */
+ public sparseTensor?: (onnx.ISparseTensorProto|null);
+
+ /** AttributeProto tp. */
+ public tp?: (onnx.ITypeProto|null);
+
+ /** AttributeProto floats. */
+ public floats: number[];
+
+ /** AttributeProto ints. */
+ public ints: (number|Long)[];
+
+ /** AttributeProto strings. */
+ public strings: Uint8Array[];
+
+ /** AttributeProto tensors. */
+ public tensors: onnx.ITensorProto[];
+
+ /** AttributeProto graphs. */
+ public graphs: onnx.IGraphProto[];
+
+ /** AttributeProto sparseTensors. */
+ public sparseTensors: onnx.ISparseTensorProto[];
+
+ /** AttributeProto typeProtos. */
+ public typeProtos: onnx.ITypeProto[];
+
+ /**
+ * Creates a new AttributeProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns AttributeProto instance
+ */
+ public static create(properties?: onnx.IAttributeProto): onnx.AttributeProto;
+
+ /**
+ * Encodes the specified AttributeProto message. Does not implicitly {@link onnx.AttributeProto.verify|verify}
+ * messages.
+ * @param message AttributeProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.IAttributeProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified AttributeProto message, length delimited. Does not implicitly {@link
+ * onnx.AttributeProto.verify|verify} messages.
+ * @param message AttributeProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.IAttributeProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes an AttributeProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns AttributeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.AttributeProto;
+
+ /**
+ * Decodes an AttributeProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns AttributeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.AttributeProto;
+
+ /**
+ * Verifies an AttributeProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates an AttributeProto message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns AttributeProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.AttributeProto;
+
+ /**
+ * Creates a plain object from an AttributeProto message. Also converts values to other types if specified.
+ * @param message AttributeProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.AttributeProto, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this AttributeProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for AttributeProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ namespace AttributeProto {
+
+ /** AttributeType enum. */
+ enum AttributeType {
+ UNDEFINED = 0,
+ FLOAT = 1,
+ INT = 2,
+ STRING = 3,
+ TENSOR = 4,
+ GRAPH = 5,
+ SPARSE_TENSOR = 11,
+ TYPE_PROTO = 13,
+ FLOATS = 6,
+ INTS = 7,
+ STRINGS = 8,
+ TENSORS = 9,
+ GRAPHS = 10,
+ SPARSE_TENSORS = 12,
+ TYPE_PROTOS = 14
+ }
+ }
+
+ /** Properties of a ValueInfoProto. */
+ interface IValueInfoProto {
+ /** ValueInfoProto name */
+ name?: (string|null);
+
+ /** ValueInfoProto type */
+ type?: (onnx.ITypeProto|null);
+
+ /** ValueInfoProto docString */
+ docString?: (string|null);
+ }
+
+ /** Represents a ValueInfoProto. */
+ class ValueInfoProto implements IValueInfoProto {
+ /**
+ * Constructs a new ValueInfoProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.IValueInfoProto);
+
+ /** ValueInfoProto name. */
+ public name: string;
+
+ /** ValueInfoProto type. */
+ public type?: (onnx.ITypeProto|null);
+
+ /** ValueInfoProto docString. */
+ public docString: string;
+
+ /**
+ * Creates a new ValueInfoProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns ValueInfoProto instance
+ */
+ public static create(properties?: onnx.IValueInfoProto): onnx.ValueInfoProto;
+
+ /**
+ * Encodes the specified ValueInfoProto message. Does not implicitly {@link onnx.ValueInfoProto.verify|verify}
+ * messages.
+ * @param message ValueInfoProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.IValueInfoProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified ValueInfoProto message, length delimited. Does not implicitly {@link
+ * onnx.ValueInfoProto.verify|verify} messages.
+ * @param message ValueInfoProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.IValueInfoProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a ValueInfoProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns ValueInfoProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.ValueInfoProto;
+
+ /**
+ * Decodes a ValueInfoProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns ValueInfoProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.ValueInfoProto;
+
+ /**
+ * Verifies a ValueInfoProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a ValueInfoProto message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns ValueInfoProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.ValueInfoProto;
+
+ /**
+ * Creates a plain object from a ValueInfoProto message. Also converts values to other types if specified.
+ * @param message ValueInfoProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.ValueInfoProto, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this ValueInfoProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for ValueInfoProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of a NodeProto. */
+ interface INodeProto {
+ /** NodeProto input */
+ input?: (string[]|null);
+
+ /** NodeProto output */
+ output?: (string[]|null);
+
+ /** NodeProto name */
+ name?: (string|null);
+
+ /** NodeProto opType */
+ opType?: (string|null);
+
+ /** NodeProto domain */
+ domain?: (string|null);
+
+ /** NodeProto attribute */
+ attribute?: (onnx.IAttributeProto[]|null);
+
+ /** NodeProto docString */
+ docString?: (string|null);
+ }
+
+ /** Represents a NodeProto. */
+ class NodeProto implements INodeProto {
+ /**
+ * Constructs a new NodeProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.INodeProto);
+
+ /** NodeProto input. */
+ public input: string[];
+
+ /** NodeProto output. */
+ public output: string[];
+
+ /** NodeProto name. */
+ public name: string;
+
+ /** NodeProto opType. */
+ public opType: string;
+
+ /** NodeProto domain. */
+ public domain: string;
+
+ /** NodeProto attribute. */
+ public attribute: onnx.IAttributeProto[];
+
+ /** NodeProto docString. */
+ public docString: string;
+
+ /**
+ * Creates a new NodeProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns NodeProto instance
+ */
+ public static create(properties?: onnx.INodeProto): onnx.NodeProto;
+
+ /**
+ * Encodes the specified NodeProto message. Does not implicitly {@link onnx.NodeProto.verify|verify} messages.
+ * @param message NodeProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.INodeProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified NodeProto message, length delimited. Does not implicitly {@link
+ * onnx.NodeProto.verify|verify} messages.
+ * @param message NodeProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.INodeProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a NodeProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns NodeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.NodeProto;
+
+ /**
+ * Decodes a NodeProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns NodeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.NodeProto;
+
+ /**
+ * Verifies a NodeProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a NodeProto message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns NodeProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.NodeProto;
+
+ /**
+ * Creates a plain object from a NodeProto message. Also converts values to other types if specified.
+ * @param message NodeProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.NodeProto, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this NodeProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for NodeProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of a TrainingInfoProto. */
+ interface ITrainingInfoProto {
+ /** TrainingInfoProto initialization */
+ initialization?: (onnx.IGraphProto|null);
+
+ /** TrainingInfoProto algorithm */
+ algorithm?: (onnx.IGraphProto|null);
+
+ /** TrainingInfoProto initializationBinding */
+ initializationBinding?: (onnx.IStringStringEntryProto[]|null);
+
+ /** TrainingInfoProto updateBinding */
+ updateBinding?: (onnx.IStringStringEntryProto[]|null);
+ }
+
+ /** Represents a TrainingInfoProto. */
+ class TrainingInfoProto implements ITrainingInfoProto {
+ /**
+ * Constructs a new TrainingInfoProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.ITrainingInfoProto);
+
+ /** TrainingInfoProto initialization. */
+ public initialization?: (onnx.IGraphProto|null);
+
+ /** TrainingInfoProto algorithm. */
+ public algorithm?: (onnx.IGraphProto|null);
+
+ /** TrainingInfoProto initializationBinding. */
+ public initializationBinding: onnx.IStringStringEntryProto[];
+
+ /** TrainingInfoProto updateBinding. */
+ public updateBinding: onnx.IStringStringEntryProto[];
+
+ /**
+ * Creates a new TrainingInfoProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns TrainingInfoProto instance
+ */
+ public static create(properties?: onnx.ITrainingInfoProto): onnx.TrainingInfoProto;
+
+ /**
+ * Encodes the specified TrainingInfoProto message. Does not implicitly {@link onnx.TrainingInfoProto.verify|verify}
+ * messages.
+ * @param message TrainingInfoProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.ITrainingInfoProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified TrainingInfoProto message, length delimited. Does not implicitly {@link
+ * onnx.TrainingInfoProto.verify|verify} messages.
+ * @param message TrainingInfoProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.ITrainingInfoProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a TrainingInfoProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns TrainingInfoProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TrainingInfoProto;
+
+ /**
+ * Decodes a TrainingInfoProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns TrainingInfoProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TrainingInfoProto;
+
+ /**
+ * Verifies a TrainingInfoProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a TrainingInfoProto message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns TrainingInfoProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TrainingInfoProto;
+
+ /**
+ * Creates a plain object from a TrainingInfoProto message. Also converts values to other types if specified.
+ * @param message TrainingInfoProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TrainingInfoProto, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this TrainingInfoProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for TrainingInfoProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of a ModelProto. */
+ interface IModelProto {
+ /** ModelProto irVersion */
+ irVersion?: (number|Long|null);
+
+ /** ModelProto opsetImport */
+ opsetImport?: (onnx.IOperatorSetIdProto[]|null);
+
+ /** ModelProto producerName */
+ producerName?: (string|null);
+
+ /** ModelProto producerVersion */
+ producerVersion?: (string|null);
+
+ /** ModelProto domain */
+ domain?: (string|null);
+
+ /** ModelProto modelVersion */
+ modelVersion?: (number|Long|null);
+
+ /** ModelProto docString */
+ docString?: (string|null);
+
+ /** ModelProto graph */
+ graph?: (onnx.IGraphProto|null);
+
+ /** ModelProto metadataProps */
+ metadataProps?: (onnx.IStringStringEntryProto[]|null);
+
+ /** ModelProto trainingInfo */
+ trainingInfo?: (onnx.ITrainingInfoProto[]|null);
+
+ /** ModelProto functions */
+ functions?: (onnx.IFunctionProto[]|null);
+ }
+
+ /** Represents a ModelProto. */
+ class ModelProto implements IModelProto {
+ /**
+ * Constructs a new ModelProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.IModelProto);
+
+ /** ModelProto irVersion. */
+ public irVersion: (number|Long);
+
+ /** ModelProto opsetImport. */
+ public opsetImport: onnx.IOperatorSetIdProto[];
+
+ /** ModelProto producerName. */
+ public producerName: string;
+
+ /** ModelProto producerVersion. */
+ public producerVersion: string;
+
+ /** ModelProto domain. */
+ public domain: string;
+
+ /** ModelProto modelVersion. */
+ public modelVersion: (number|Long);
+
+ /** ModelProto docString. */
+ public docString: string;
+
+ /** ModelProto graph. */
+ public graph?: (onnx.IGraphProto|null);
+
+ /** ModelProto metadataProps. */
+ public metadataProps: onnx.IStringStringEntryProto[];
+
+ /** ModelProto trainingInfo. */
+ public trainingInfo: onnx.ITrainingInfoProto[];
+
+ /** ModelProto functions. */
+ public functions: onnx.IFunctionProto[];
+
+ /**
+ * Creates a new ModelProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns ModelProto instance
+ */
+ public static create(properties?: onnx.IModelProto): onnx.ModelProto;
+
+ /**
+ * Encodes the specified ModelProto message. Does not implicitly {@link onnx.ModelProto.verify|verify} messages.
+ * @param message ModelProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.IModelProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified ModelProto message, length delimited. Does not implicitly {@link
+ * onnx.ModelProto.verify|verify} messages.
+ * @param message ModelProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.IModelProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a ModelProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns ModelProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.ModelProto;
+
+ /**
+ * Decodes a ModelProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns ModelProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.ModelProto;
+
+ /**
+ * Verifies a ModelProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a ModelProto message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns ModelProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.ModelProto;
+
+ /**
+ * Creates a plain object from a ModelProto message. Also converts values to other types if specified.
+ * @param message ModelProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.ModelProto, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this ModelProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for ModelProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of a StringStringEntryProto. */
+ interface IStringStringEntryProto {
+ /** StringStringEntryProto key */
+ key?: (string|null);
+
+ /** StringStringEntryProto value */
+ value?: (string|null);
+ }
+
+ /** Represents a StringStringEntryProto. */
+ class StringStringEntryProto implements IStringStringEntryProto {
+ /**
+ * Constructs a new StringStringEntryProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.IStringStringEntryProto);
+
+ /** StringStringEntryProto key. */
+ public key: string;
+
+ /** StringStringEntryProto value. */
+ public value: string;
+
+ /**
+ * Creates a new StringStringEntryProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns StringStringEntryProto instance
+ */
+ public static create(properties?: onnx.IStringStringEntryProto): onnx.StringStringEntryProto;
+
+ /**
+ * Encodes the specified StringStringEntryProto message. Does not implicitly {@link
+ * onnx.StringStringEntryProto.verify|verify} messages.
+ * @param message StringStringEntryProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.IStringStringEntryProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified StringStringEntryProto message, length delimited. Does not implicitly {@link
+ * onnx.StringStringEntryProto.verify|verify} messages.
+ * @param message StringStringEntryProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.IStringStringEntryProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a StringStringEntryProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns StringStringEntryProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.StringStringEntryProto;
+
+ /**
+ * Decodes a StringStringEntryProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns StringStringEntryProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.StringStringEntryProto;
+
+ /**
+ * Verifies a StringStringEntryProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a StringStringEntryProto message from a plain object. Also converts values to their respective internal
+ * types.
+ * @param object Plain object
+ * @returns StringStringEntryProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.StringStringEntryProto;
+
+ /**
+ * Creates a plain object from a StringStringEntryProto message. Also converts values to other types if specified.
+ * @param message StringStringEntryProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.StringStringEntryProto, options?: $protobuf.IConversionOptions):
+ {[k: string]: any};
+
+ /**
+ * Converts this StringStringEntryProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for StringStringEntryProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of a TensorAnnotation. */
+ interface ITensorAnnotation {
+ /** TensorAnnotation tensorName */
+ tensorName?: (string|null);
+
+ /** TensorAnnotation quantParameterTensorNames */
+ quantParameterTensorNames?: (onnx.IStringStringEntryProto[]|null);
+ }
+
+ /** Represents a TensorAnnotation. */
+ class TensorAnnotation implements ITensorAnnotation {
+ /**
+ * Constructs a new TensorAnnotation.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.ITensorAnnotation);
+
+ /** TensorAnnotation tensorName. */
+ public tensorName: string;
+
+ /** TensorAnnotation quantParameterTensorNames. */
+ public quantParameterTensorNames: onnx.IStringStringEntryProto[];
+
+ /**
+ * Creates a new TensorAnnotation instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns TensorAnnotation instance
+ */
+ public static create(properties?: onnx.ITensorAnnotation): onnx.TensorAnnotation;
+
+ /**
+ * Encodes the specified TensorAnnotation message. Does not implicitly {@link onnx.TensorAnnotation.verify|verify}
+ * messages.
+ * @param message TensorAnnotation message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.ITensorAnnotation, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified TensorAnnotation message, length delimited. Does not implicitly {@link
+ * onnx.TensorAnnotation.verify|verify} messages.
+ * @param message TensorAnnotation message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.ITensorAnnotation, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a TensorAnnotation message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns TensorAnnotation
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TensorAnnotation;
+
+ /**
+ * Decodes a TensorAnnotation message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns TensorAnnotation
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TensorAnnotation;
+
+ /**
+ * Verifies a TensorAnnotation message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a TensorAnnotation message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns TensorAnnotation
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TensorAnnotation;
+
+ /**
+ * Creates a plain object from a TensorAnnotation message. Also converts values to other types if specified.
+ * @param message TensorAnnotation
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TensorAnnotation, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this TensorAnnotation to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for TensorAnnotation
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of a GraphProto. */
+ interface IGraphProto {
+ /** GraphProto node */
+ node?: (onnx.INodeProto[]|null);
+
+ /** GraphProto name */
+ name?: (string|null);
+
+ /** GraphProto initializer */
+ initializer?: (onnx.ITensorProto[]|null);
+
+ /** GraphProto sparseInitializer */
+ sparseInitializer?: (onnx.ISparseTensorProto[]|null);
+
+ /** GraphProto docString */
+ docString?: (string|null);
+
+ /** GraphProto input */
+ input?: (onnx.IValueInfoProto[]|null);
+
+ /** GraphProto output */
+ output?: (onnx.IValueInfoProto[]|null);
+
+ /** GraphProto valueInfo */
+ valueInfo?: (onnx.IValueInfoProto[]|null);
+
+ /** GraphProto quantizationAnnotation */
+ quantizationAnnotation?: (onnx.ITensorAnnotation[]|null);
+ }
+
+ /** Represents a GraphProto. */
+ class GraphProto implements IGraphProto {
+ /**
+ * Constructs a new GraphProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.IGraphProto);
+
+ /** GraphProto node. */
+ public node: onnx.INodeProto[];
+
+ /** GraphProto name. */
+ public name: string;
+
+ /** GraphProto initializer. */
+ public initializer: onnx.ITensorProto[];
+
+ /** GraphProto sparseInitializer. */
+ public sparseInitializer: onnx.ISparseTensorProto[];
+
+ /** GraphProto docString. */
+ public docString: string;
+
+ /** GraphProto input. */
+ public input: onnx.IValueInfoProto[];
+
+ /** GraphProto output. */
+ public output: onnx.IValueInfoProto[];
+
+ /** GraphProto valueInfo. */
+ public valueInfo: onnx.IValueInfoProto[];
+
+ /** GraphProto quantizationAnnotation. */
+ public quantizationAnnotation: onnx.ITensorAnnotation[];
+
+ /**
+ * Creates a new GraphProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns GraphProto instance
+ */
+ public static create(properties?: onnx.IGraphProto): onnx.GraphProto;
+
+ /**
+ * Encodes the specified GraphProto message. Does not implicitly {@link onnx.GraphProto.verify|verify} messages.
+ * @param message GraphProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.IGraphProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified GraphProto message, length delimited. Does not implicitly {@link
+ * onnx.GraphProto.verify|verify} messages.
+ * @param message GraphProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.IGraphProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a GraphProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns GraphProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.GraphProto;
+
+ /**
+ * Decodes a GraphProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns GraphProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.GraphProto;
+
+ /**
+ * Verifies a GraphProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a GraphProto message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns GraphProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.GraphProto;
+
+ /**
+ * Creates a plain object from a GraphProto message. Also converts values to other types if specified.
+ * @param message GraphProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.GraphProto, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this GraphProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for GraphProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of a TensorProto. */
+ interface ITensorProto {
+ /** TensorProto dims */
+ dims?: ((number | Long)[]|null);
+
+ /** TensorProto dataType */
+ dataType?: (number|null);
+
+ /** TensorProto segment */
+ segment?: (onnx.TensorProto.ISegment|null);
+
+ /** TensorProto floatData */
+ floatData?: (number[]|null);
+
+ /** TensorProto int32Data */
+ int32Data?: (number[]|null);
+
+ /** TensorProto stringData */
+ stringData?: (Uint8Array[]|null);
+
+ /** TensorProto int64Data */
+ int64Data?: ((number | Long)[]|null);
+
+ /** TensorProto name */
+ name?: (string|null);
+
+ /** TensorProto docString */
+ docString?: (string|null);
+
+ /** TensorProto rawData */
+ rawData?: (Uint8Array|null);
+
+ /** TensorProto externalData */
+ externalData?: (onnx.IStringStringEntryProto[]|null);
+
+ /** TensorProto dataLocation */
+ dataLocation?: (onnx.TensorProto.DataLocation|null);
+
+ /** TensorProto doubleData */
+ doubleData?: (number[]|null);
+
+ /** TensorProto uint64Data */
+ uint64Data?: ((number | Long)[]|null);
+ }
+
+ /** Represents a TensorProto. */
+ class TensorProto implements ITensorProto {
+ /**
+ * Constructs a new TensorProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.ITensorProto);
+
+ /** TensorProto dims. */
+ public dims: (number|Long)[];
+
+ /** TensorProto dataType. */
+ public dataType: number;
+
+ /** TensorProto segment. */
+ public segment?: (onnx.TensorProto.ISegment|null);
+
+ /** TensorProto floatData. */
+ public floatData: number[];
+
+ /** TensorProto int32Data. */
+ public int32Data: number[];
+
+ /** TensorProto stringData. */
+ public stringData: Uint8Array[];
+
+ /** TensorProto int64Data. */
+ public int64Data: (number|Long)[];
+
+ /** TensorProto name. */
+ public name: string;
+
+ /** TensorProto docString. */
+ public docString: string;
+
+ /** TensorProto rawData. */
+ public rawData: Uint8Array;
+
+ /** TensorProto externalData. */
+ public externalData: onnx.IStringStringEntryProto[];
+
+ /** TensorProto dataLocation. */
+ public dataLocation: onnx.TensorProto.DataLocation;
+
+ /** TensorProto doubleData. */
+ public doubleData: number[];
+
+ /** TensorProto uint64Data. */
+ public uint64Data: (number|Long)[];
+
+ /**
+ * Creates a new TensorProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns TensorProto instance
+ */
+ public static create(properties?: onnx.ITensorProto): onnx.TensorProto;
+
+ /**
+ * Encodes the specified TensorProto message. Does not implicitly {@link onnx.TensorProto.verify|verify} messages.
+ * @param message TensorProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.ITensorProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified TensorProto message, length delimited. Does not implicitly {@link
+ * onnx.TensorProto.verify|verify} messages.
+ * @param message TensorProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.ITensorProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a TensorProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns TensorProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TensorProto;
+
+ /**
+ * Decodes a TensorProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns TensorProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TensorProto;
+
+ /**
+ * Verifies a TensorProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a TensorProto message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns TensorProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TensorProto;
+
+ /**
+ * Creates a plain object from a TensorProto message. Also converts values to other types if specified.
+ * @param message TensorProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TensorProto, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this TensorProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for TensorProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ namespace TensorProto {
+
+ /** DataType enum. */
+ enum DataType {
+ UNDEFINED = 0,
+ FLOAT = 1,
+ UINT8 = 2,
+ INT8 = 3,
+ UINT16 = 4,
+ INT16 = 5,
+ INT32 = 6,
+ INT64 = 7,
+ STRING = 8,
+ BOOL = 9,
+ FLOAT16 = 10,
+ DOUBLE = 11,
+ UINT32 = 12,
+ UINT64 = 13,
+ COMPLEX64 = 14,
+ COMPLEX128 = 15,
+ BFLOAT16 = 16,
+ FLOAT8E4M3FN = 17,
+ FLOAT8E4M3FNUZ = 18,
+ FLOAT8E5M2 = 19,
+ FLOAT8E5M2FNUZ = 20
+ }
+
+ /** Properties of a Segment. */
+ interface ISegment {
+ /** Segment begin */
+ begin?: (number|Long|null);
+
+ /** Segment end */
+ end?: (number|Long|null);
+ }
+
+ /** Represents a Segment. */
+ class Segment implements ISegment {
+ /**
+ * Constructs a new Segment.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.TensorProto.ISegment);
+
+ /** Segment begin. */
+ public begin: (number|Long);
+
+ /** Segment end. */
+ public end: (number|Long);
+
+ /**
+ * Creates a new Segment instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns Segment instance
+ */
+ public static create(properties?: onnx.TensorProto.ISegment): onnx.TensorProto.Segment;
+
+ /**
+ * Encodes the specified Segment message. Does not implicitly {@link onnx.TensorProto.Segment.verify|verify}
+ * messages.
+ * @param message Segment message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.TensorProto.ISegment, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified Segment message, length delimited. Does not implicitly {@link
+ * onnx.TensorProto.Segment.verify|verify} messages.
+ * @param message Segment message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.TensorProto.ISegment, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a Segment message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns Segment
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TensorProto.Segment;
+
+ /**
+ * Decodes a Segment message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns Segment
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TensorProto.Segment;
+
+ /**
+ * Verifies a Segment message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a Segment message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns Segment
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TensorProto.Segment;
+
+ /**
+ * Creates a plain object from a Segment message. Also converts values to other types if specified.
+ * @param message Segment
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TensorProto.Segment, options?: $protobuf.IConversionOptions):
+ {[k: string]: any};
+
+ /**
+ * Converts this Segment to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for Segment
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** DataLocation enum. */
+ enum DataLocation { DEFAULT = 0, EXTERNAL = 1 }
+ }
+
+ /** Properties of a SparseTensorProto. */
+ interface ISparseTensorProto {
+ /** SparseTensorProto values */
+ values?: (onnx.ITensorProto|null);
+
+ /** SparseTensorProto indices */
+ indices?: (onnx.ITensorProto|null);
+
+ /** SparseTensorProto dims */
+ dims?: ((number | Long)[]|null);
+ }
+
+ /** Represents a SparseTensorProto. */
+ class SparseTensorProto implements ISparseTensorProto {
+ /**
+ * Constructs a new SparseTensorProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.ISparseTensorProto);
+
+ /** SparseTensorProto values. */
+ public values?: (onnx.ITensorProto|null);
+
+ /** SparseTensorProto indices. */
+ public indices?: (onnx.ITensorProto|null);
+
+ /** SparseTensorProto dims. */
+ public dims: (number|Long)[];
+
+ /**
+ * Creates a new SparseTensorProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns SparseTensorProto instance
+ */
+ public static create(properties?: onnx.ISparseTensorProto): onnx.SparseTensorProto;
+
+ /**
+ * Encodes the specified SparseTensorProto message. Does not implicitly {@link onnx.SparseTensorProto.verify|verify}
+ * messages.
+ * @param message SparseTensorProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.ISparseTensorProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified SparseTensorProto message, length delimited. Does not implicitly {@link
+ * onnx.SparseTensorProto.verify|verify} messages.
+ * @param message SparseTensorProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.ISparseTensorProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a SparseTensorProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns SparseTensorProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.SparseTensorProto;
+
+ /**
+ * Decodes a SparseTensorProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns SparseTensorProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.SparseTensorProto;
+
+ /**
+ * Verifies a SparseTensorProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a SparseTensorProto message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns SparseTensorProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.SparseTensorProto;
+
+ /**
+ * Creates a plain object from a SparseTensorProto message. Also converts values to other types if specified.
+ * @param message SparseTensorProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.SparseTensorProto, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this SparseTensorProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for SparseTensorProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of a TensorShapeProto. */
+ interface ITensorShapeProto {
+ /** TensorShapeProto dim */
+ dim?: (onnx.TensorShapeProto.IDimension[]|null);
+ }
+
+ /** Represents a TensorShapeProto. */
+ class TensorShapeProto implements ITensorShapeProto {
+ /**
+ * Constructs a new TensorShapeProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.ITensorShapeProto);
+
+ /** TensorShapeProto dim. */
+ public dim: onnx.TensorShapeProto.IDimension[];
+
+ /**
+ * Creates a new TensorShapeProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns TensorShapeProto instance
+ */
+ public static create(properties?: onnx.ITensorShapeProto): onnx.TensorShapeProto;
+
+ /**
+ * Encodes the specified TensorShapeProto message. Does not implicitly {@link onnx.TensorShapeProto.verify|verify}
+ * messages.
+ * @param message TensorShapeProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.ITensorShapeProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified TensorShapeProto message, length delimited. Does not implicitly {@link
+ * onnx.TensorShapeProto.verify|verify} messages.
+ * @param message TensorShapeProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.ITensorShapeProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a TensorShapeProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns TensorShapeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TensorShapeProto;
+
+ /**
+ * Decodes a TensorShapeProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns TensorShapeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TensorShapeProto;
+
+ /**
+ * Verifies a TensorShapeProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a TensorShapeProto message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns TensorShapeProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TensorShapeProto;
+
+ /**
+ * Creates a plain object from a TensorShapeProto message. Also converts values to other types if specified.
+ * @param message TensorShapeProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TensorShapeProto, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this TensorShapeProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for TensorShapeProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ namespace TensorShapeProto {
+
+ /** Properties of a Dimension. */
+ interface IDimension {
+ /** Dimension dimValue */
+ dimValue?: (number|Long|null);
+
+ /** Dimension dimParam */
+ dimParam?: (string|null);
+
+ /** Dimension denotation */
+ denotation?: (string|null);
+ }
+
+ /** Represents a Dimension. */
+ class Dimension implements IDimension {
+ /**
+ * Constructs a new Dimension.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.TensorShapeProto.IDimension);
+
+ /** Dimension dimValue. */
+ public dimValue?: (number|Long|null);
+
+ /** Dimension dimParam. */
+ public dimParam?: (string|null);
+
+ /** Dimension denotation. */
+ public denotation: string;
+
+ /** Dimension value. */
+ public value?: ('dimValue'|'dimParam');
+
+ /**
+ * Creates a new Dimension instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns Dimension instance
+ */
+ public static create(properties?: onnx.TensorShapeProto.IDimension): onnx.TensorShapeProto.Dimension;
+
+ /**
+ * Encodes the specified Dimension message. Does not implicitly {@link
+ * onnx.TensorShapeProto.Dimension.verify|verify} messages.
+ * @param message Dimension message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.TensorShapeProto.IDimension, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified Dimension message, length delimited. Does not implicitly {@link
+ * onnx.TensorShapeProto.Dimension.verify|verify} messages.
+ * @param message Dimension message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.TensorShapeProto.IDimension, writer?: $protobuf.Writer):
+ $protobuf.Writer;
+
+ /**
+ * Decodes a Dimension message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns Dimension
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TensorShapeProto.Dimension;
+
+ /**
+ * Decodes a Dimension message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns Dimension
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TensorShapeProto.Dimension;
+
+ /**
+ * Verifies a Dimension message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a Dimension message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns Dimension
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TensorShapeProto.Dimension;
+
+ /**
+ * Creates a plain object from a Dimension message. Also converts values to other types if specified.
+ * @param message Dimension
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TensorShapeProto.Dimension, options?: $protobuf.IConversionOptions):
+ {[k: string]: any};
+
+ /**
+ * Converts this Dimension to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for Dimension
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+ }
+
+ /** Properties of a TypeProto. */
+ interface ITypeProto {
+ /** TypeProto tensorType */
+ tensorType?: (onnx.TypeProto.ITensor|null);
+
+ /** TypeProto sequenceType */
+ sequenceType?: (onnx.TypeProto.ISequence|null);
+
+ /** TypeProto mapType */
+ mapType?: (onnx.TypeProto.IMap|null);
+
+ /** TypeProto optionalType */
+ optionalType?: (onnx.TypeProto.IOptional|null);
+
+ /** TypeProto sparseTensorType */
+ sparseTensorType?: (onnx.TypeProto.ISparseTensor|null);
+
+ /** TypeProto denotation */
+ denotation?: (string|null);
+ }
+
+ /** Represents a TypeProto. */
+ class TypeProto implements ITypeProto {
+ /**
+ * Constructs a new TypeProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.ITypeProto);
+
+ /** TypeProto tensorType. */
+ public tensorType?: (onnx.TypeProto.ITensor|null);
+
+ /** TypeProto sequenceType. */
+ public sequenceType?: (onnx.TypeProto.ISequence|null);
+
+ /** TypeProto mapType. */
+ public mapType?: (onnx.TypeProto.IMap|null);
+
+ /** TypeProto optionalType. */
+ public optionalType?: (onnx.TypeProto.IOptional|null);
+
+ /** TypeProto sparseTensorType. */
+ public sparseTensorType?: (onnx.TypeProto.ISparseTensor|null);
+
+ /** TypeProto denotation. */
+ public denotation: string;
+
+ /** TypeProto value. */
+ public value?: ('tensorType'|'sequenceType'|'mapType'|'optionalType'|'sparseTensorType');
+
+ /**
+ * Creates a new TypeProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns TypeProto instance
+ */
+ public static create(properties?: onnx.ITypeProto): onnx.TypeProto;
+
+ /**
+ * Encodes the specified TypeProto message. Does not implicitly {@link onnx.TypeProto.verify|verify} messages.
+ * @param message TypeProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.ITypeProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified TypeProto message, length delimited. Does not implicitly {@link
+ * onnx.TypeProto.verify|verify} messages.
+ * @param message TypeProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.ITypeProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a TypeProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns TypeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TypeProto;
+
+ /**
+ * Decodes a TypeProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns TypeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TypeProto;
+
+ /**
+ * Verifies a TypeProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a TypeProto message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns TypeProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TypeProto;
+
+ /**
+ * Creates a plain object from a TypeProto message. Also converts values to other types if specified.
+ * @param message TypeProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TypeProto, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this TypeProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for TypeProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ namespace TypeProto {
+
+ /** Properties of a Tensor. */
+ interface ITensor {
+ /** Tensor elemType */
+ elemType?: (number|null);
+
+ /** Tensor shape */
+ shape?: (onnx.ITensorShapeProto|null);
+ }
+
+ /** Represents a Tensor. */
+ class Tensor implements ITensor {
+ /**
+ * Constructs a new Tensor.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.TypeProto.ITensor);
+
+ /** Tensor elemType. */
+ public elemType: number;
+
+ /** Tensor shape. */
+ public shape?: (onnx.ITensorShapeProto|null);
+
+ /**
+ * Creates a new Tensor instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns Tensor instance
+ */
+ public static create(properties?: onnx.TypeProto.ITensor): onnx.TypeProto.Tensor;
+
+ /**
+ * Encodes the specified Tensor message. Does not implicitly {@link onnx.TypeProto.Tensor.verify|verify} messages.
+ * @param message Tensor message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.TypeProto.ITensor, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified Tensor message, length delimited. Does not implicitly {@link
+ * onnx.TypeProto.Tensor.verify|verify} messages.
+ * @param message Tensor message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.TypeProto.ITensor, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a Tensor message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns Tensor
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TypeProto.Tensor;
+
+ /**
+ * Decodes a Tensor message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns Tensor
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TypeProto.Tensor;
+
+ /**
+ * Verifies a Tensor message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a Tensor message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns Tensor
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TypeProto.Tensor;
+
+ /**
+ * Creates a plain object from a Tensor message. Also converts values to other types if specified.
+ * @param message Tensor
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TypeProto.Tensor, options?: $protobuf.IConversionOptions):
+ {[k: string]: any};
+
+ /**
+ * Converts this Tensor to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for Tensor
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of a Sequence. */
+ interface ISequence {
+ /** Sequence elemType */
+ elemType?: (onnx.ITypeProto|null);
+ }
+
+ /** Represents a Sequence. */
+ class Sequence implements ISequence {
+ /**
+ * Constructs a new Sequence.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.TypeProto.ISequence);
+
+ /** Sequence elemType. */
+ public elemType?: (onnx.ITypeProto|null);
+
+ /**
+ * Creates a new Sequence instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns Sequence instance
+ */
+ public static create(properties?: onnx.TypeProto.ISequence): onnx.TypeProto.Sequence;
+
+ /**
+ * Encodes the specified Sequence message. Does not implicitly {@link onnx.TypeProto.Sequence.verify|verify}
+ * messages.
+ * @param message Sequence message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.TypeProto.ISequence, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified Sequence message, length delimited. Does not implicitly {@link
+ * onnx.TypeProto.Sequence.verify|verify} messages.
+ * @param message Sequence message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.TypeProto.ISequence, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a Sequence message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns Sequence
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TypeProto.Sequence;
+
+ /**
+ * Decodes a Sequence message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns Sequence
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TypeProto.Sequence;
+
+ /**
+ * Verifies a Sequence message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a Sequence message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns Sequence
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TypeProto.Sequence;
+
+ /**
+ * Creates a plain object from a Sequence message. Also converts values to other types if specified.
+ * @param message Sequence
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TypeProto.Sequence, options?: $protobuf.IConversionOptions):
+ {[k: string]: any};
+
+ /**
+ * Converts this Sequence to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for Sequence
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of a Map. */
+ interface IMap {
+ /** Map keyType */
+ keyType?: (number|null);
+
+ /** Map valueType */
+ valueType?: (onnx.ITypeProto|null);
+ }
+
+ /** Represents a Map. */
+ class Map implements IMap {
+ /**
+ * Constructs a new Map.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.TypeProto.IMap);
+
+ /** Map keyType. */
+ public keyType: number;
+
+ /** Map valueType. */
+ public valueType?: (onnx.ITypeProto|null);
+
+ /**
+ * Creates a new Map instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns Map instance
+ */
+ public static create(properties?: onnx.TypeProto.IMap): onnx.TypeProto.Map;
+
+ /**
+ * Encodes the specified Map message. Does not implicitly {@link onnx.TypeProto.Map.verify|verify} messages.
+ * @param message Map message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.TypeProto.IMap, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified Map message, length delimited. Does not implicitly {@link
+ * onnx.TypeProto.Map.verify|verify} messages.
+ * @param message Map message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.TypeProto.IMap, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a Map message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns Map
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TypeProto.Map;
+
+ /**
+ * Decodes a Map message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns Map
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TypeProto.Map;
+
+ /**
+ * Verifies a Map message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a Map message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns Map
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TypeProto.Map;
+
+ /**
+ * Creates a plain object from a Map message. Also converts values to other types if specified.
+ * @param message Map
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TypeProto.Map, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this Map to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for Map
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of an Optional. */
+ interface IOptional {
+ /** Optional elemType */
+ elemType?: (onnx.ITypeProto|null);
+ }
+
+ /** Represents an Optional. */
+ class Optional implements IOptional {
+ /**
+ * Constructs a new Optional.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.TypeProto.IOptional);
+
+ /** Optional elemType. */
+ public elemType?: (onnx.ITypeProto|null);
+
+ /**
+ * Creates a new Optional instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns Optional instance
+ */
+ public static create(properties?: onnx.TypeProto.IOptional): onnx.TypeProto.Optional;
+
+ /**
+ * Encodes the specified Optional message. Does not implicitly {@link onnx.TypeProto.Optional.verify|verify}
+ * messages.
+ * @param message Optional message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.TypeProto.IOptional, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified Optional message, length delimited. Does not implicitly {@link
+ * onnx.TypeProto.Optional.verify|verify} messages.
+ * @param message Optional message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.TypeProto.IOptional, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes an Optional message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns Optional
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TypeProto.Optional;
+
+ /**
+ * Decodes an Optional message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns Optional
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TypeProto.Optional;
+
+ /**
+ * Verifies an Optional message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates an Optional message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns Optional
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TypeProto.Optional;
+
+ /**
+ * Creates a plain object from an Optional message. Also converts values to other types if specified.
+ * @param message Optional
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TypeProto.Optional, options?: $protobuf.IConversionOptions):
+ {[k: string]: any};
+
+ /**
+ * Converts this Optional to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for Optional
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** Properties of a SparseTensor. */
+ interface ISparseTensor {
+ /** SparseTensor elemType */
+ elemType?: (number|null);
+
+ /** SparseTensor shape */
+ shape?: (onnx.ITensorShapeProto|null);
+ }
+
+ /** Represents a SparseTensor. */
+ class SparseTensor implements ISparseTensor {
+ /**
+ * Constructs a new SparseTensor.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.TypeProto.ISparseTensor);
+
+ /** SparseTensor elemType. */
+ public elemType: number;
+
+ /** SparseTensor shape. */
+ public shape?: (onnx.ITensorShapeProto|null);
+
+ /**
+ * Creates a new SparseTensor instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns SparseTensor instance
+ */
+ public static create(properties?: onnx.TypeProto.ISparseTensor): onnx.TypeProto.SparseTensor;
+
+ /**
+ * Encodes the specified SparseTensor message. Does not implicitly {@link
+ * onnx.TypeProto.SparseTensor.verify|verify} messages.
+ * @param message SparseTensor message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.TypeProto.ISparseTensor, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified SparseTensor message, length delimited. Does not implicitly {@link
+ * onnx.TypeProto.SparseTensor.verify|verify} messages.
+ * @param message SparseTensor message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.TypeProto.ISparseTensor, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a SparseTensor message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns SparseTensor
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.TypeProto.SparseTensor;
+
+ /**
+ * Decodes a SparseTensor message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns SparseTensor
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.TypeProto.SparseTensor;
+
+ /**
+ * Verifies a SparseTensor message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a SparseTensor message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns SparseTensor
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.TypeProto.SparseTensor;
+
+ /**
+ * Creates a plain object from a SparseTensor message. Also converts values to other types if specified.
+ * @param message SparseTensor
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.TypeProto.SparseTensor, options?: $protobuf.IConversionOptions):
+ {[k: string]: any};
+
+ /**
+ * Converts this SparseTensor to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for SparseTensor
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+ }
+
+ /** Properties of an OperatorSetIdProto. */
+ interface IOperatorSetIdProto {
+ /** OperatorSetIdProto domain */
+ domain?: (string|null);
+
+ /** OperatorSetIdProto version */
+ version?: (number|Long|null);
+ }
+
+ /** Represents an OperatorSetIdProto. */
+ class OperatorSetIdProto implements IOperatorSetIdProto {
+ /**
+ * Constructs a new OperatorSetIdProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.IOperatorSetIdProto);
+
+ /** OperatorSetIdProto domain. */
+ public domain: string;
+
+ /** OperatorSetIdProto version. */
+ public version: (number|Long);
+
+ /**
+ * Creates a new OperatorSetIdProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns OperatorSetIdProto instance
+ */
+ public static create(properties?: onnx.IOperatorSetIdProto): onnx.OperatorSetIdProto;
+
+ /**
+ * Encodes the specified OperatorSetIdProto message. Does not implicitly {@link
+ * onnx.OperatorSetIdProto.verify|verify} messages.
+ * @param message OperatorSetIdProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.IOperatorSetIdProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified OperatorSetIdProto message, length delimited. Does not implicitly {@link
+ * onnx.OperatorSetIdProto.verify|verify} messages.
+ * @param message OperatorSetIdProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.IOperatorSetIdProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes an OperatorSetIdProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns OperatorSetIdProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.OperatorSetIdProto;
+
+ /**
+ * Decodes an OperatorSetIdProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns OperatorSetIdProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.OperatorSetIdProto;
+
+ /**
+ * Verifies an OperatorSetIdProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates an OperatorSetIdProto message from a plain object. Also converts values to their respective internal
+ * types.
+ * @param object Plain object
+ * @returns OperatorSetIdProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.OperatorSetIdProto;
+
+ /**
+ * Creates a plain object from an OperatorSetIdProto message. Also converts values to other types if specified.
+ * @param message OperatorSetIdProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.OperatorSetIdProto, options?: $protobuf.IConversionOptions):
+ {[k: string]: any};
+
+ /**
+ * Converts this OperatorSetIdProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for OperatorSetIdProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+
+ /** OperatorStatus enum. */
+ enum OperatorStatus { EXPERIMENTAL = 0, STABLE = 1 }
+
+ /** Properties of a FunctionProto. */
+ interface IFunctionProto {
+ /** FunctionProto name */
+ name?: (string|null);
+
+ /** FunctionProto input */
+ input?: (string[]|null);
+
+ /** FunctionProto output */
+ output?: (string[]|null);
+
+ /** FunctionProto attribute */
+ attribute?: (string[]|null);
+
+ /** FunctionProto attributeProto */
+ attributeProto?: (onnx.IAttributeProto[]|null);
+
+ /** FunctionProto node */
+ node?: (onnx.INodeProto[]|null);
+
+ /** FunctionProto docString */
+ docString?: (string|null);
+
+ /** FunctionProto opsetImport */
+ opsetImport?: (onnx.IOperatorSetIdProto[]|null);
+
+ /** FunctionProto domain */
+ domain?: (string|null);
+ }
+
+ /** Represents a FunctionProto. */
+ class FunctionProto implements IFunctionProto {
+ /**
+ * Constructs a new FunctionProto.
+ * @param [properties] Properties to set
+ */
+ constructor(properties?: onnx.IFunctionProto);
+
+ /** FunctionProto name. */
+ public name: string;
+
+ /** FunctionProto input. */
+ public input: string[];
+
+ /** FunctionProto output. */
+ public output: string[];
+
+ /** FunctionProto attribute. */
+ public attribute: string[];
+
+ /** FunctionProto attributeProto. */
+ public attributeProto: onnx.IAttributeProto[];
+
+ /** FunctionProto node. */
+ public node: onnx.INodeProto[];
+
+ /** FunctionProto docString. */
+ public docString: string;
+
+ /** FunctionProto opsetImport. */
+ public opsetImport: onnx.IOperatorSetIdProto[];
+
+ /** FunctionProto domain. */
+ public domain: string;
+
+ /**
+ * Creates a new FunctionProto instance using the specified properties.
+ * @param [properties] Properties to set
+ * @returns FunctionProto instance
+ */
+ public static create(properties?: onnx.IFunctionProto): onnx.FunctionProto;
+
+ /**
+ * Encodes the specified FunctionProto message. Does not implicitly {@link onnx.FunctionProto.verify|verify}
+ * messages.
+ * @param message FunctionProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encode(message: onnx.IFunctionProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Encodes the specified FunctionProto message, length delimited. Does not implicitly {@link
+ * onnx.FunctionProto.verify|verify} messages.
+ * @param message FunctionProto message or plain object to encode
+ * @param [writer] Writer to encode to
+ * @returns Writer
+ */
+ public static encodeDelimited(message: onnx.IFunctionProto, writer?: $protobuf.Writer): $protobuf.Writer;
+
+ /**
+ * Decodes a FunctionProto message from the specified reader or buffer.
+ * @param reader Reader or buffer to decode from
+ * @param [length] Message length if known beforehand
+ * @returns FunctionProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): onnx.FunctionProto;
+
+ /**
+ * Decodes a FunctionProto message from the specified reader or buffer, length delimited.
+ * @param reader Reader or buffer to decode from
+ * @returns FunctionProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): onnx.FunctionProto;
+
+ /**
+ * Verifies a FunctionProto message.
+ * @param message Plain object to verify
+ * @returns `null` if valid, otherwise the reason why it is not
+ */
+ public static verify(message: {[k: string]: any}): (string|null);
+
+ /**
+ * Creates a FunctionProto message from a plain object. Also converts values to their respective internal types.
+ * @param object Plain object
+ * @returns FunctionProto
+ */
+ public static fromObject(object: {[k: string]: any}): onnx.FunctionProto;
+
+ /**
+ * Creates a plain object from a FunctionProto message. Also converts values to other types if specified.
+ * @param message FunctionProto
+ * @param [options] Conversion options
+ * @returns Plain object
+ */
+ public static toObject(message: onnx.FunctionProto, options?: $protobuf.IConversionOptions): {[k: string]: any};
+
+ /**
+ * Converts this FunctionProto to JSON.
+ * @returns JSON object
+ */
+ public toJSON(): {[k: string]: any};
+
+ /**
+ * Gets the default type url for FunctionProto
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns The default type url
+ */
+ public static getTypeUrl(typeUrlPrefix?: string): string;
+ }
+}
diff --git a/js/node/test/ort-schema/protobuf/onnx.js b/js/node/test/ort-schema/protobuf/onnx.js
new file mode 100644
index 0000000000000..681855132d4e8
--- /dev/null
+++ b/js/node/test/ort-schema/protobuf/onnx.js
@@ -0,0 +1,7658 @@
+/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
+"use strict";
+
+var $protobuf = require("protobufjs/minimal");
+
+// Common aliases
+var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
+
+// Exported root namespace
+var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
+
+$root.onnx = (function() {
+
+ /**
+ * Namespace onnx.
+ * @exports onnx
+ * @namespace
+ */
+ var onnx = {};
+
+ /**
+ * Version enum.
+ * @name onnx.Version
+ * @enum {number}
+ * @property {number} _START_VERSION=0 _START_VERSION value
+ * @property {number} IR_VERSION_2017_10_10=1 IR_VERSION_2017_10_10 value
+ * @property {number} IR_VERSION_2017_10_30=2 IR_VERSION_2017_10_30 value
+ * @property {number} IR_VERSION_2017_11_3=3 IR_VERSION_2017_11_3 value
+ * @property {number} IR_VERSION_2019_1_22=4 IR_VERSION_2019_1_22 value
+ * @property {number} IR_VERSION_2019_3_18=5 IR_VERSION_2019_3_18 value
+ * @property {number} IR_VERSION_2019_9_19=6 IR_VERSION_2019_9_19 value
+ * @property {number} IR_VERSION_2020_5_8=7 IR_VERSION_2020_5_8 value
+ * @property {number} IR_VERSION_2021_7_30=8 IR_VERSION_2021_7_30 value
+ * @property {number} IR_VERSION=9 IR_VERSION value
+ */
+ onnx.Version = (function() {
+ var valuesById = {}, values = Object.create(valuesById);
+ values[valuesById[0] = "_START_VERSION"] = 0;
+ values[valuesById[1] = "IR_VERSION_2017_10_10"] = 1;
+ values[valuesById[2] = "IR_VERSION_2017_10_30"] = 2;
+ values[valuesById[3] = "IR_VERSION_2017_11_3"] = 3;
+ values[valuesById[4] = "IR_VERSION_2019_1_22"] = 4;
+ values[valuesById[5] = "IR_VERSION_2019_3_18"] = 5;
+ values[valuesById[6] = "IR_VERSION_2019_9_19"] = 6;
+ values[valuesById[7] = "IR_VERSION_2020_5_8"] = 7;
+ values[valuesById[8] = "IR_VERSION_2021_7_30"] = 8;
+ values[valuesById[9] = "IR_VERSION"] = 9;
+ return values;
+ })();
+
+ onnx.AttributeProto = (function() {
+
+ /**
+ * Properties of an AttributeProto.
+ * @memberof onnx
+ * @interface IAttributeProto
+ * @property {string|null} [name] AttributeProto name
+ * @property {string|null} [refAttrName] AttributeProto refAttrName
+ * @property {string|null} [docString] AttributeProto docString
+ * @property {onnx.AttributeProto.AttributeType|null} [type] AttributeProto type
+ * @property {number|null} [f] AttributeProto f
+ * @property {number|Long|null} [i] AttributeProto i
+ * @property {Uint8Array|null} [s] AttributeProto s
+ * @property {onnx.ITensorProto|null} [t] AttributeProto t
+ * @property {onnx.IGraphProto|null} [g] AttributeProto g
+ * @property {onnx.ISparseTensorProto|null} [sparseTensor] AttributeProto sparseTensor
+ * @property {onnx.ITypeProto|null} [tp] AttributeProto tp
+ * @property {Array.|null} [floats] AttributeProto floats
+ * @property {Array.|null} [ints] AttributeProto ints
+ * @property {Array.|null} [strings] AttributeProto strings
+ * @property {Array.|null} [tensors] AttributeProto tensors
+ * @property {Array.|null} [graphs] AttributeProto graphs
+ * @property {Array.|null} [sparseTensors] AttributeProto sparseTensors
+ * @property {Array.|null} [typeProtos] AttributeProto typeProtos
+ */
+
+ /**
+ * Constructs a new AttributeProto.
+ * @memberof onnx
+ * @classdesc Represents an AttributeProto.
+ * @implements IAttributeProto
+ * @constructor
+ * @param {onnx.IAttributeProto=} [properties] Properties to set
+ */
+ function AttributeProto(properties) {
+ this.floats = [];
+ this.ints = [];
+ this.strings = [];
+ this.tensors = [];
+ this.graphs = [];
+ this.sparseTensors = [];
+ this.typeProtos = [];
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * AttributeProto name.
+ * @member {string} name
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.name = "";
+
+ /**
+ * AttributeProto refAttrName.
+ * @member {string} refAttrName
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.refAttrName = "";
+
+ /**
+ * AttributeProto docString.
+ * @member {string} docString
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.docString = "";
+
+ /**
+ * AttributeProto type.
+ * @member {onnx.AttributeProto.AttributeType} type
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.type = 0;
+
+ /**
+ * AttributeProto f.
+ * @member {number} f
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.f = 0;
+
+ /**
+ * AttributeProto i.
+ * @member {number|Long} i
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.i = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
+
+ /**
+ * AttributeProto s.
+ * @member {Uint8Array} s
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.s = $util.newBuffer([]);
+
+ /**
+ * AttributeProto t.
+ * @member {onnx.ITensorProto|null|undefined} t
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.t = null;
+
+ /**
+ * AttributeProto g.
+ * @member {onnx.IGraphProto|null|undefined} g
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.g = null;
+
+ /**
+ * AttributeProto sparseTensor.
+ * @member {onnx.ISparseTensorProto|null|undefined} sparseTensor
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.sparseTensor = null;
+
+ /**
+ * AttributeProto tp.
+ * @member {onnx.ITypeProto|null|undefined} tp
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.tp = null;
+
+ /**
+ * AttributeProto floats.
+ * @member {Array.} floats
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.floats = $util.emptyArray;
+
+ /**
+ * AttributeProto ints.
+ * @member {Array.} ints
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.ints = $util.emptyArray;
+
+ /**
+ * AttributeProto strings.
+ * @member {Array.} strings
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.strings = $util.emptyArray;
+
+ /**
+ * AttributeProto tensors.
+ * @member {Array.} tensors
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.tensors = $util.emptyArray;
+
+ /**
+ * AttributeProto graphs.
+ * @member {Array.} graphs
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.graphs = $util.emptyArray;
+
+ /**
+ * AttributeProto sparseTensors.
+ * @member {Array.} sparseTensors
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.sparseTensors = $util.emptyArray;
+
+ /**
+ * AttributeProto typeProtos.
+ * @member {Array.} typeProtos
+ * @memberof onnx.AttributeProto
+ * @instance
+ */
+ AttributeProto.prototype.typeProtos = $util.emptyArray;
+
+ /**
+ * Creates a new AttributeProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.AttributeProto
+ * @static
+ * @param {onnx.IAttributeProto=} [properties] Properties to set
+ * @returns {onnx.AttributeProto} AttributeProto instance
+ */
+ AttributeProto.create = function create(properties) {
+ return new AttributeProto(properties);
+ };
+
+ /**
+ * Encodes the specified AttributeProto message. Does not implicitly {@link onnx.AttributeProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.AttributeProto
+ * @static
+ * @param {onnx.IAttributeProto} message AttributeProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ AttributeProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.name != null && Object.hasOwnProperty.call(message, "name"))
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
+ if (message.f != null && Object.hasOwnProperty.call(message, "f"))
+ writer.uint32(/* id 2, wireType 5 =*/21).float(message.f);
+ if (message.i != null && Object.hasOwnProperty.call(message, "i"))
+ writer.uint32(/* id 3, wireType 0 =*/24).int64(message.i);
+ if (message.s != null && Object.hasOwnProperty.call(message, "s"))
+ writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.s);
+ if (message.t != null && Object.hasOwnProperty.call(message, "t"))
+ $root.onnx.TensorProto.encode(message.t, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
+ if (message.g != null && Object.hasOwnProperty.call(message, "g"))
+ $root.onnx.GraphProto.encode(message.g, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim();
+ if (message.floats != null && message.floats.length) {
+ writer.uint32(/* id 7, wireType 2 =*/58).fork();
+ for (var i = 0; i < message.floats.length; ++i)
+ writer.float(message.floats[i]);
+ writer.ldelim();
+ }
+ if (message.ints != null && message.ints.length) {
+ writer.uint32(/* id 8, wireType 2 =*/66).fork();
+ for (var i = 0; i < message.ints.length; ++i)
+ writer.int64(message.ints[i]);
+ writer.ldelim();
+ }
+ if (message.strings != null && message.strings.length)
+ for (var i = 0; i < message.strings.length; ++i)
+ writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.strings[i]);
+ if (message.tensors != null && message.tensors.length)
+ for (var i = 0; i < message.tensors.length; ++i)
+ $root.onnx.TensorProto.encode(message.tensors[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim();
+ if (message.graphs != null && message.graphs.length)
+ for (var i = 0; i < message.graphs.length; ++i)
+ $root.onnx.GraphProto.encode(message.graphs[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim();
+ if (message.docString != null && Object.hasOwnProperty.call(message, "docString"))
+ writer.uint32(/* id 13, wireType 2 =*/106).string(message.docString);
+ if (message.tp != null && Object.hasOwnProperty.call(message, "tp"))
+ $root.onnx.TypeProto.encode(message.tp, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim();
+ if (message.typeProtos != null && message.typeProtos.length)
+ for (var i = 0; i < message.typeProtos.length; ++i)
+ $root.onnx.TypeProto.encode(message.typeProtos[i], writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim();
+ if (message.type != null && Object.hasOwnProperty.call(message, "type"))
+ writer.uint32(/* id 20, wireType 0 =*/160).int32(message.type);
+ if (message.refAttrName != null && Object.hasOwnProperty.call(message, "refAttrName"))
+ writer.uint32(/* id 21, wireType 2 =*/170).string(message.refAttrName);
+ if (message.sparseTensor != null && Object.hasOwnProperty.call(message, "sparseTensor"))
+ $root.onnx.SparseTensorProto.encode(message.sparseTensor, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim();
+ if (message.sparseTensors != null && message.sparseTensors.length)
+ for (var i = 0; i < message.sparseTensors.length; ++i)
+ $root.onnx.SparseTensorProto.encode(message.sparseTensors[i], writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified AttributeProto message, length delimited. Does not implicitly {@link onnx.AttributeProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.AttributeProto
+ * @static
+ * @param {onnx.IAttributeProto} message AttributeProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ AttributeProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes an AttributeProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.AttributeProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.AttributeProto} AttributeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ AttributeProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.AttributeProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.name = reader.string();
+ break;
+ }
+ case 21: {
+ message.refAttrName = reader.string();
+ break;
+ }
+ case 13: {
+ message.docString = reader.string();
+ break;
+ }
+ case 20: {
+ message.type = reader.int32();
+ break;
+ }
+ case 2: {
+ message.f = reader.float();
+ break;
+ }
+ case 3: {
+ message.i = reader.int64();
+ break;
+ }
+ case 4: {
+ message.s = reader.bytes();
+ break;
+ }
+ case 5: {
+ message.t = $root.onnx.TensorProto.decode(reader, reader.uint32());
+ break;
+ }
+ case 6: {
+ message.g = $root.onnx.GraphProto.decode(reader, reader.uint32());
+ break;
+ }
+ case 22: {
+ message.sparseTensor = $root.onnx.SparseTensorProto.decode(reader, reader.uint32());
+ break;
+ }
+ case 14: {
+ message.tp = $root.onnx.TypeProto.decode(reader, reader.uint32());
+ break;
+ }
+ case 7: {
+ if (!(message.floats && message.floats.length))
+ message.floats = [];
+ if ((tag & 7) === 2) {
+ var end2 = reader.uint32() + reader.pos;
+ while (reader.pos < end2)
+ message.floats.push(reader.float());
+ } else
+ message.floats.push(reader.float());
+ break;
+ }
+ case 8: {
+ if (!(message.ints && message.ints.length))
+ message.ints = [];
+ if ((tag & 7) === 2) {
+ var end2 = reader.uint32() + reader.pos;
+ while (reader.pos < end2)
+ message.ints.push(reader.int64());
+ } else
+ message.ints.push(reader.int64());
+ break;
+ }
+ case 9: {
+ if (!(message.strings && message.strings.length))
+ message.strings = [];
+ message.strings.push(reader.bytes());
+ break;
+ }
+ case 10: {
+ if (!(message.tensors && message.tensors.length))
+ message.tensors = [];
+ message.tensors.push($root.onnx.TensorProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 11: {
+ if (!(message.graphs && message.graphs.length))
+ message.graphs = [];
+ message.graphs.push($root.onnx.GraphProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 23: {
+ if (!(message.sparseTensors && message.sparseTensors.length))
+ message.sparseTensors = [];
+ message.sparseTensors.push($root.onnx.SparseTensorProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 15: {
+ if (!(message.typeProtos && message.typeProtos.length))
+ message.typeProtos = [];
+ message.typeProtos.push($root.onnx.TypeProto.decode(reader, reader.uint32()));
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes an AttributeProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.AttributeProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.AttributeProto} AttributeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ AttributeProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies an AttributeProto message.
+ * @function verify
+ * @memberof onnx.AttributeProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ AttributeProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.name != null && message.hasOwnProperty("name"))
+ if (!$util.isString(message.name))
+ return "name: string expected";
+ if (message.refAttrName != null && message.hasOwnProperty("refAttrName"))
+ if (!$util.isString(message.refAttrName))
+ return "refAttrName: string expected";
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ if (!$util.isString(message.docString))
+ return "docString: string expected";
+ if (message.type != null && message.hasOwnProperty("type"))
+ switch (message.type) {
+ default:
+ return "type: enum value expected";
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 11:
+ case 13:
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ case 12:
+ case 14:
+ break;
+ }
+ if (message.f != null && message.hasOwnProperty("f"))
+ if (typeof message.f !== "number")
+ return "f: number expected";
+ if (message.i != null && message.hasOwnProperty("i"))
+ if (!$util.isInteger(message.i) && !(message.i && $util.isInteger(message.i.low) && $util.isInteger(message.i.high)))
+ return "i: integer|Long expected";
+ if (message.s != null && message.hasOwnProperty("s"))
+ if (!(message.s && typeof message.s.length === "number" || $util.isString(message.s)))
+ return "s: buffer expected";
+ if (message.t != null && message.hasOwnProperty("t")) {
+ var error = $root.onnx.TensorProto.verify(message.t);
+ if (error)
+ return "t." + error;
+ }
+ if (message.g != null && message.hasOwnProperty("g")) {
+ var error = $root.onnx.GraphProto.verify(message.g);
+ if (error)
+ return "g." + error;
+ }
+ if (message.sparseTensor != null && message.hasOwnProperty("sparseTensor")) {
+ var error = $root.onnx.SparseTensorProto.verify(message.sparseTensor);
+ if (error)
+ return "sparseTensor." + error;
+ }
+ if (message.tp != null && message.hasOwnProperty("tp")) {
+ var error = $root.onnx.TypeProto.verify(message.tp);
+ if (error)
+ return "tp." + error;
+ }
+ if (message.floats != null && message.hasOwnProperty("floats")) {
+ if (!Array.isArray(message.floats))
+ return "floats: array expected";
+ for (var i = 0; i < message.floats.length; ++i)
+ if (typeof message.floats[i] !== "number")
+ return "floats: number[] expected";
+ }
+ if (message.ints != null && message.hasOwnProperty("ints")) {
+ if (!Array.isArray(message.ints))
+ return "ints: array expected";
+ for (var i = 0; i < message.ints.length; ++i)
+ if (!$util.isInteger(message.ints[i]) && !(message.ints[i] && $util.isInteger(message.ints[i].low) && $util.isInteger(message.ints[i].high)))
+ return "ints: integer|Long[] expected";
+ }
+ if (message.strings != null && message.hasOwnProperty("strings")) {
+ if (!Array.isArray(message.strings))
+ return "strings: array expected";
+ for (var i = 0; i < message.strings.length; ++i)
+ if (!(message.strings[i] && typeof message.strings[i].length === "number" || $util.isString(message.strings[i])))
+ return "strings: buffer[] expected";
+ }
+ if (message.tensors != null && message.hasOwnProperty("tensors")) {
+ if (!Array.isArray(message.tensors))
+ return "tensors: array expected";
+ for (var i = 0; i < message.tensors.length; ++i) {
+ var error = $root.onnx.TensorProto.verify(message.tensors[i]);
+ if (error)
+ return "tensors." + error;
+ }
+ }
+ if (message.graphs != null && message.hasOwnProperty("graphs")) {
+ if (!Array.isArray(message.graphs))
+ return "graphs: array expected";
+ for (var i = 0; i < message.graphs.length; ++i) {
+ var error = $root.onnx.GraphProto.verify(message.graphs[i]);
+ if (error)
+ return "graphs." + error;
+ }
+ }
+ if (message.sparseTensors != null && message.hasOwnProperty("sparseTensors")) {
+ if (!Array.isArray(message.sparseTensors))
+ return "sparseTensors: array expected";
+ for (var i = 0; i < message.sparseTensors.length; ++i) {
+ var error = $root.onnx.SparseTensorProto.verify(message.sparseTensors[i]);
+ if (error)
+ return "sparseTensors." + error;
+ }
+ }
+ if (message.typeProtos != null && message.hasOwnProperty("typeProtos")) {
+ if (!Array.isArray(message.typeProtos))
+ return "typeProtos: array expected";
+ for (var i = 0; i < message.typeProtos.length; ++i) {
+ var error = $root.onnx.TypeProto.verify(message.typeProtos[i]);
+ if (error)
+ return "typeProtos." + error;
+ }
+ }
+ return null;
+ };
+
+ /**
+ * Creates an AttributeProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.AttributeProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.AttributeProto} AttributeProto
+ */
+ AttributeProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.AttributeProto)
+ return object;
+ var message = new $root.onnx.AttributeProto();
+ if (object.name != null)
+ message.name = String(object.name);
+ if (object.refAttrName != null)
+ message.refAttrName = String(object.refAttrName);
+ if (object.docString != null)
+ message.docString = String(object.docString);
+ switch (object.type) {
+ default:
+ if (typeof object.type === "number") {
+ message.type = object.type;
+ break;
+ }
+ break;
+ case "UNDEFINED":
+ case 0:
+ message.type = 0;
+ break;
+ case "FLOAT":
+ case 1:
+ message.type = 1;
+ break;
+ case "INT":
+ case 2:
+ message.type = 2;
+ break;
+ case "STRING":
+ case 3:
+ message.type = 3;
+ break;
+ case "TENSOR":
+ case 4:
+ message.type = 4;
+ break;
+ case "GRAPH":
+ case 5:
+ message.type = 5;
+ break;
+ case "SPARSE_TENSOR":
+ case 11:
+ message.type = 11;
+ break;
+ case "TYPE_PROTO":
+ case 13:
+ message.type = 13;
+ break;
+ case "FLOATS":
+ case 6:
+ message.type = 6;
+ break;
+ case "INTS":
+ case 7:
+ message.type = 7;
+ break;
+ case "STRINGS":
+ case 8:
+ message.type = 8;
+ break;
+ case "TENSORS":
+ case 9:
+ message.type = 9;
+ break;
+ case "GRAPHS":
+ case 10:
+ message.type = 10;
+ break;
+ case "SPARSE_TENSORS":
+ case 12:
+ message.type = 12;
+ break;
+ case "TYPE_PROTOS":
+ case 14:
+ message.type = 14;
+ break;
+ }
+ if (object.f != null)
+ message.f = Number(object.f);
+ if (object.i != null)
+ if ($util.Long)
+ (message.i = $util.Long.fromValue(object.i)).unsigned = false;
+ else if (typeof object.i === "string")
+ message.i = parseInt(object.i, 10);
+ else if (typeof object.i === "number")
+ message.i = object.i;
+ else if (typeof object.i === "object")
+ message.i = new $util.LongBits(object.i.low >>> 0, object.i.high >>> 0).toNumber();
+ if (object.s != null)
+ if (typeof object.s === "string")
+ $util.base64.decode(object.s, message.s = $util.newBuffer($util.base64.length(object.s)), 0);
+ else if (object.s.length >= 0)
+ message.s = object.s;
+ if (object.t != null) {
+ if (typeof object.t !== "object")
+ throw TypeError(".onnx.AttributeProto.t: object expected");
+ message.t = $root.onnx.TensorProto.fromObject(object.t);
+ }
+ if (object.g != null) {
+ if (typeof object.g !== "object")
+ throw TypeError(".onnx.AttributeProto.g: object expected");
+ message.g = $root.onnx.GraphProto.fromObject(object.g);
+ }
+ if (object.sparseTensor != null) {
+ if (typeof object.sparseTensor !== "object")
+ throw TypeError(".onnx.AttributeProto.sparseTensor: object expected");
+ message.sparseTensor = $root.onnx.SparseTensorProto.fromObject(object.sparseTensor);
+ }
+ if (object.tp != null) {
+ if (typeof object.tp !== "object")
+ throw TypeError(".onnx.AttributeProto.tp: object expected");
+ message.tp = $root.onnx.TypeProto.fromObject(object.tp);
+ }
+ if (object.floats) {
+ if (!Array.isArray(object.floats))
+ throw TypeError(".onnx.AttributeProto.floats: array expected");
+ message.floats = [];
+ for (var i = 0; i < object.floats.length; ++i)
+ message.floats[i] = Number(object.floats[i]);
+ }
+ if (object.ints) {
+ if (!Array.isArray(object.ints))
+ throw TypeError(".onnx.AttributeProto.ints: array expected");
+ message.ints = [];
+ for (var i = 0; i < object.ints.length; ++i)
+ if ($util.Long)
+ (message.ints[i] = $util.Long.fromValue(object.ints[i])).unsigned = false;
+ else if (typeof object.ints[i] === "string")
+ message.ints[i] = parseInt(object.ints[i], 10);
+ else if (typeof object.ints[i] === "number")
+ message.ints[i] = object.ints[i];
+ else if (typeof object.ints[i] === "object")
+ message.ints[i] = new $util.LongBits(object.ints[i].low >>> 0, object.ints[i].high >>> 0).toNumber();
+ }
+ if (object.strings) {
+ if (!Array.isArray(object.strings))
+ throw TypeError(".onnx.AttributeProto.strings: array expected");
+ message.strings = [];
+ for (var i = 0; i < object.strings.length; ++i)
+ if (typeof object.strings[i] === "string")
+ $util.base64.decode(object.strings[i], message.strings[i] = $util.newBuffer($util.base64.length(object.strings[i])), 0);
+ else if (object.strings[i].length >= 0)
+ message.strings[i] = object.strings[i];
+ }
+ if (object.tensors) {
+ if (!Array.isArray(object.tensors))
+ throw TypeError(".onnx.AttributeProto.tensors: array expected");
+ message.tensors = [];
+ for (var i = 0; i < object.tensors.length; ++i) {
+ if (typeof object.tensors[i] !== "object")
+ throw TypeError(".onnx.AttributeProto.tensors: object expected");
+ message.tensors[i] = $root.onnx.TensorProto.fromObject(object.tensors[i]);
+ }
+ }
+ if (object.graphs) {
+ if (!Array.isArray(object.graphs))
+ throw TypeError(".onnx.AttributeProto.graphs: array expected");
+ message.graphs = [];
+ for (var i = 0; i < object.graphs.length; ++i) {
+ if (typeof object.graphs[i] !== "object")
+ throw TypeError(".onnx.AttributeProto.graphs: object expected");
+ message.graphs[i] = $root.onnx.GraphProto.fromObject(object.graphs[i]);
+ }
+ }
+ if (object.sparseTensors) {
+ if (!Array.isArray(object.sparseTensors))
+ throw TypeError(".onnx.AttributeProto.sparseTensors: array expected");
+ message.sparseTensors = [];
+ for (var i = 0; i < object.sparseTensors.length; ++i) {
+ if (typeof object.sparseTensors[i] !== "object")
+ throw TypeError(".onnx.AttributeProto.sparseTensors: object expected");
+ message.sparseTensors[i] = $root.onnx.SparseTensorProto.fromObject(object.sparseTensors[i]);
+ }
+ }
+ if (object.typeProtos) {
+ if (!Array.isArray(object.typeProtos))
+ throw TypeError(".onnx.AttributeProto.typeProtos: array expected");
+ message.typeProtos = [];
+ for (var i = 0; i < object.typeProtos.length; ++i) {
+ if (typeof object.typeProtos[i] !== "object")
+ throw TypeError(".onnx.AttributeProto.typeProtos: object expected");
+ message.typeProtos[i] = $root.onnx.TypeProto.fromObject(object.typeProtos[i]);
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from an AttributeProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.AttributeProto
+ * @static
+ * @param {onnx.AttributeProto} message AttributeProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ AttributeProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.arrays || options.defaults) {
+ object.floats = [];
+ object.ints = [];
+ object.strings = [];
+ object.tensors = [];
+ object.graphs = [];
+ object.typeProtos = [];
+ object.sparseTensors = [];
+ }
+ if (options.defaults) {
+ object.name = "";
+ object.f = 0;
+ if ($util.Long) {
+ var long = new $util.Long(0, 0, false);
+ object.i = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
+ } else
+ object.i = options.longs === String ? "0" : 0;
+ if (options.bytes === String)
+ object.s = "";
+ else {
+ object.s = [];
+ if (options.bytes !== Array)
+ object.s = $util.newBuffer(object.s);
+ }
+ object.t = null;
+ object.g = null;
+ object.docString = "";
+ object.tp = null;
+ object.type = options.enums === String ? "UNDEFINED" : 0;
+ object.refAttrName = "";
+ object.sparseTensor = null;
+ }
+ if (message.name != null && message.hasOwnProperty("name"))
+ object.name = message.name;
+ if (message.f != null && message.hasOwnProperty("f"))
+ object.f = options.json && !isFinite(message.f) ? String(message.f) : message.f;
+ if (message.i != null && message.hasOwnProperty("i"))
+ if (typeof message.i === "number")
+ object.i = options.longs === String ? String(message.i) : message.i;
+ else
+ object.i = options.longs === String ? $util.Long.prototype.toString.call(message.i) : options.longs === Number ? new $util.LongBits(message.i.low >>> 0, message.i.high >>> 0).toNumber() : message.i;
+ if (message.s != null && message.hasOwnProperty("s"))
+ object.s = options.bytes === String ? $util.base64.encode(message.s, 0, message.s.length) : options.bytes === Array ? Array.prototype.slice.call(message.s) : message.s;
+ if (message.t != null && message.hasOwnProperty("t"))
+ object.t = $root.onnx.TensorProto.toObject(message.t, options);
+ if (message.g != null && message.hasOwnProperty("g"))
+ object.g = $root.onnx.GraphProto.toObject(message.g, options);
+ if (message.floats && message.floats.length) {
+ object.floats = [];
+ for (var j = 0; j < message.floats.length; ++j)
+ object.floats[j] = options.json && !isFinite(message.floats[j]) ? String(message.floats[j]) : message.floats[j];
+ }
+ if (message.ints && message.ints.length) {
+ object.ints = [];
+ for (var j = 0; j < message.ints.length; ++j)
+ if (typeof message.ints[j] === "number")
+ object.ints[j] = options.longs === String ? String(message.ints[j]) : message.ints[j];
+ else
+ object.ints[j] = options.longs === String ? $util.Long.prototype.toString.call(message.ints[j]) : options.longs === Number ? new $util.LongBits(message.ints[j].low >>> 0, message.ints[j].high >>> 0).toNumber() : message.ints[j];
+ }
+ if (message.strings && message.strings.length) {
+ object.strings = [];
+ for (var j = 0; j < message.strings.length; ++j)
+ object.strings[j] = options.bytes === String ? $util.base64.encode(message.strings[j], 0, message.strings[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.strings[j]) : message.strings[j];
+ }
+ if (message.tensors && message.tensors.length) {
+ object.tensors = [];
+ for (var j = 0; j < message.tensors.length; ++j)
+ object.tensors[j] = $root.onnx.TensorProto.toObject(message.tensors[j], options);
+ }
+ if (message.graphs && message.graphs.length) {
+ object.graphs = [];
+ for (var j = 0; j < message.graphs.length; ++j)
+ object.graphs[j] = $root.onnx.GraphProto.toObject(message.graphs[j], options);
+ }
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ object.docString = message.docString;
+ if (message.tp != null && message.hasOwnProperty("tp"))
+ object.tp = $root.onnx.TypeProto.toObject(message.tp, options);
+ if (message.typeProtos && message.typeProtos.length) {
+ object.typeProtos = [];
+ for (var j = 0; j < message.typeProtos.length; ++j)
+ object.typeProtos[j] = $root.onnx.TypeProto.toObject(message.typeProtos[j], options);
+ }
+ if (message.type != null && message.hasOwnProperty("type"))
+ object.type = options.enums === String ? $root.onnx.AttributeProto.AttributeType[message.type] === undefined ? message.type : $root.onnx.AttributeProto.AttributeType[message.type] : message.type;
+ if (message.refAttrName != null && message.hasOwnProperty("refAttrName"))
+ object.refAttrName = message.refAttrName;
+ if (message.sparseTensor != null && message.hasOwnProperty("sparseTensor"))
+ object.sparseTensor = $root.onnx.SparseTensorProto.toObject(message.sparseTensor, options);
+ if (message.sparseTensors && message.sparseTensors.length) {
+ object.sparseTensors = [];
+ for (var j = 0; j < message.sparseTensors.length; ++j)
+ object.sparseTensors[j] = $root.onnx.SparseTensorProto.toObject(message.sparseTensors[j], options);
+ }
+ return object;
+ };
+
+ /**
+ * Converts this AttributeProto to JSON.
+ * @function toJSON
+ * @memberof onnx.AttributeProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ AttributeProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for AttributeProto
+ * @function getTypeUrl
+ * @memberof onnx.AttributeProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ AttributeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.AttributeProto";
+ };
+
+ /**
+ * AttributeType enum.
+ * @name onnx.AttributeProto.AttributeType
+ * @enum {number}
+ * @property {number} UNDEFINED=0 UNDEFINED value
+ * @property {number} FLOAT=1 FLOAT value
+ * @property {number} INT=2 INT value
+ * @property {number} STRING=3 STRING value
+ * @property {number} TENSOR=4 TENSOR value
+ * @property {number} GRAPH=5 GRAPH value
+ * @property {number} SPARSE_TENSOR=11 SPARSE_TENSOR value
+ * @property {number} TYPE_PROTO=13 TYPE_PROTO value
+ * @property {number} FLOATS=6 FLOATS value
+ * @property {number} INTS=7 INTS value
+ * @property {number} STRINGS=8 STRINGS value
+ * @property {number} TENSORS=9 TENSORS value
+ * @property {number} GRAPHS=10 GRAPHS value
+ * @property {number} SPARSE_TENSORS=12 SPARSE_TENSORS value
+ * @property {number} TYPE_PROTOS=14 TYPE_PROTOS value
+ */
+ AttributeProto.AttributeType = (function() {
+ var valuesById = {}, values = Object.create(valuesById);
+ values[valuesById[0] = "UNDEFINED"] = 0;
+ values[valuesById[1] = "FLOAT"] = 1;
+ values[valuesById[2] = "INT"] = 2;
+ values[valuesById[3] = "STRING"] = 3;
+ values[valuesById[4] = "TENSOR"] = 4;
+ values[valuesById[5] = "GRAPH"] = 5;
+ values[valuesById[11] = "SPARSE_TENSOR"] = 11;
+ values[valuesById[13] = "TYPE_PROTO"] = 13;
+ values[valuesById[6] = "FLOATS"] = 6;
+ values[valuesById[7] = "INTS"] = 7;
+ values[valuesById[8] = "STRINGS"] = 8;
+ values[valuesById[9] = "TENSORS"] = 9;
+ values[valuesById[10] = "GRAPHS"] = 10;
+ values[valuesById[12] = "SPARSE_TENSORS"] = 12;
+ values[valuesById[14] = "TYPE_PROTOS"] = 14;
+ return values;
+ })();
+
+ return AttributeProto;
+ })();
+
+ onnx.ValueInfoProto = (function() {
+
+ /**
+ * Properties of a ValueInfoProto.
+ * @memberof onnx
+ * @interface IValueInfoProto
+ * @property {string|null} [name] ValueInfoProto name
+ * @property {onnx.ITypeProto|null} [type] ValueInfoProto type
+ * @property {string|null} [docString] ValueInfoProto docString
+ */
+
+ /**
+ * Constructs a new ValueInfoProto.
+ * @memberof onnx
+ * @classdesc Represents a ValueInfoProto.
+ * @implements IValueInfoProto
+ * @constructor
+ * @param {onnx.IValueInfoProto=} [properties] Properties to set
+ */
+ function ValueInfoProto(properties) {
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * ValueInfoProto name.
+ * @member {string} name
+ * @memberof onnx.ValueInfoProto
+ * @instance
+ */
+ ValueInfoProto.prototype.name = "";
+
+ /**
+ * ValueInfoProto type.
+ * @member {onnx.ITypeProto|null|undefined} type
+ * @memberof onnx.ValueInfoProto
+ * @instance
+ */
+ ValueInfoProto.prototype.type = null;
+
+ /**
+ * ValueInfoProto docString.
+ * @member {string} docString
+ * @memberof onnx.ValueInfoProto
+ * @instance
+ */
+ ValueInfoProto.prototype.docString = "";
+
+ /**
+ * Creates a new ValueInfoProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.ValueInfoProto
+ * @static
+ * @param {onnx.IValueInfoProto=} [properties] Properties to set
+ * @returns {onnx.ValueInfoProto} ValueInfoProto instance
+ */
+ ValueInfoProto.create = function create(properties) {
+ return new ValueInfoProto(properties);
+ };
+
+ /**
+ * Encodes the specified ValueInfoProto message. Does not implicitly {@link onnx.ValueInfoProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.ValueInfoProto
+ * @static
+ * @param {onnx.IValueInfoProto} message ValueInfoProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ ValueInfoProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.name != null && Object.hasOwnProperty.call(message, "name"))
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.name);
+ if (message.type != null && Object.hasOwnProperty.call(message, "type"))
+ $root.onnx.TypeProto.encode(message.type, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
+ if (message.docString != null && Object.hasOwnProperty.call(message, "docString"))
+ writer.uint32(/* id 3, wireType 2 =*/26).string(message.docString);
+ return writer;
+ };
+
+ /**
+ * Encodes the specified ValueInfoProto message, length delimited. Does not implicitly {@link onnx.ValueInfoProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.ValueInfoProto
+ * @static
+ * @param {onnx.IValueInfoProto} message ValueInfoProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ ValueInfoProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a ValueInfoProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.ValueInfoProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.ValueInfoProto} ValueInfoProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ ValueInfoProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.ValueInfoProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.name = reader.string();
+ break;
+ }
+ case 2: {
+ message.type = $root.onnx.TypeProto.decode(reader, reader.uint32());
+ break;
+ }
+ case 3: {
+ message.docString = reader.string();
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a ValueInfoProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.ValueInfoProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.ValueInfoProto} ValueInfoProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ ValueInfoProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a ValueInfoProto message.
+ * @function verify
+ * @memberof onnx.ValueInfoProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ ValueInfoProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.name != null && message.hasOwnProperty("name"))
+ if (!$util.isString(message.name))
+ return "name: string expected";
+ if (message.type != null && message.hasOwnProperty("type")) {
+ var error = $root.onnx.TypeProto.verify(message.type);
+ if (error)
+ return "type." + error;
+ }
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ if (!$util.isString(message.docString))
+ return "docString: string expected";
+ return null;
+ };
+
+ /**
+ * Creates a ValueInfoProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.ValueInfoProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.ValueInfoProto} ValueInfoProto
+ */
+ ValueInfoProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.ValueInfoProto)
+ return object;
+ var message = new $root.onnx.ValueInfoProto();
+ if (object.name != null)
+ message.name = String(object.name);
+ if (object.type != null) {
+ if (typeof object.type !== "object")
+ throw TypeError(".onnx.ValueInfoProto.type: object expected");
+ message.type = $root.onnx.TypeProto.fromObject(object.type);
+ }
+ if (object.docString != null)
+ message.docString = String(object.docString);
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a ValueInfoProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.ValueInfoProto
+ * @static
+ * @param {onnx.ValueInfoProto} message ValueInfoProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ ValueInfoProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.defaults) {
+ object.name = "";
+ object.type = null;
+ object.docString = "";
+ }
+ if (message.name != null && message.hasOwnProperty("name"))
+ object.name = message.name;
+ if (message.type != null && message.hasOwnProperty("type"))
+ object.type = $root.onnx.TypeProto.toObject(message.type, options);
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ object.docString = message.docString;
+ return object;
+ };
+
+ /**
+ * Converts this ValueInfoProto to JSON.
+ * @function toJSON
+ * @memberof onnx.ValueInfoProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ ValueInfoProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for ValueInfoProto
+ * @function getTypeUrl
+ * @memberof onnx.ValueInfoProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ ValueInfoProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.ValueInfoProto";
+ };
+
+ return ValueInfoProto;
+ })();
+
+ onnx.NodeProto = (function() {
+
+ /**
+ * Properties of a NodeProto.
+ * @memberof onnx
+ * @interface INodeProto
+ * @property {Array.|null} [input] NodeProto input
+ * @property {Array.|null} [output] NodeProto output
+ * @property {string|null} [name] NodeProto name
+ * @property {string|null} [opType] NodeProto opType
+ * @property {string|null} [domain] NodeProto domain
+ * @property {Array.|null} [attribute] NodeProto attribute
+ * @property {string|null} [docString] NodeProto docString
+ */
+
+ /**
+ * Constructs a new NodeProto.
+ * @memberof onnx
+ * @classdesc Represents a NodeProto.
+ * @implements INodeProto
+ * @constructor
+ * @param {onnx.INodeProto=} [properties] Properties to set
+ */
+ function NodeProto(properties) {
+ this.input = [];
+ this.output = [];
+ this.attribute = [];
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * NodeProto input.
+ * @member {Array.} input
+ * @memberof onnx.NodeProto
+ * @instance
+ */
+ NodeProto.prototype.input = $util.emptyArray;
+
+ /**
+ * NodeProto output.
+ * @member {Array.} output
+ * @memberof onnx.NodeProto
+ * @instance
+ */
+ NodeProto.prototype.output = $util.emptyArray;
+
+ /**
+ * NodeProto name.
+ * @member {string} name
+ * @memberof onnx.NodeProto
+ * @instance
+ */
+ NodeProto.prototype.name = "";
+
+ /**
+ * NodeProto opType.
+ * @member {string} opType
+ * @memberof onnx.NodeProto
+ * @instance
+ */
+ NodeProto.prototype.opType = "";
+
+ /**
+ * NodeProto domain.
+ * @member {string} domain
+ * @memberof onnx.NodeProto
+ * @instance
+ */
+ NodeProto.prototype.domain = "";
+
+ /**
+ * NodeProto attribute.
+ * @member {Array.} attribute
+ * @memberof onnx.NodeProto
+ * @instance
+ */
+ NodeProto.prototype.attribute = $util.emptyArray;
+
+ /**
+ * NodeProto docString.
+ * @member {string} docString
+ * @memberof onnx.NodeProto
+ * @instance
+ */
+ NodeProto.prototype.docString = "";
+
+ /**
+ * Creates a new NodeProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.NodeProto
+ * @static
+ * @param {onnx.INodeProto=} [properties] Properties to set
+ * @returns {onnx.NodeProto} NodeProto instance
+ */
+ NodeProto.create = function create(properties) {
+ return new NodeProto(properties);
+ };
+
+ /**
+ * Encodes the specified NodeProto message. Does not implicitly {@link onnx.NodeProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.NodeProto
+ * @static
+ * @param {onnx.INodeProto} message NodeProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ NodeProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.input != null && message.input.length)
+ for (var i = 0; i < message.input.length; ++i)
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.input[i]);
+ if (message.output != null && message.output.length)
+ for (var i = 0; i < message.output.length; ++i)
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.output[i]);
+ if (message.name != null && Object.hasOwnProperty.call(message, "name"))
+ writer.uint32(/* id 3, wireType 2 =*/26).string(message.name);
+ if (message.opType != null && Object.hasOwnProperty.call(message, "opType"))
+ writer.uint32(/* id 4, wireType 2 =*/34).string(message.opType);
+ if (message.attribute != null && message.attribute.length)
+ for (var i = 0; i < message.attribute.length; ++i)
+ $root.onnx.AttributeProto.encode(message.attribute[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
+ if (message.docString != null && Object.hasOwnProperty.call(message, "docString"))
+ writer.uint32(/* id 6, wireType 2 =*/50).string(message.docString);
+ if (message.domain != null && Object.hasOwnProperty.call(message, "domain"))
+ writer.uint32(/* id 7, wireType 2 =*/58).string(message.domain);
+ return writer;
+ };
+
+ /**
+ * Encodes the specified NodeProto message, length delimited. Does not implicitly {@link onnx.NodeProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.NodeProto
+ * @static
+ * @param {onnx.INodeProto} message NodeProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ NodeProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a NodeProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.NodeProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.NodeProto} NodeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ NodeProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.NodeProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (!(message.input && message.input.length))
+ message.input = [];
+ message.input.push(reader.string());
+ break;
+ }
+ case 2: {
+ if (!(message.output && message.output.length))
+ message.output = [];
+ message.output.push(reader.string());
+ break;
+ }
+ case 3: {
+ message.name = reader.string();
+ break;
+ }
+ case 4: {
+ message.opType = reader.string();
+ break;
+ }
+ case 7: {
+ message.domain = reader.string();
+ break;
+ }
+ case 5: {
+ if (!(message.attribute && message.attribute.length))
+ message.attribute = [];
+ message.attribute.push($root.onnx.AttributeProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 6: {
+ message.docString = reader.string();
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a NodeProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.NodeProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.NodeProto} NodeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ NodeProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a NodeProto message.
+ * @function verify
+ * @memberof onnx.NodeProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ NodeProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.input != null && message.hasOwnProperty("input")) {
+ if (!Array.isArray(message.input))
+ return "input: array expected";
+ for (var i = 0; i < message.input.length; ++i)
+ if (!$util.isString(message.input[i]))
+ return "input: string[] expected";
+ }
+ if (message.output != null && message.hasOwnProperty("output")) {
+ if (!Array.isArray(message.output))
+ return "output: array expected";
+ for (var i = 0; i < message.output.length; ++i)
+ if (!$util.isString(message.output[i]))
+ return "output: string[] expected";
+ }
+ if (message.name != null && message.hasOwnProperty("name"))
+ if (!$util.isString(message.name))
+ return "name: string expected";
+ if (message.opType != null && message.hasOwnProperty("opType"))
+ if (!$util.isString(message.opType))
+ return "opType: string expected";
+ if (message.domain != null && message.hasOwnProperty("domain"))
+ if (!$util.isString(message.domain))
+ return "domain: string expected";
+ if (message.attribute != null && message.hasOwnProperty("attribute")) {
+ if (!Array.isArray(message.attribute))
+ return "attribute: array expected";
+ for (var i = 0; i < message.attribute.length; ++i) {
+ var error = $root.onnx.AttributeProto.verify(message.attribute[i]);
+ if (error)
+ return "attribute." + error;
+ }
+ }
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ if (!$util.isString(message.docString))
+ return "docString: string expected";
+ return null;
+ };
+
+ /**
+ * Creates a NodeProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.NodeProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.NodeProto} NodeProto
+ */
+ NodeProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.NodeProto)
+ return object;
+ var message = new $root.onnx.NodeProto();
+ if (object.input) {
+ if (!Array.isArray(object.input))
+ throw TypeError(".onnx.NodeProto.input: array expected");
+ message.input = [];
+ for (var i = 0; i < object.input.length; ++i)
+ message.input[i] = String(object.input[i]);
+ }
+ if (object.output) {
+ if (!Array.isArray(object.output))
+ throw TypeError(".onnx.NodeProto.output: array expected");
+ message.output = [];
+ for (var i = 0; i < object.output.length; ++i)
+ message.output[i] = String(object.output[i]);
+ }
+ if (object.name != null)
+ message.name = String(object.name);
+ if (object.opType != null)
+ message.opType = String(object.opType);
+ if (object.domain != null)
+ message.domain = String(object.domain);
+ if (object.attribute) {
+ if (!Array.isArray(object.attribute))
+ throw TypeError(".onnx.NodeProto.attribute: array expected");
+ message.attribute = [];
+ for (var i = 0; i < object.attribute.length; ++i) {
+ if (typeof object.attribute[i] !== "object")
+ throw TypeError(".onnx.NodeProto.attribute: object expected");
+ message.attribute[i] = $root.onnx.AttributeProto.fromObject(object.attribute[i]);
+ }
+ }
+ if (object.docString != null)
+ message.docString = String(object.docString);
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a NodeProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.NodeProto
+ * @static
+ * @param {onnx.NodeProto} message NodeProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ NodeProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.arrays || options.defaults) {
+ object.input = [];
+ object.output = [];
+ object.attribute = [];
+ }
+ if (options.defaults) {
+ object.name = "";
+ object.opType = "";
+ object.docString = "";
+ object.domain = "";
+ }
+ if (message.input && message.input.length) {
+ object.input = [];
+ for (var j = 0; j < message.input.length; ++j)
+ object.input[j] = message.input[j];
+ }
+ if (message.output && message.output.length) {
+ object.output = [];
+ for (var j = 0; j < message.output.length; ++j)
+ object.output[j] = message.output[j];
+ }
+ if (message.name != null && message.hasOwnProperty("name"))
+ object.name = message.name;
+ if (message.opType != null && message.hasOwnProperty("opType"))
+ object.opType = message.opType;
+ if (message.attribute && message.attribute.length) {
+ object.attribute = [];
+ for (var j = 0; j < message.attribute.length; ++j)
+ object.attribute[j] = $root.onnx.AttributeProto.toObject(message.attribute[j], options);
+ }
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ object.docString = message.docString;
+ if (message.domain != null && message.hasOwnProperty("domain"))
+ object.domain = message.domain;
+ return object;
+ };
+
+ /**
+ * Converts this NodeProto to JSON.
+ * @function toJSON
+ * @memberof onnx.NodeProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ NodeProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for NodeProto
+ * @function getTypeUrl
+ * @memberof onnx.NodeProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ NodeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.NodeProto";
+ };
+
+ return NodeProto;
+ })();
+
+ onnx.TrainingInfoProto = (function() {
+
+ /**
+ * Properties of a TrainingInfoProto.
+ * @memberof onnx
+ * @interface ITrainingInfoProto
+ * @property {onnx.IGraphProto|null} [initialization] TrainingInfoProto initialization
+ * @property {onnx.IGraphProto|null} [algorithm] TrainingInfoProto algorithm
+ * @property {Array.|null} [initializationBinding] TrainingInfoProto initializationBinding
+ * @property {Array.|null} [updateBinding] TrainingInfoProto updateBinding
+ */
+
+ /**
+ * Constructs a new TrainingInfoProto.
+ * @memberof onnx
+ * @classdesc Represents a TrainingInfoProto.
+ * @implements ITrainingInfoProto
+ * @constructor
+ * @param {onnx.ITrainingInfoProto=} [properties] Properties to set
+ */
+ function TrainingInfoProto(properties) {
+ this.initializationBinding = [];
+ this.updateBinding = [];
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * TrainingInfoProto initialization.
+ * @member {onnx.IGraphProto|null|undefined} initialization
+ * @memberof onnx.TrainingInfoProto
+ * @instance
+ */
+ TrainingInfoProto.prototype.initialization = null;
+
+ /**
+ * TrainingInfoProto algorithm.
+ * @member {onnx.IGraphProto|null|undefined} algorithm
+ * @memberof onnx.TrainingInfoProto
+ * @instance
+ */
+ TrainingInfoProto.prototype.algorithm = null;
+
+ /**
+ * TrainingInfoProto initializationBinding.
+ * @member {Array.} initializationBinding
+ * @memberof onnx.TrainingInfoProto
+ * @instance
+ */
+ TrainingInfoProto.prototype.initializationBinding = $util.emptyArray;
+
+ /**
+ * TrainingInfoProto updateBinding.
+ * @member {Array.} updateBinding
+ * @memberof onnx.TrainingInfoProto
+ * @instance
+ */
+ TrainingInfoProto.prototype.updateBinding = $util.emptyArray;
+
+ /**
+ * Creates a new TrainingInfoProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.TrainingInfoProto
+ * @static
+ * @param {onnx.ITrainingInfoProto=} [properties] Properties to set
+ * @returns {onnx.TrainingInfoProto} TrainingInfoProto instance
+ */
+ TrainingInfoProto.create = function create(properties) {
+ return new TrainingInfoProto(properties);
+ };
+
+ /**
+ * Encodes the specified TrainingInfoProto message. Does not implicitly {@link onnx.TrainingInfoProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TrainingInfoProto
+ * @static
+ * @param {onnx.ITrainingInfoProto} message TrainingInfoProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ TrainingInfoProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.initialization != null && Object.hasOwnProperty.call(message, "initialization"))
+ $root.onnx.GraphProto.encode(message.initialization, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
+ if (message.algorithm != null && Object.hasOwnProperty.call(message, "algorithm"))
+ $root.onnx.GraphProto.encode(message.algorithm, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
+ if (message.initializationBinding != null && message.initializationBinding.length)
+ for (var i = 0; i < message.initializationBinding.length; ++i)
+ $root.onnx.StringStringEntryProto.encode(message.initializationBinding[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
+ if (message.updateBinding != null && message.updateBinding.length)
+ for (var i = 0; i < message.updateBinding.length; ++i)
+ $root.onnx.StringStringEntryProto.encode(message.updateBinding[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified TrainingInfoProto message, length delimited. Does not implicitly {@link onnx.TrainingInfoProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TrainingInfoProto
+ * @static
+ * @param {onnx.ITrainingInfoProto} message TrainingInfoProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ TrainingInfoProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a TrainingInfoProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TrainingInfoProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TrainingInfoProto} TrainingInfoProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ TrainingInfoProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TrainingInfoProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.initialization = $root.onnx.GraphProto.decode(reader, reader.uint32());
+ break;
+ }
+ case 2: {
+ message.algorithm = $root.onnx.GraphProto.decode(reader, reader.uint32());
+ break;
+ }
+ case 3: {
+ if (!(message.initializationBinding && message.initializationBinding.length))
+ message.initializationBinding = [];
+ message.initializationBinding.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 4: {
+ if (!(message.updateBinding && message.updateBinding.length))
+ message.updateBinding = [];
+ message.updateBinding.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a TrainingInfoProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TrainingInfoProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TrainingInfoProto} TrainingInfoProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ TrainingInfoProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a TrainingInfoProto message.
+ * @function verify
+ * @memberof onnx.TrainingInfoProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ TrainingInfoProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.initialization != null && message.hasOwnProperty("initialization")) {
+ var error = $root.onnx.GraphProto.verify(message.initialization);
+ if (error)
+ return "initialization." + error;
+ }
+ if (message.algorithm != null && message.hasOwnProperty("algorithm")) {
+ var error = $root.onnx.GraphProto.verify(message.algorithm);
+ if (error)
+ return "algorithm." + error;
+ }
+ if (message.initializationBinding != null && message.hasOwnProperty("initializationBinding")) {
+ if (!Array.isArray(message.initializationBinding))
+ return "initializationBinding: array expected";
+ for (var i = 0; i < message.initializationBinding.length; ++i) {
+ var error = $root.onnx.StringStringEntryProto.verify(message.initializationBinding[i]);
+ if (error)
+ return "initializationBinding." + error;
+ }
+ }
+ if (message.updateBinding != null && message.hasOwnProperty("updateBinding")) {
+ if (!Array.isArray(message.updateBinding))
+ return "updateBinding: array expected";
+ for (var i = 0; i < message.updateBinding.length; ++i) {
+ var error = $root.onnx.StringStringEntryProto.verify(message.updateBinding[i]);
+ if (error)
+ return "updateBinding." + error;
+ }
+ }
+ return null;
+ };
+
+ /**
+ * Creates a TrainingInfoProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TrainingInfoProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TrainingInfoProto} TrainingInfoProto
+ */
+ TrainingInfoProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TrainingInfoProto)
+ return object;
+ var message = new $root.onnx.TrainingInfoProto();
+ if (object.initialization != null) {
+ if (typeof object.initialization !== "object")
+ throw TypeError(".onnx.TrainingInfoProto.initialization: object expected");
+ message.initialization = $root.onnx.GraphProto.fromObject(object.initialization);
+ }
+ if (object.algorithm != null) {
+ if (typeof object.algorithm !== "object")
+ throw TypeError(".onnx.TrainingInfoProto.algorithm: object expected");
+ message.algorithm = $root.onnx.GraphProto.fromObject(object.algorithm);
+ }
+ if (object.initializationBinding) {
+ if (!Array.isArray(object.initializationBinding))
+ throw TypeError(".onnx.TrainingInfoProto.initializationBinding: array expected");
+ message.initializationBinding = [];
+ for (var i = 0; i < object.initializationBinding.length; ++i) {
+ if (typeof object.initializationBinding[i] !== "object")
+ throw TypeError(".onnx.TrainingInfoProto.initializationBinding: object expected");
+ message.initializationBinding[i] = $root.onnx.StringStringEntryProto.fromObject(object.initializationBinding[i]);
+ }
+ }
+ if (object.updateBinding) {
+ if (!Array.isArray(object.updateBinding))
+ throw TypeError(".onnx.TrainingInfoProto.updateBinding: array expected");
+ message.updateBinding = [];
+ for (var i = 0; i < object.updateBinding.length; ++i) {
+ if (typeof object.updateBinding[i] !== "object")
+ throw TypeError(".onnx.TrainingInfoProto.updateBinding: object expected");
+ message.updateBinding[i] = $root.onnx.StringStringEntryProto.fromObject(object.updateBinding[i]);
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a TrainingInfoProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TrainingInfoProto
+ * @static
+ * @param {onnx.TrainingInfoProto} message TrainingInfoProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ TrainingInfoProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.arrays || options.defaults) {
+ object.initializationBinding = [];
+ object.updateBinding = [];
+ }
+ if (options.defaults) {
+ object.initialization = null;
+ object.algorithm = null;
+ }
+ if (message.initialization != null && message.hasOwnProperty("initialization"))
+ object.initialization = $root.onnx.GraphProto.toObject(message.initialization, options);
+ if (message.algorithm != null && message.hasOwnProperty("algorithm"))
+ object.algorithm = $root.onnx.GraphProto.toObject(message.algorithm, options);
+ if (message.initializationBinding && message.initializationBinding.length) {
+ object.initializationBinding = [];
+ for (var j = 0; j < message.initializationBinding.length; ++j)
+ object.initializationBinding[j] = $root.onnx.StringStringEntryProto.toObject(message.initializationBinding[j], options);
+ }
+ if (message.updateBinding && message.updateBinding.length) {
+ object.updateBinding = [];
+ for (var j = 0; j < message.updateBinding.length; ++j)
+ object.updateBinding[j] = $root.onnx.StringStringEntryProto.toObject(message.updateBinding[j], options);
+ }
+ return object;
+ };
+
+ /**
+ * Converts this TrainingInfoProto to JSON.
+ * @function toJSON
+ * @memberof onnx.TrainingInfoProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ TrainingInfoProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for TrainingInfoProto
+ * @function getTypeUrl
+ * @memberof onnx.TrainingInfoProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ TrainingInfoProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TrainingInfoProto";
+ };
+
+ return TrainingInfoProto;
+ })();
+
+ onnx.ModelProto = (function() {
+
+ /**
+ * Properties of a ModelProto.
+ * @memberof onnx
+ * @interface IModelProto
+ * @property {number|Long|null} [irVersion] ModelProto irVersion
+ * @property {Array.|null} [opsetImport] ModelProto opsetImport
+ * @property {string|null} [producerName] ModelProto producerName
+ * @property {string|null} [producerVersion] ModelProto producerVersion
+ * @property {string|null} [domain] ModelProto domain
+ * @property {number|Long|null} [modelVersion] ModelProto modelVersion
+ * @property {string|null} [docString] ModelProto docString
+ * @property {onnx.IGraphProto|null} [graph] ModelProto graph
+ * @property {Array.|null} [metadataProps] ModelProto metadataProps
+ * @property {Array.|null} [trainingInfo] ModelProto trainingInfo
+ * @property {Array.|null} [functions] ModelProto functions
+ */
+
+ /**
+ * Constructs a new ModelProto.
+ * @memberof onnx
+ * @classdesc Represents a ModelProto.
+ * @implements IModelProto
+ * @constructor
+ * @param {onnx.IModelProto=} [properties] Properties to set
+ */
+ function ModelProto(properties) {
+ this.opsetImport = [];
+ this.metadataProps = [];
+ this.trainingInfo = [];
+ this.functions = [];
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * ModelProto irVersion.
+ * @member {number|Long} irVersion
+ * @memberof onnx.ModelProto
+ * @instance
+ */
+ ModelProto.prototype.irVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
+
+ /**
+ * ModelProto opsetImport.
+ * @member {Array.} opsetImport
+ * @memberof onnx.ModelProto
+ * @instance
+ */
+ ModelProto.prototype.opsetImport = $util.emptyArray;
+
+ /**
+ * ModelProto producerName.
+ * @member {string} producerName
+ * @memberof onnx.ModelProto
+ * @instance
+ */
+ ModelProto.prototype.producerName = "";
+
+ /**
+ * ModelProto producerVersion.
+ * @member {string} producerVersion
+ * @memberof onnx.ModelProto
+ * @instance
+ */
+ ModelProto.prototype.producerVersion = "";
+
+ /**
+ * ModelProto domain.
+ * @member {string} domain
+ * @memberof onnx.ModelProto
+ * @instance
+ */
+ ModelProto.prototype.domain = "";
+
+ /**
+ * ModelProto modelVersion.
+ * @member {number|Long} modelVersion
+ * @memberof onnx.ModelProto
+ * @instance
+ */
+ ModelProto.prototype.modelVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
+
+ /**
+ * ModelProto docString.
+ * @member {string} docString
+ * @memberof onnx.ModelProto
+ * @instance
+ */
+ ModelProto.prototype.docString = "";
+
+ /**
+ * ModelProto graph.
+ * @member {onnx.IGraphProto|null|undefined} graph
+ * @memberof onnx.ModelProto
+ * @instance
+ */
+ ModelProto.prototype.graph = null;
+
+ /**
+ * ModelProto metadataProps.
+ * @member {Array.} metadataProps
+ * @memberof onnx.ModelProto
+ * @instance
+ */
+ ModelProto.prototype.metadataProps = $util.emptyArray;
+
+ /**
+ * ModelProto trainingInfo.
+ * @member {Array.} trainingInfo
+ * @memberof onnx.ModelProto
+ * @instance
+ */
+ ModelProto.prototype.trainingInfo = $util.emptyArray;
+
+ /**
+ * ModelProto functions.
+ * @member {Array.} functions
+ * @memberof onnx.ModelProto
+ * @instance
+ */
+ ModelProto.prototype.functions = $util.emptyArray;
+
+ /**
+ * Creates a new ModelProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.ModelProto
+ * @static
+ * @param {onnx.IModelProto=} [properties] Properties to set
+ * @returns {onnx.ModelProto} ModelProto instance
+ */
+ ModelProto.create = function create(properties) {
+ return new ModelProto(properties);
+ };
+
+ /**
+ * Encodes the specified ModelProto message. Does not implicitly {@link onnx.ModelProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.ModelProto
+ * @static
+ * @param {onnx.IModelProto} message ModelProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ ModelProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.irVersion != null && Object.hasOwnProperty.call(message, "irVersion"))
+ writer.uint32(/* id 1, wireType 0 =*/8).int64(message.irVersion);
+ if (message.producerName != null && Object.hasOwnProperty.call(message, "producerName"))
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.producerName);
+ if (message.producerVersion != null && Object.hasOwnProperty.call(message, "producerVersion"))
+ writer.uint32(/* id 3, wireType 2 =*/26).string(message.producerVersion);
+ if (message.domain != null && Object.hasOwnProperty.call(message, "domain"))
+ writer.uint32(/* id 4, wireType 2 =*/34).string(message.domain);
+ if (message.modelVersion != null && Object.hasOwnProperty.call(message, "modelVersion"))
+ writer.uint32(/* id 5, wireType 0 =*/40).int64(message.modelVersion);
+ if (message.docString != null && Object.hasOwnProperty.call(message, "docString"))
+ writer.uint32(/* id 6, wireType 2 =*/50).string(message.docString);
+ if (message.graph != null && Object.hasOwnProperty.call(message, "graph"))
+ $root.onnx.GraphProto.encode(message.graph, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim();
+ if (message.opsetImport != null && message.opsetImport.length)
+ for (var i = 0; i < message.opsetImport.length; ++i)
+ $root.onnx.OperatorSetIdProto.encode(message.opsetImport[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
+ if (message.metadataProps != null && message.metadataProps.length)
+ for (var i = 0; i < message.metadataProps.length; ++i)
+ $root.onnx.StringStringEntryProto.encode(message.metadataProps[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim();
+ if (message.trainingInfo != null && message.trainingInfo.length)
+ for (var i = 0; i < message.trainingInfo.length; ++i)
+ $root.onnx.TrainingInfoProto.encode(message.trainingInfo[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim();
+ if (message.functions != null && message.functions.length)
+ for (var i = 0; i < message.functions.length; ++i)
+ $root.onnx.FunctionProto.encode(message.functions[i], writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified ModelProto message, length delimited. Does not implicitly {@link onnx.ModelProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.ModelProto
+ * @static
+ * @param {onnx.IModelProto} message ModelProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ ModelProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a ModelProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.ModelProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.ModelProto} ModelProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ ModelProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.ModelProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.irVersion = reader.int64();
+ break;
+ }
+ case 8: {
+ if (!(message.opsetImport && message.opsetImport.length))
+ message.opsetImport = [];
+ message.opsetImport.push($root.onnx.OperatorSetIdProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 2: {
+ message.producerName = reader.string();
+ break;
+ }
+ case 3: {
+ message.producerVersion = reader.string();
+ break;
+ }
+ case 4: {
+ message.domain = reader.string();
+ break;
+ }
+ case 5: {
+ message.modelVersion = reader.int64();
+ break;
+ }
+ case 6: {
+ message.docString = reader.string();
+ break;
+ }
+ case 7: {
+ message.graph = $root.onnx.GraphProto.decode(reader, reader.uint32());
+ break;
+ }
+ case 14: {
+ if (!(message.metadataProps && message.metadataProps.length))
+ message.metadataProps = [];
+ message.metadataProps.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 20: {
+ if (!(message.trainingInfo && message.trainingInfo.length))
+ message.trainingInfo = [];
+ message.trainingInfo.push($root.onnx.TrainingInfoProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 25: {
+ if (!(message.functions && message.functions.length))
+ message.functions = [];
+ message.functions.push($root.onnx.FunctionProto.decode(reader, reader.uint32()));
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a ModelProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.ModelProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.ModelProto} ModelProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ ModelProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a ModelProto message.
+ * @function verify
+ * @memberof onnx.ModelProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ ModelProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.irVersion != null && message.hasOwnProperty("irVersion"))
+ if (!$util.isInteger(message.irVersion) && !(message.irVersion && $util.isInteger(message.irVersion.low) && $util.isInteger(message.irVersion.high)))
+ return "irVersion: integer|Long expected";
+ if (message.opsetImport != null && message.hasOwnProperty("opsetImport")) {
+ if (!Array.isArray(message.opsetImport))
+ return "opsetImport: array expected";
+ for (var i = 0; i < message.opsetImport.length; ++i) {
+ var error = $root.onnx.OperatorSetIdProto.verify(message.opsetImport[i]);
+ if (error)
+ return "opsetImport." + error;
+ }
+ }
+ if (message.producerName != null && message.hasOwnProperty("producerName"))
+ if (!$util.isString(message.producerName))
+ return "producerName: string expected";
+ if (message.producerVersion != null && message.hasOwnProperty("producerVersion"))
+ if (!$util.isString(message.producerVersion))
+ return "producerVersion: string expected";
+ if (message.domain != null && message.hasOwnProperty("domain"))
+ if (!$util.isString(message.domain))
+ return "domain: string expected";
+ if (message.modelVersion != null && message.hasOwnProperty("modelVersion"))
+ if (!$util.isInteger(message.modelVersion) && !(message.modelVersion && $util.isInteger(message.modelVersion.low) && $util.isInteger(message.modelVersion.high)))
+ return "modelVersion: integer|Long expected";
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ if (!$util.isString(message.docString))
+ return "docString: string expected";
+ if (message.graph != null && message.hasOwnProperty("graph")) {
+ var error = $root.onnx.GraphProto.verify(message.graph);
+ if (error)
+ return "graph." + error;
+ }
+ if (message.metadataProps != null && message.hasOwnProperty("metadataProps")) {
+ if (!Array.isArray(message.metadataProps))
+ return "metadataProps: array expected";
+ for (var i = 0; i < message.metadataProps.length; ++i) {
+ var error = $root.onnx.StringStringEntryProto.verify(message.metadataProps[i]);
+ if (error)
+ return "metadataProps." + error;
+ }
+ }
+ if (message.trainingInfo != null && message.hasOwnProperty("trainingInfo")) {
+ if (!Array.isArray(message.trainingInfo))
+ return "trainingInfo: array expected";
+ for (var i = 0; i < message.trainingInfo.length; ++i) {
+ var error = $root.onnx.TrainingInfoProto.verify(message.trainingInfo[i]);
+ if (error)
+ return "trainingInfo." + error;
+ }
+ }
+ if (message.functions != null && message.hasOwnProperty("functions")) {
+ if (!Array.isArray(message.functions))
+ return "functions: array expected";
+ for (var i = 0; i < message.functions.length; ++i) {
+ var error = $root.onnx.FunctionProto.verify(message.functions[i]);
+ if (error)
+ return "functions." + error;
+ }
+ }
+ return null;
+ };
+
+ /**
+ * Creates a ModelProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.ModelProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.ModelProto} ModelProto
+ */
+ ModelProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.ModelProto)
+ return object;
+ var message = new $root.onnx.ModelProto();
+ if (object.irVersion != null)
+ if ($util.Long)
+ (message.irVersion = $util.Long.fromValue(object.irVersion)).unsigned = false;
+ else if (typeof object.irVersion === "string")
+ message.irVersion = parseInt(object.irVersion, 10);
+ else if (typeof object.irVersion === "number")
+ message.irVersion = object.irVersion;
+ else if (typeof object.irVersion === "object")
+ message.irVersion = new $util.LongBits(object.irVersion.low >>> 0, object.irVersion.high >>> 0).toNumber();
+ if (object.opsetImport) {
+ if (!Array.isArray(object.opsetImport))
+ throw TypeError(".onnx.ModelProto.opsetImport: array expected");
+ message.opsetImport = [];
+ for (var i = 0; i < object.opsetImport.length; ++i) {
+ if (typeof object.opsetImport[i] !== "object")
+ throw TypeError(".onnx.ModelProto.opsetImport: object expected");
+ message.opsetImport[i] = $root.onnx.OperatorSetIdProto.fromObject(object.opsetImport[i]);
+ }
+ }
+ if (object.producerName != null)
+ message.producerName = String(object.producerName);
+ if (object.producerVersion != null)
+ message.producerVersion = String(object.producerVersion);
+ if (object.domain != null)
+ message.domain = String(object.domain);
+ if (object.modelVersion != null)
+ if ($util.Long)
+ (message.modelVersion = $util.Long.fromValue(object.modelVersion)).unsigned = false;
+ else if (typeof object.modelVersion === "string")
+ message.modelVersion = parseInt(object.modelVersion, 10);
+ else if (typeof object.modelVersion === "number")
+ message.modelVersion = object.modelVersion;
+ else if (typeof object.modelVersion === "object")
+ message.modelVersion = new $util.LongBits(object.modelVersion.low >>> 0, object.modelVersion.high >>> 0).toNumber();
+ if (object.docString != null)
+ message.docString = String(object.docString);
+ if (object.graph != null) {
+ if (typeof object.graph !== "object")
+ throw TypeError(".onnx.ModelProto.graph: object expected");
+ message.graph = $root.onnx.GraphProto.fromObject(object.graph);
+ }
+ if (object.metadataProps) {
+ if (!Array.isArray(object.metadataProps))
+ throw TypeError(".onnx.ModelProto.metadataProps: array expected");
+ message.metadataProps = [];
+ for (var i = 0; i < object.metadataProps.length; ++i) {
+ if (typeof object.metadataProps[i] !== "object")
+ throw TypeError(".onnx.ModelProto.metadataProps: object expected");
+ message.metadataProps[i] = $root.onnx.StringStringEntryProto.fromObject(object.metadataProps[i]);
+ }
+ }
+ if (object.trainingInfo) {
+ if (!Array.isArray(object.trainingInfo))
+ throw TypeError(".onnx.ModelProto.trainingInfo: array expected");
+ message.trainingInfo = [];
+ for (var i = 0; i < object.trainingInfo.length; ++i) {
+ if (typeof object.trainingInfo[i] !== "object")
+ throw TypeError(".onnx.ModelProto.trainingInfo: object expected");
+ message.trainingInfo[i] = $root.onnx.TrainingInfoProto.fromObject(object.trainingInfo[i]);
+ }
+ }
+ if (object.functions) {
+ if (!Array.isArray(object.functions))
+ throw TypeError(".onnx.ModelProto.functions: array expected");
+ message.functions = [];
+ for (var i = 0; i < object.functions.length; ++i) {
+ if (typeof object.functions[i] !== "object")
+ throw TypeError(".onnx.ModelProto.functions: object expected");
+ message.functions[i] = $root.onnx.FunctionProto.fromObject(object.functions[i]);
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a ModelProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.ModelProto
+ * @static
+ * @param {onnx.ModelProto} message ModelProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ ModelProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.arrays || options.defaults) {
+ object.opsetImport = [];
+ object.metadataProps = [];
+ object.trainingInfo = [];
+ object.functions = [];
+ }
+ if (options.defaults) {
+ if ($util.Long) {
+ var long = new $util.Long(0, 0, false);
+ object.irVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
+ } else
+ object.irVersion = options.longs === String ? "0" : 0;
+ object.producerName = "";
+ object.producerVersion = "";
+ object.domain = "";
+ if ($util.Long) {
+ var long = new $util.Long(0, 0, false);
+ object.modelVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
+ } else
+ object.modelVersion = options.longs === String ? "0" : 0;
+ object.docString = "";
+ object.graph = null;
+ }
+ if (message.irVersion != null && message.hasOwnProperty("irVersion"))
+ if (typeof message.irVersion === "number")
+ object.irVersion = options.longs === String ? String(message.irVersion) : message.irVersion;
+ else
+ object.irVersion = options.longs === String ? $util.Long.prototype.toString.call(message.irVersion) : options.longs === Number ? new $util.LongBits(message.irVersion.low >>> 0, message.irVersion.high >>> 0).toNumber() : message.irVersion;
+ if (message.producerName != null && message.hasOwnProperty("producerName"))
+ object.producerName = message.producerName;
+ if (message.producerVersion != null && message.hasOwnProperty("producerVersion"))
+ object.producerVersion = message.producerVersion;
+ if (message.domain != null && message.hasOwnProperty("domain"))
+ object.domain = message.domain;
+ if (message.modelVersion != null && message.hasOwnProperty("modelVersion"))
+ if (typeof message.modelVersion === "number")
+ object.modelVersion = options.longs === String ? String(message.modelVersion) : message.modelVersion;
+ else
+ object.modelVersion = options.longs === String ? $util.Long.prototype.toString.call(message.modelVersion) : options.longs === Number ? new $util.LongBits(message.modelVersion.low >>> 0, message.modelVersion.high >>> 0).toNumber() : message.modelVersion;
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ object.docString = message.docString;
+ if (message.graph != null && message.hasOwnProperty("graph"))
+ object.graph = $root.onnx.GraphProto.toObject(message.graph, options);
+ if (message.opsetImport && message.opsetImport.length) {
+ object.opsetImport = [];
+ for (var j = 0; j < message.opsetImport.length; ++j)
+ object.opsetImport[j] = $root.onnx.OperatorSetIdProto.toObject(message.opsetImport[j], options);
+ }
+ if (message.metadataProps && message.metadataProps.length) {
+ object.metadataProps = [];
+ for (var j = 0; j < message.metadataProps.length; ++j)
+ object.metadataProps[j] = $root.onnx.StringStringEntryProto.toObject(message.metadataProps[j], options);
+ }
+ if (message.trainingInfo && message.trainingInfo.length) {
+ object.trainingInfo = [];
+ for (var j = 0; j < message.trainingInfo.length; ++j)
+ object.trainingInfo[j] = $root.onnx.TrainingInfoProto.toObject(message.trainingInfo[j], options);
+ }
+ if (message.functions && message.functions.length) {
+ object.functions = [];
+ for (var j = 0; j < message.functions.length; ++j)
+ object.functions[j] = $root.onnx.FunctionProto.toObject(message.functions[j], options);
+ }
+ return object;
+ };
+
+ /**
+ * Converts this ModelProto to JSON.
+ * @function toJSON
+ * @memberof onnx.ModelProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ ModelProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for ModelProto
+ * @function getTypeUrl
+ * @memberof onnx.ModelProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ ModelProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.ModelProto";
+ };
+
+ return ModelProto;
+ })();
+
+ onnx.StringStringEntryProto = (function() {
+
+ /**
+ * Properties of a StringStringEntryProto.
+ * @memberof onnx
+ * @interface IStringStringEntryProto
+ * @property {string|null} [key] StringStringEntryProto key
+ * @property {string|null} [value] StringStringEntryProto value
+ */
+
+ /**
+ * Constructs a new StringStringEntryProto.
+ * @memberof onnx
+ * @classdesc Represents a StringStringEntryProto.
+ * @implements IStringStringEntryProto
+ * @constructor
+ * @param {onnx.IStringStringEntryProto=} [properties] Properties to set
+ */
+ function StringStringEntryProto(properties) {
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * StringStringEntryProto key.
+ * @member {string} key
+ * @memberof onnx.StringStringEntryProto
+ * @instance
+ */
+ StringStringEntryProto.prototype.key = "";
+
+ /**
+ * StringStringEntryProto value.
+ * @member {string} value
+ * @memberof onnx.StringStringEntryProto
+ * @instance
+ */
+ StringStringEntryProto.prototype.value = "";
+
+ /**
+ * Creates a new StringStringEntryProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.StringStringEntryProto
+ * @static
+ * @param {onnx.IStringStringEntryProto=} [properties] Properties to set
+ * @returns {onnx.StringStringEntryProto} StringStringEntryProto instance
+ */
+ StringStringEntryProto.create = function create(properties) {
+ return new StringStringEntryProto(properties);
+ };
+
+ /**
+ * Encodes the specified StringStringEntryProto message. Does not implicitly {@link onnx.StringStringEntryProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.StringStringEntryProto
+ * @static
+ * @param {onnx.IStringStringEntryProto} message StringStringEntryProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ StringStringEntryProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.key != null && Object.hasOwnProperty.call(message, "key"))
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.key);
+ if (message.value != null && Object.hasOwnProperty.call(message, "value"))
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.value);
+ return writer;
+ };
+
+ /**
+ * Encodes the specified StringStringEntryProto message, length delimited. Does not implicitly {@link onnx.StringStringEntryProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.StringStringEntryProto
+ * @static
+ * @param {onnx.IStringStringEntryProto} message StringStringEntryProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ StringStringEntryProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a StringStringEntryProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.StringStringEntryProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.StringStringEntryProto} StringStringEntryProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ StringStringEntryProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.StringStringEntryProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.key = reader.string();
+ break;
+ }
+ case 2: {
+ message.value = reader.string();
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a StringStringEntryProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.StringStringEntryProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.StringStringEntryProto} StringStringEntryProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ StringStringEntryProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a StringStringEntryProto message.
+ * @function verify
+ * @memberof onnx.StringStringEntryProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ StringStringEntryProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.key != null && message.hasOwnProperty("key"))
+ if (!$util.isString(message.key))
+ return "key: string expected";
+ if (message.value != null && message.hasOwnProperty("value"))
+ if (!$util.isString(message.value))
+ return "value: string expected";
+ return null;
+ };
+
+ /**
+ * Creates a StringStringEntryProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.StringStringEntryProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.StringStringEntryProto} StringStringEntryProto
+ */
+ StringStringEntryProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.StringStringEntryProto)
+ return object;
+ var message = new $root.onnx.StringStringEntryProto();
+ if (object.key != null)
+ message.key = String(object.key);
+ if (object.value != null)
+ message.value = String(object.value);
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a StringStringEntryProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.StringStringEntryProto
+ * @static
+ * @param {onnx.StringStringEntryProto} message StringStringEntryProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ StringStringEntryProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.defaults) {
+ object.key = "";
+ object.value = "";
+ }
+ if (message.key != null && message.hasOwnProperty("key"))
+ object.key = message.key;
+ if (message.value != null && message.hasOwnProperty("value"))
+ object.value = message.value;
+ return object;
+ };
+
+ /**
+ * Converts this StringStringEntryProto to JSON.
+ * @function toJSON
+ * @memberof onnx.StringStringEntryProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ StringStringEntryProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for StringStringEntryProto
+ * @function getTypeUrl
+ * @memberof onnx.StringStringEntryProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ StringStringEntryProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.StringStringEntryProto";
+ };
+
+ return StringStringEntryProto;
+ })();
+
+ onnx.TensorAnnotation = (function() {
+
+ /**
+ * Properties of a TensorAnnotation.
+ * @memberof onnx
+ * @interface ITensorAnnotation
+ * @property {string|null} [tensorName] TensorAnnotation tensorName
+ * @property {Array.|null} [quantParameterTensorNames] TensorAnnotation quantParameterTensorNames
+ */
+
+ /**
+ * Constructs a new TensorAnnotation.
+ * @memberof onnx
+ * @classdesc Represents a TensorAnnotation.
+ * @implements ITensorAnnotation
+ * @constructor
+ * @param {onnx.ITensorAnnotation=} [properties] Properties to set
+ */
+ function TensorAnnotation(properties) {
+ this.quantParameterTensorNames = [];
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * TensorAnnotation tensorName.
+ * @member {string} tensorName
+ * @memberof onnx.TensorAnnotation
+ * @instance
+ */
+ TensorAnnotation.prototype.tensorName = "";
+
+ /**
+ * TensorAnnotation quantParameterTensorNames.
+ * @member {Array.} quantParameterTensorNames
+ * @memberof onnx.TensorAnnotation
+ * @instance
+ */
+ TensorAnnotation.prototype.quantParameterTensorNames = $util.emptyArray;
+
+ /**
+ * Creates a new TensorAnnotation instance using the specified properties.
+ * @function create
+ * @memberof onnx.TensorAnnotation
+ * @static
+ * @param {onnx.ITensorAnnotation=} [properties] Properties to set
+ * @returns {onnx.TensorAnnotation} TensorAnnotation instance
+ */
+ TensorAnnotation.create = function create(properties) {
+ return new TensorAnnotation(properties);
+ };
+
+ /**
+ * Encodes the specified TensorAnnotation message. Does not implicitly {@link onnx.TensorAnnotation.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TensorAnnotation
+ * @static
+ * @param {onnx.ITensorAnnotation} message TensorAnnotation message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ TensorAnnotation.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.tensorName != null && Object.hasOwnProperty.call(message, "tensorName"))
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.tensorName);
+ if (message.quantParameterTensorNames != null && message.quantParameterTensorNames.length)
+ for (var i = 0; i < message.quantParameterTensorNames.length; ++i)
+ $root.onnx.StringStringEntryProto.encode(message.quantParameterTensorNames[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified TensorAnnotation message, length delimited. Does not implicitly {@link onnx.TensorAnnotation.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TensorAnnotation
+ * @static
+ * @param {onnx.ITensorAnnotation} message TensorAnnotation message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ TensorAnnotation.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a TensorAnnotation message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TensorAnnotation
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TensorAnnotation} TensorAnnotation
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ TensorAnnotation.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TensorAnnotation();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.tensorName = reader.string();
+ break;
+ }
+ case 2: {
+ if (!(message.quantParameterTensorNames && message.quantParameterTensorNames.length))
+ message.quantParameterTensorNames = [];
+ message.quantParameterTensorNames.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a TensorAnnotation message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TensorAnnotation
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TensorAnnotation} TensorAnnotation
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ TensorAnnotation.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a TensorAnnotation message.
+ * @function verify
+ * @memberof onnx.TensorAnnotation
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ TensorAnnotation.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.tensorName != null && message.hasOwnProperty("tensorName"))
+ if (!$util.isString(message.tensorName))
+ return "tensorName: string expected";
+ if (message.quantParameterTensorNames != null && message.hasOwnProperty("quantParameterTensorNames")) {
+ if (!Array.isArray(message.quantParameterTensorNames))
+ return "quantParameterTensorNames: array expected";
+ for (var i = 0; i < message.quantParameterTensorNames.length; ++i) {
+ var error = $root.onnx.StringStringEntryProto.verify(message.quantParameterTensorNames[i]);
+ if (error)
+ return "quantParameterTensorNames." + error;
+ }
+ }
+ return null;
+ };
+
+ /**
+ * Creates a TensorAnnotation message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TensorAnnotation
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TensorAnnotation} TensorAnnotation
+ */
+ TensorAnnotation.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TensorAnnotation)
+ return object;
+ var message = new $root.onnx.TensorAnnotation();
+ if (object.tensorName != null)
+ message.tensorName = String(object.tensorName);
+ if (object.quantParameterTensorNames) {
+ if (!Array.isArray(object.quantParameterTensorNames))
+ throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: array expected");
+ message.quantParameterTensorNames = [];
+ for (var i = 0; i < object.quantParameterTensorNames.length; ++i) {
+ if (typeof object.quantParameterTensorNames[i] !== "object")
+ throw TypeError(".onnx.TensorAnnotation.quantParameterTensorNames: object expected");
+ message.quantParameterTensorNames[i] = $root.onnx.StringStringEntryProto.fromObject(object.quantParameterTensorNames[i]);
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a TensorAnnotation message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TensorAnnotation
+ * @static
+ * @param {onnx.TensorAnnotation} message TensorAnnotation
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ TensorAnnotation.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.arrays || options.defaults)
+ object.quantParameterTensorNames = [];
+ if (options.defaults)
+ object.tensorName = "";
+ if (message.tensorName != null && message.hasOwnProperty("tensorName"))
+ object.tensorName = message.tensorName;
+ if (message.quantParameterTensorNames && message.quantParameterTensorNames.length) {
+ object.quantParameterTensorNames = [];
+ for (var j = 0; j < message.quantParameterTensorNames.length; ++j)
+ object.quantParameterTensorNames[j] = $root.onnx.StringStringEntryProto.toObject(message.quantParameterTensorNames[j], options);
+ }
+ return object;
+ };
+
+ /**
+ * Converts this TensorAnnotation to JSON.
+ * @function toJSON
+ * @memberof onnx.TensorAnnotation
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ TensorAnnotation.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for TensorAnnotation
+ * @function getTypeUrl
+ * @memberof onnx.TensorAnnotation
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ TensorAnnotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TensorAnnotation";
+ };
+
+ return TensorAnnotation;
+ })();
+
+ onnx.GraphProto = (function() {
+
+ /**
+ * Properties of a GraphProto.
+ * @memberof onnx
+ * @interface IGraphProto
+ * @property {Array.|null} [node] GraphProto node
+ * @property {string|null} [name] GraphProto name
+ * @property {Array.|null} [initializer] GraphProto initializer
+ * @property {Array.|null} [sparseInitializer] GraphProto sparseInitializer
+ * @property {string|null} [docString] GraphProto docString
+ * @property {Array.|null} [input] GraphProto input
+ * @property {Array.|null} [output] GraphProto output
+ * @property {Array.|null} [valueInfo] GraphProto valueInfo
+ * @property {Array.|null} [quantizationAnnotation] GraphProto quantizationAnnotation
+ */
+
+ /**
+ * Constructs a new GraphProto.
+ * @memberof onnx
+ * @classdesc Represents a GraphProto.
+ * @implements IGraphProto
+ * @constructor
+ * @param {onnx.IGraphProto=} [properties] Properties to set
+ */
+ function GraphProto(properties) {
+ this.node = [];
+ this.initializer = [];
+ this.sparseInitializer = [];
+ this.input = [];
+ this.output = [];
+ this.valueInfo = [];
+ this.quantizationAnnotation = [];
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * GraphProto node.
+ * @member {Array.} node
+ * @memberof onnx.GraphProto
+ * @instance
+ */
+ GraphProto.prototype.node = $util.emptyArray;
+
+ /**
+ * GraphProto name.
+ * @member {string} name
+ * @memberof onnx.GraphProto
+ * @instance
+ */
+ GraphProto.prototype.name = "";
+
+ /**
+ * GraphProto initializer.
+ * @member {Array.} initializer
+ * @memberof onnx.GraphProto
+ * @instance
+ */
+ GraphProto.prototype.initializer = $util.emptyArray;
+
+ /**
+ * GraphProto sparseInitializer.
+ * @member {Array.} sparseInitializer
+ * @memberof onnx.GraphProto
+ * @instance
+ */
+ GraphProto.prototype.sparseInitializer = $util.emptyArray;
+
+ /**
+ * GraphProto docString.
+ * @member {string} docString
+ * @memberof onnx.GraphProto
+ * @instance
+ */
+ GraphProto.prototype.docString = "";
+
+ /**
+ * GraphProto input.
+ * @member {Array.} input
+ * @memberof onnx.GraphProto
+ * @instance
+ */
+ GraphProto.prototype.input = $util.emptyArray;
+
+ /**
+ * GraphProto output.
+ * @member {Array.} output
+ * @memberof onnx.GraphProto
+ * @instance
+ */
+ GraphProto.prototype.output = $util.emptyArray;
+
+ /**
+ * GraphProto valueInfo.
+ * @member {Array.} valueInfo
+ * @memberof onnx.GraphProto
+ * @instance
+ */
+ GraphProto.prototype.valueInfo = $util.emptyArray;
+
+ /**
+ * GraphProto quantizationAnnotation.
+ * @member {Array.} quantizationAnnotation
+ * @memberof onnx.GraphProto
+ * @instance
+ */
+ GraphProto.prototype.quantizationAnnotation = $util.emptyArray;
+
+ /**
+ * Creates a new GraphProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.GraphProto
+ * @static
+ * @param {onnx.IGraphProto=} [properties] Properties to set
+ * @returns {onnx.GraphProto} GraphProto instance
+ */
+ GraphProto.create = function create(properties) {
+ return new GraphProto(properties);
+ };
+
+ /**
+ * Encodes the specified GraphProto message. Does not implicitly {@link onnx.GraphProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.GraphProto
+ * @static
+ * @param {onnx.IGraphProto} message GraphProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ GraphProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.node != null && message.node.length)
+ for (var i = 0; i < message.node.length; ++i)
+ $root.onnx.NodeProto.encode(message.node[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
+ if (message.name != null && Object.hasOwnProperty.call(message, "name"))
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.name);
+ if (message.initializer != null && message.initializer.length)
+ for (var i = 0; i < message.initializer.length; ++i)
+ $root.onnx.TensorProto.encode(message.initializer[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
+ if (message.docString != null && Object.hasOwnProperty.call(message, "docString"))
+ writer.uint32(/* id 10, wireType 2 =*/82).string(message.docString);
+ if (message.input != null && message.input.length)
+ for (var i = 0; i < message.input.length; ++i)
+ $root.onnx.ValueInfoProto.encode(message.input[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim();
+ if (message.output != null && message.output.length)
+ for (var i = 0; i < message.output.length; ++i)
+ $root.onnx.ValueInfoProto.encode(message.output[i], writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim();
+ if (message.valueInfo != null && message.valueInfo.length)
+ for (var i = 0; i < message.valueInfo.length; ++i)
+ $root.onnx.ValueInfoProto.encode(message.valueInfo[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim();
+ if (message.quantizationAnnotation != null && message.quantizationAnnotation.length)
+ for (var i = 0; i < message.quantizationAnnotation.length; ++i)
+ $root.onnx.TensorAnnotation.encode(message.quantizationAnnotation[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim();
+ if (message.sparseInitializer != null && message.sparseInitializer.length)
+ for (var i = 0; i < message.sparseInitializer.length; ++i)
+ $root.onnx.SparseTensorProto.encode(message.sparseInitializer[i], writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified GraphProto message, length delimited. Does not implicitly {@link onnx.GraphProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.GraphProto
+ * @static
+ * @param {onnx.IGraphProto} message GraphProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ GraphProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a GraphProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.GraphProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.GraphProto} GraphProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ GraphProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.GraphProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (!(message.node && message.node.length))
+ message.node = [];
+ message.node.push($root.onnx.NodeProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 2: {
+ message.name = reader.string();
+ break;
+ }
+ case 5: {
+ if (!(message.initializer && message.initializer.length))
+ message.initializer = [];
+ message.initializer.push($root.onnx.TensorProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 15: {
+ if (!(message.sparseInitializer && message.sparseInitializer.length))
+ message.sparseInitializer = [];
+ message.sparseInitializer.push($root.onnx.SparseTensorProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 10: {
+ message.docString = reader.string();
+ break;
+ }
+ case 11: {
+ if (!(message.input && message.input.length))
+ message.input = [];
+ message.input.push($root.onnx.ValueInfoProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 12: {
+ if (!(message.output && message.output.length))
+ message.output = [];
+ message.output.push($root.onnx.ValueInfoProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 13: {
+ if (!(message.valueInfo && message.valueInfo.length))
+ message.valueInfo = [];
+ message.valueInfo.push($root.onnx.ValueInfoProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 14: {
+ if (!(message.quantizationAnnotation && message.quantizationAnnotation.length))
+ message.quantizationAnnotation = [];
+ message.quantizationAnnotation.push($root.onnx.TensorAnnotation.decode(reader, reader.uint32()));
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a GraphProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.GraphProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.GraphProto} GraphProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ GraphProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a GraphProto message.
+ * @function verify
+ * @memberof onnx.GraphProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ GraphProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.node != null && message.hasOwnProperty("node")) {
+ if (!Array.isArray(message.node))
+ return "node: array expected";
+ for (var i = 0; i < message.node.length; ++i) {
+ var error = $root.onnx.NodeProto.verify(message.node[i]);
+ if (error)
+ return "node." + error;
+ }
+ }
+ if (message.name != null && message.hasOwnProperty("name"))
+ if (!$util.isString(message.name))
+ return "name: string expected";
+ if (message.initializer != null && message.hasOwnProperty("initializer")) {
+ if (!Array.isArray(message.initializer))
+ return "initializer: array expected";
+ for (var i = 0; i < message.initializer.length; ++i) {
+ var error = $root.onnx.TensorProto.verify(message.initializer[i]);
+ if (error)
+ return "initializer." + error;
+ }
+ }
+ if (message.sparseInitializer != null && message.hasOwnProperty("sparseInitializer")) {
+ if (!Array.isArray(message.sparseInitializer))
+ return "sparseInitializer: array expected";
+ for (var i = 0; i < message.sparseInitializer.length; ++i) {
+ var error = $root.onnx.SparseTensorProto.verify(message.sparseInitializer[i]);
+ if (error)
+ return "sparseInitializer." + error;
+ }
+ }
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ if (!$util.isString(message.docString))
+ return "docString: string expected";
+ if (message.input != null && message.hasOwnProperty("input")) {
+ if (!Array.isArray(message.input))
+ return "input: array expected";
+ for (var i = 0; i < message.input.length; ++i) {
+ var error = $root.onnx.ValueInfoProto.verify(message.input[i]);
+ if (error)
+ return "input." + error;
+ }
+ }
+ if (message.output != null && message.hasOwnProperty("output")) {
+ if (!Array.isArray(message.output))
+ return "output: array expected";
+ for (var i = 0; i < message.output.length; ++i) {
+ var error = $root.onnx.ValueInfoProto.verify(message.output[i]);
+ if (error)
+ return "output." + error;
+ }
+ }
+ if (message.valueInfo != null && message.hasOwnProperty("valueInfo")) {
+ if (!Array.isArray(message.valueInfo))
+ return "valueInfo: array expected";
+ for (var i = 0; i < message.valueInfo.length; ++i) {
+ var error = $root.onnx.ValueInfoProto.verify(message.valueInfo[i]);
+ if (error)
+ return "valueInfo." + error;
+ }
+ }
+ if (message.quantizationAnnotation != null && message.hasOwnProperty("quantizationAnnotation")) {
+ if (!Array.isArray(message.quantizationAnnotation))
+ return "quantizationAnnotation: array expected";
+ for (var i = 0; i < message.quantizationAnnotation.length; ++i) {
+ var error = $root.onnx.TensorAnnotation.verify(message.quantizationAnnotation[i]);
+ if (error)
+ return "quantizationAnnotation." + error;
+ }
+ }
+ return null;
+ };
+
+ /**
+ * Creates a GraphProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.GraphProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.GraphProto} GraphProto
+ */
+ GraphProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.GraphProto)
+ return object;
+ var message = new $root.onnx.GraphProto();
+ if (object.node) {
+ if (!Array.isArray(object.node))
+ throw TypeError(".onnx.GraphProto.node: array expected");
+ message.node = [];
+ for (var i = 0; i < object.node.length; ++i) {
+ if (typeof object.node[i] !== "object")
+ throw TypeError(".onnx.GraphProto.node: object expected");
+ message.node[i] = $root.onnx.NodeProto.fromObject(object.node[i]);
+ }
+ }
+ if (object.name != null)
+ message.name = String(object.name);
+ if (object.initializer) {
+ if (!Array.isArray(object.initializer))
+ throw TypeError(".onnx.GraphProto.initializer: array expected");
+ message.initializer = [];
+ for (var i = 0; i < object.initializer.length; ++i) {
+ if (typeof object.initializer[i] !== "object")
+ throw TypeError(".onnx.GraphProto.initializer: object expected");
+ message.initializer[i] = $root.onnx.TensorProto.fromObject(object.initializer[i]);
+ }
+ }
+ if (object.sparseInitializer) {
+ if (!Array.isArray(object.sparseInitializer))
+ throw TypeError(".onnx.GraphProto.sparseInitializer: array expected");
+ message.sparseInitializer = [];
+ for (var i = 0; i < object.sparseInitializer.length; ++i) {
+ if (typeof object.sparseInitializer[i] !== "object")
+ throw TypeError(".onnx.GraphProto.sparseInitializer: object expected");
+ message.sparseInitializer[i] = $root.onnx.SparseTensorProto.fromObject(object.sparseInitializer[i]);
+ }
+ }
+ if (object.docString != null)
+ message.docString = String(object.docString);
+ if (object.input) {
+ if (!Array.isArray(object.input))
+ throw TypeError(".onnx.GraphProto.input: array expected");
+ message.input = [];
+ for (var i = 0; i < object.input.length; ++i) {
+ if (typeof object.input[i] !== "object")
+ throw TypeError(".onnx.GraphProto.input: object expected");
+ message.input[i] = $root.onnx.ValueInfoProto.fromObject(object.input[i]);
+ }
+ }
+ if (object.output) {
+ if (!Array.isArray(object.output))
+ throw TypeError(".onnx.GraphProto.output: array expected");
+ message.output = [];
+ for (var i = 0; i < object.output.length; ++i) {
+ if (typeof object.output[i] !== "object")
+ throw TypeError(".onnx.GraphProto.output: object expected");
+ message.output[i] = $root.onnx.ValueInfoProto.fromObject(object.output[i]);
+ }
+ }
+ if (object.valueInfo) {
+ if (!Array.isArray(object.valueInfo))
+ throw TypeError(".onnx.GraphProto.valueInfo: array expected");
+ message.valueInfo = [];
+ for (var i = 0; i < object.valueInfo.length; ++i) {
+ if (typeof object.valueInfo[i] !== "object")
+ throw TypeError(".onnx.GraphProto.valueInfo: object expected");
+ message.valueInfo[i] = $root.onnx.ValueInfoProto.fromObject(object.valueInfo[i]);
+ }
+ }
+ if (object.quantizationAnnotation) {
+ if (!Array.isArray(object.quantizationAnnotation))
+ throw TypeError(".onnx.GraphProto.quantizationAnnotation: array expected");
+ message.quantizationAnnotation = [];
+ for (var i = 0; i < object.quantizationAnnotation.length; ++i) {
+ if (typeof object.quantizationAnnotation[i] !== "object")
+ throw TypeError(".onnx.GraphProto.quantizationAnnotation: object expected");
+ message.quantizationAnnotation[i] = $root.onnx.TensorAnnotation.fromObject(object.quantizationAnnotation[i]);
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a GraphProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.GraphProto
+ * @static
+ * @param {onnx.GraphProto} message GraphProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ GraphProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.arrays || options.defaults) {
+ object.node = [];
+ object.initializer = [];
+ object.input = [];
+ object.output = [];
+ object.valueInfo = [];
+ object.quantizationAnnotation = [];
+ object.sparseInitializer = [];
+ }
+ if (options.defaults) {
+ object.name = "";
+ object.docString = "";
+ }
+ if (message.node && message.node.length) {
+ object.node = [];
+ for (var j = 0; j < message.node.length; ++j)
+ object.node[j] = $root.onnx.NodeProto.toObject(message.node[j], options);
+ }
+ if (message.name != null && message.hasOwnProperty("name"))
+ object.name = message.name;
+ if (message.initializer && message.initializer.length) {
+ object.initializer = [];
+ for (var j = 0; j < message.initializer.length; ++j)
+ object.initializer[j] = $root.onnx.TensorProto.toObject(message.initializer[j], options);
+ }
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ object.docString = message.docString;
+ if (message.input && message.input.length) {
+ object.input = [];
+ for (var j = 0; j < message.input.length; ++j)
+ object.input[j] = $root.onnx.ValueInfoProto.toObject(message.input[j], options);
+ }
+ if (message.output && message.output.length) {
+ object.output = [];
+ for (var j = 0; j < message.output.length; ++j)
+ object.output[j] = $root.onnx.ValueInfoProto.toObject(message.output[j], options);
+ }
+ if (message.valueInfo && message.valueInfo.length) {
+ object.valueInfo = [];
+ for (var j = 0; j < message.valueInfo.length; ++j)
+ object.valueInfo[j] = $root.onnx.ValueInfoProto.toObject(message.valueInfo[j], options);
+ }
+ if (message.quantizationAnnotation && message.quantizationAnnotation.length) {
+ object.quantizationAnnotation = [];
+ for (var j = 0; j < message.quantizationAnnotation.length; ++j)
+ object.quantizationAnnotation[j] = $root.onnx.TensorAnnotation.toObject(message.quantizationAnnotation[j], options);
+ }
+ if (message.sparseInitializer && message.sparseInitializer.length) {
+ object.sparseInitializer = [];
+ for (var j = 0; j < message.sparseInitializer.length; ++j)
+ object.sparseInitializer[j] = $root.onnx.SparseTensorProto.toObject(message.sparseInitializer[j], options);
+ }
+ return object;
+ };
+
+ /**
+ * Converts this GraphProto to JSON.
+ * @function toJSON
+ * @memberof onnx.GraphProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ GraphProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for GraphProto
+ * @function getTypeUrl
+ * @memberof onnx.GraphProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ GraphProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.GraphProto";
+ };
+
+ return GraphProto;
+ })();
+
+ onnx.TensorProto = (function() {
+
+ /**
+ * Properties of a TensorProto.
+ * @memberof onnx
+ * @interface ITensorProto
+ * @property {Array.|null} [dims] TensorProto dims
+ * @property {number|null} [dataType] TensorProto dataType
+ * @property {onnx.TensorProto.ISegment|null} [segment] TensorProto segment
+ * @property {Array.|null} [floatData] TensorProto floatData
+ * @property {Array.|null} [int32Data] TensorProto int32Data
+ * @property {Array.|null} [stringData] TensorProto stringData
+ * @property {Array.|null} [int64Data] TensorProto int64Data
+ * @property {string|null} [name] TensorProto name
+ * @property {string|null} [docString] TensorProto docString
+ * @property {Uint8Array|null} [rawData] TensorProto rawData
+ * @property {Array.|null} [externalData] TensorProto externalData
+ * @property {onnx.TensorProto.DataLocation|null} [dataLocation] TensorProto dataLocation
+ * @property {Array.|null} [doubleData] TensorProto doubleData
+ * @property {Array.|null} [uint64Data] TensorProto uint64Data
+ */
+
+ /**
+ * Constructs a new TensorProto.
+ * @memberof onnx
+ * @classdesc Represents a TensorProto.
+ * @implements ITensorProto
+ * @constructor
+ * @param {onnx.ITensorProto=} [properties] Properties to set
+ */
+ function TensorProto(properties) {
+ this.dims = [];
+ this.floatData = [];
+ this.int32Data = [];
+ this.stringData = [];
+ this.int64Data = [];
+ this.externalData = [];
+ this.doubleData = [];
+ this.uint64Data = [];
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * TensorProto dims.
+ * @member {Array.} dims
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.dims = $util.emptyArray;
+
+ /**
+ * TensorProto dataType.
+ * @member {number} dataType
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.dataType = 0;
+
+ /**
+ * TensorProto segment.
+ * @member {onnx.TensorProto.ISegment|null|undefined} segment
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.segment = null;
+
+ /**
+ * TensorProto floatData.
+ * @member {Array.} floatData
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.floatData = $util.emptyArray;
+
+ /**
+ * TensorProto int32Data.
+ * @member {Array.} int32Data
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.int32Data = $util.emptyArray;
+
+ /**
+ * TensorProto stringData.
+ * @member {Array.} stringData
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.stringData = $util.emptyArray;
+
+ /**
+ * TensorProto int64Data.
+ * @member {Array.} int64Data
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.int64Data = $util.emptyArray;
+
+ /**
+ * TensorProto name.
+ * @member {string} name
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.name = "";
+
+ /**
+ * TensorProto docString.
+ * @member {string} docString
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.docString = "";
+
+ /**
+ * TensorProto rawData.
+ * @member {Uint8Array} rawData
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.rawData = $util.newBuffer([]);
+
+ /**
+ * TensorProto externalData.
+ * @member {Array.} externalData
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.externalData = $util.emptyArray;
+
+ /**
+ * TensorProto dataLocation.
+ * @member {onnx.TensorProto.DataLocation} dataLocation
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.dataLocation = 0;
+
+ /**
+ * TensorProto doubleData.
+ * @member {Array.} doubleData
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.doubleData = $util.emptyArray;
+
+ /**
+ * TensorProto uint64Data.
+ * @member {Array.} uint64Data
+ * @memberof onnx.TensorProto
+ * @instance
+ */
+ TensorProto.prototype.uint64Data = $util.emptyArray;
+
+ /**
+ * Creates a new TensorProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.TensorProto
+ * @static
+ * @param {onnx.ITensorProto=} [properties] Properties to set
+ * @returns {onnx.TensorProto} TensorProto instance
+ */
+ TensorProto.create = function create(properties) {
+ return new TensorProto(properties);
+ };
+
+ /**
+ * Encodes the specified TensorProto message. Does not implicitly {@link onnx.TensorProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TensorProto
+ * @static
+ * @param {onnx.ITensorProto} message TensorProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ TensorProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.dims != null && message.dims.length) {
+ writer.uint32(/* id 1, wireType 2 =*/10).fork();
+ for (var i = 0; i < message.dims.length; ++i)
+ writer.int64(message.dims[i]);
+ writer.ldelim();
+ }
+ if (message.dataType != null && Object.hasOwnProperty.call(message, "dataType"))
+ writer.uint32(/* id 2, wireType 0 =*/16).int32(message.dataType);
+ if (message.segment != null && Object.hasOwnProperty.call(message, "segment"))
+ $root.onnx.TensorProto.Segment.encode(message.segment, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
+ if (message.floatData != null && message.floatData.length) {
+ writer.uint32(/* id 4, wireType 2 =*/34).fork();
+ for (var i = 0; i < message.floatData.length; ++i)
+ writer.float(message.floatData[i]);
+ writer.ldelim();
+ }
+ if (message.int32Data != null && message.int32Data.length) {
+ writer.uint32(/* id 5, wireType 2 =*/42).fork();
+ for (var i = 0; i < message.int32Data.length; ++i)
+ writer.int32(message.int32Data[i]);
+ writer.ldelim();
+ }
+ if (message.stringData != null && message.stringData.length)
+ for (var i = 0; i < message.stringData.length; ++i)
+ writer.uint32(/* id 6, wireType 2 =*/50).bytes(message.stringData[i]);
+ if (message.int64Data != null && message.int64Data.length) {
+ writer.uint32(/* id 7, wireType 2 =*/58).fork();
+ for (var i = 0; i < message.int64Data.length; ++i)
+ writer.int64(message.int64Data[i]);
+ writer.ldelim();
+ }
+ if (message.name != null && Object.hasOwnProperty.call(message, "name"))
+ writer.uint32(/* id 8, wireType 2 =*/66).string(message.name);
+ if (message.rawData != null && Object.hasOwnProperty.call(message, "rawData"))
+ writer.uint32(/* id 9, wireType 2 =*/74).bytes(message.rawData);
+ if (message.doubleData != null && message.doubleData.length) {
+ writer.uint32(/* id 10, wireType 2 =*/82).fork();
+ for (var i = 0; i < message.doubleData.length; ++i)
+ writer.double(message.doubleData[i]);
+ writer.ldelim();
+ }
+ if (message.uint64Data != null && message.uint64Data.length) {
+ writer.uint32(/* id 11, wireType 2 =*/90).fork();
+ for (var i = 0; i < message.uint64Data.length; ++i)
+ writer.uint64(message.uint64Data[i]);
+ writer.ldelim();
+ }
+ if (message.docString != null && Object.hasOwnProperty.call(message, "docString"))
+ writer.uint32(/* id 12, wireType 2 =*/98).string(message.docString);
+ if (message.externalData != null && message.externalData.length)
+ for (var i = 0; i < message.externalData.length; ++i)
+ $root.onnx.StringStringEntryProto.encode(message.externalData[i], writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim();
+ if (message.dataLocation != null && Object.hasOwnProperty.call(message, "dataLocation"))
+ writer.uint32(/* id 14, wireType 0 =*/112).int32(message.dataLocation);
+ return writer;
+ };
+
+ /**
+ * Encodes the specified TensorProto message, length delimited. Does not implicitly {@link onnx.TensorProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TensorProto
+ * @static
+ * @param {onnx.ITensorProto} message TensorProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ TensorProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a TensorProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TensorProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TensorProto} TensorProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ TensorProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TensorProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (!(message.dims && message.dims.length))
+ message.dims = [];
+ if ((tag & 7) === 2) {
+ var end2 = reader.uint32() + reader.pos;
+ while (reader.pos < end2)
+ message.dims.push(reader.int64());
+ } else
+ message.dims.push(reader.int64());
+ break;
+ }
+ case 2: {
+ message.dataType = reader.int32();
+ break;
+ }
+ case 3: {
+ message.segment = $root.onnx.TensorProto.Segment.decode(reader, reader.uint32());
+ break;
+ }
+ case 4: {
+ if (!(message.floatData && message.floatData.length))
+ message.floatData = [];
+ if ((tag & 7) === 2) {
+ var end2 = reader.uint32() + reader.pos;
+ while (reader.pos < end2)
+ message.floatData.push(reader.float());
+ } else
+ message.floatData.push(reader.float());
+ break;
+ }
+ case 5: {
+ if (!(message.int32Data && message.int32Data.length))
+ message.int32Data = [];
+ if ((tag & 7) === 2) {
+ var end2 = reader.uint32() + reader.pos;
+ while (reader.pos < end2)
+ message.int32Data.push(reader.int32());
+ } else
+ message.int32Data.push(reader.int32());
+ break;
+ }
+ case 6: {
+ if (!(message.stringData && message.stringData.length))
+ message.stringData = [];
+ message.stringData.push(reader.bytes());
+ break;
+ }
+ case 7: {
+ if (!(message.int64Data && message.int64Data.length))
+ message.int64Data = [];
+ if ((tag & 7) === 2) {
+ var end2 = reader.uint32() + reader.pos;
+ while (reader.pos < end2)
+ message.int64Data.push(reader.int64());
+ } else
+ message.int64Data.push(reader.int64());
+ break;
+ }
+ case 8: {
+ message.name = reader.string();
+ break;
+ }
+ case 12: {
+ message.docString = reader.string();
+ break;
+ }
+ case 9: {
+ message.rawData = reader.bytes();
+ break;
+ }
+ case 13: {
+ if (!(message.externalData && message.externalData.length))
+ message.externalData = [];
+ message.externalData.push($root.onnx.StringStringEntryProto.decode(reader, reader.uint32()));
+ break;
+ }
+ case 14: {
+ message.dataLocation = reader.int32();
+ break;
+ }
+ case 10: {
+ if (!(message.doubleData && message.doubleData.length))
+ message.doubleData = [];
+ if ((tag & 7) === 2) {
+ var end2 = reader.uint32() + reader.pos;
+ while (reader.pos < end2)
+ message.doubleData.push(reader.double());
+ } else
+ message.doubleData.push(reader.double());
+ break;
+ }
+ case 11: {
+ if (!(message.uint64Data && message.uint64Data.length))
+ message.uint64Data = [];
+ if ((tag & 7) === 2) {
+ var end2 = reader.uint32() + reader.pos;
+ while (reader.pos < end2)
+ message.uint64Data.push(reader.uint64());
+ } else
+ message.uint64Data.push(reader.uint64());
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a TensorProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TensorProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TensorProto} TensorProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ TensorProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a TensorProto message.
+ * @function verify
+ * @memberof onnx.TensorProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ TensorProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.dims != null && message.hasOwnProperty("dims")) {
+ if (!Array.isArray(message.dims))
+ return "dims: array expected";
+ for (var i = 0; i < message.dims.length; ++i)
+ if (!$util.isInteger(message.dims[i]) && !(message.dims[i] && $util.isInteger(message.dims[i].low) && $util.isInteger(message.dims[i].high)))
+ return "dims: integer|Long[] expected";
+ }
+ if (message.dataType != null && message.hasOwnProperty("dataType"))
+ if (!$util.isInteger(message.dataType))
+ return "dataType: integer expected";
+ if (message.segment != null && message.hasOwnProperty("segment")) {
+ var error = $root.onnx.TensorProto.Segment.verify(message.segment);
+ if (error)
+ return "segment." + error;
+ }
+ if (message.floatData != null && message.hasOwnProperty("floatData")) {
+ if (!Array.isArray(message.floatData))
+ return "floatData: array expected";
+ for (var i = 0; i < message.floatData.length; ++i)
+ if (typeof message.floatData[i] !== "number")
+ return "floatData: number[] expected";
+ }
+ if (message.int32Data != null && message.hasOwnProperty("int32Data")) {
+ if (!Array.isArray(message.int32Data))
+ return "int32Data: array expected";
+ for (var i = 0; i < message.int32Data.length; ++i)
+ if (!$util.isInteger(message.int32Data[i]))
+ return "int32Data: integer[] expected";
+ }
+ if (message.stringData != null && message.hasOwnProperty("stringData")) {
+ if (!Array.isArray(message.stringData))
+ return "stringData: array expected";
+ for (var i = 0; i < message.stringData.length; ++i)
+ if (!(message.stringData[i] && typeof message.stringData[i].length === "number" || $util.isString(message.stringData[i])))
+ return "stringData: buffer[] expected";
+ }
+ if (message.int64Data != null && message.hasOwnProperty("int64Data")) {
+ if (!Array.isArray(message.int64Data))
+ return "int64Data: array expected";
+ for (var i = 0; i < message.int64Data.length; ++i)
+ if (!$util.isInteger(message.int64Data[i]) && !(message.int64Data[i] && $util.isInteger(message.int64Data[i].low) && $util.isInteger(message.int64Data[i].high)))
+ return "int64Data: integer|Long[] expected";
+ }
+ if (message.name != null && message.hasOwnProperty("name"))
+ if (!$util.isString(message.name))
+ return "name: string expected";
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ if (!$util.isString(message.docString))
+ return "docString: string expected";
+ if (message.rawData != null && message.hasOwnProperty("rawData"))
+ if (!(message.rawData && typeof message.rawData.length === "number" || $util.isString(message.rawData)))
+ return "rawData: buffer expected";
+ if (message.externalData != null && message.hasOwnProperty("externalData")) {
+ if (!Array.isArray(message.externalData))
+ return "externalData: array expected";
+ for (var i = 0; i < message.externalData.length; ++i) {
+ var error = $root.onnx.StringStringEntryProto.verify(message.externalData[i]);
+ if (error)
+ return "externalData." + error;
+ }
+ }
+ if (message.dataLocation != null && message.hasOwnProperty("dataLocation"))
+ switch (message.dataLocation) {
+ default:
+ return "dataLocation: enum value expected";
+ case 0:
+ case 1:
+ break;
+ }
+ if (message.doubleData != null && message.hasOwnProperty("doubleData")) {
+ if (!Array.isArray(message.doubleData))
+ return "doubleData: array expected";
+ for (var i = 0; i < message.doubleData.length; ++i)
+ if (typeof message.doubleData[i] !== "number")
+ return "doubleData: number[] expected";
+ }
+ if (message.uint64Data != null && message.hasOwnProperty("uint64Data")) {
+ if (!Array.isArray(message.uint64Data))
+ return "uint64Data: array expected";
+ for (var i = 0; i < message.uint64Data.length; ++i)
+ if (!$util.isInteger(message.uint64Data[i]) && !(message.uint64Data[i] && $util.isInteger(message.uint64Data[i].low) && $util.isInteger(message.uint64Data[i].high)))
+ return "uint64Data: integer|Long[] expected";
+ }
+ return null;
+ };
+
+ /**
+ * Creates a TensorProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TensorProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TensorProto} TensorProto
+ */
+ TensorProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TensorProto)
+ return object;
+ var message = new $root.onnx.TensorProto();
+ if (object.dims) {
+ if (!Array.isArray(object.dims))
+ throw TypeError(".onnx.TensorProto.dims: array expected");
+ message.dims = [];
+ for (var i = 0; i < object.dims.length; ++i)
+ if ($util.Long)
+ (message.dims[i] = $util.Long.fromValue(object.dims[i])).unsigned = false;
+ else if (typeof object.dims[i] === "string")
+ message.dims[i] = parseInt(object.dims[i], 10);
+ else if (typeof object.dims[i] === "number")
+ message.dims[i] = object.dims[i];
+ else if (typeof object.dims[i] === "object")
+ message.dims[i] = new $util.LongBits(object.dims[i].low >>> 0, object.dims[i].high >>> 0).toNumber();
+ }
+ if (object.dataType != null)
+ message.dataType = object.dataType | 0;
+ if (object.segment != null) {
+ if (typeof object.segment !== "object")
+ throw TypeError(".onnx.TensorProto.segment: object expected");
+ message.segment = $root.onnx.TensorProto.Segment.fromObject(object.segment);
+ }
+ if (object.floatData) {
+ if (!Array.isArray(object.floatData))
+ throw TypeError(".onnx.TensorProto.floatData: array expected");
+ message.floatData = [];
+ for (var i = 0; i < object.floatData.length; ++i)
+ message.floatData[i] = Number(object.floatData[i]);
+ }
+ if (object.int32Data) {
+ if (!Array.isArray(object.int32Data))
+ throw TypeError(".onnx.TensorProto.int32Data: array expected");
+ message.int32Data = [];
+ for (var i = 0; i < object.int32Data.length; ++i)
+ message.int32Data[i] = object.int32Data[i] | 0;
+ }
+ if (object.stringData) {
+ if (!Array.isArray(object.stringData))
+ throw TypeError(".onnx.TensorProto.stringData: array expected");
+ message.stringData = [];
+ for (var i = 0; i < object.stringData.length; ++i)
+ if (typeof object.stringData[i] === "string")
+ $util.base64.decode(object.stringData[i], message.stringData[i] = $util.newBuffer($util.base64.length(object.stringData[i])), 0);
+ else if (object.stringData[i].length >= 0)
+ message.stringData[i] = object.stringData[i];
+ }
+ if (object.int64Data) {
+ if (!Array.isArray(object.int64Data))
+ throw TypeError(".onnx.TensorProto.int64Data: array expected");
+ message.int64Data = [];
+ for (var i = 0; i < object.int64Data.length; ++i)
+ if ($util.Long)
+ (message.int64Data[i] = $util.Long.fromValue(object.int64Data[i])).unsigned = false;
+ else if (typeof object.int64Data[i] === "string")
+ message.int64Data[i] = parseInt(object.int64Data[i], 10);
+ else if (typeof object.int64Data[i] === "number")
+ message.int64Data[i] = object.int64Data[i];
+ else if (typeof object.int64Data[i] === "object")
+ message.int64Data[i] = new $util.LongBits(object.int64Data[i].low >>> 0, object.int64Data[i].high >>> 0).toNumber();
+ }
+ if (object.name != null)
+ message.name = String(object.name);
+ if (object.docString != null)
+ message.docString = String(object.docString);
+ if (object.rawData != null)
+ if (typeof object.rawData === "string")
+ $util.base64.decode(object.rawData, message.rawData = $util.newBuffer($util.base64.length(object.rawData)), 0);
+ else if (object.rawData.length >= 0)
+ message.rawData = object.rawData;
+ if (object.externalData) {
+ if (!Array.isArray(object.externalData))
+ throw TypeError(".onnx.TensorProto.externalData: array expected");
+ message.externalData = [];
+ for (var i = 0; i < object.externalData.length; ++i) {
+ if (typeof object.externalData[i] !== "object")
+ throw TypeError(".onnx.TensorProto.externalData: object expected");
+ message.externalData[i] = $root.onnx.StringStringEntryProto.fromObject(object.externalData[i]);
+ }
+ }
+ switch (object.dataLocation) {
+ default:
+ if (typeof object.dataLocation === "number") {
+ message.dataLocation = object.dataLocation;
+ break;
+ }
+ break;
+ case "DEFAULT":
+ case 0:
+ message.dataLocation = 0;
+ break;
+ case "EXTERNAL":
+ case 1:
+ message.dataLocation = 1;
+ break;
+ }
+ if (object.doubleData) {
+ if (!Array.isArray(object.doubleData))
+ throw TypeError(".onnx.TensorProto.doubleData: array expected");
+ message.doubleData = [];
+ for (var i = 0; i < object.doubleData.length; ++i)
+ message.doubleData[i] = Number(object.doubleData[i]);
+ }
+ if (object.uint64Data) {
+ if (!Array.isArray(object.uint64Data))
+ throw TypeError(".onnx.TensorProto.uint64Data: array expected");
+ message.uint64Data = [];
+ for (var i = 0; i < object.uint64Data.length; ++i)
+ if ($util.Long)
+ (message.uint64Data[i] = $util.Long.fromValue(object.uint64Data[i])).unsigned = true;
+ else if (typeof object.uint64Data[i] === "string")
+ message.uint64Data[i] = parseInt(object.uint64Data[i], 10);
+ else if (typeof object.uint64Data[i] === "number")
+ message.uint64Data[i] = object.uint64Data[i];
+ else if (typeof object.uint64Data[i] === "object")
+ message.uint64Data[i] = new $util.LongBits(object.uint64Data[i].low >>> 0, object.uint64Data[i].high >>> 0).toNumber(true);
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a TensorProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TensorProto
+ * @static
+ * @param {onnx.TensorProto} message TensorProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ TensorProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.arrays || options.defaults) {
+ object.dims = [];
+ object.floatData = [];
+ object.int32Data = [];
+ object.stringData = [];
+ object.int64Data = [];
+ object.doubleData = [];
+ object.uint64Data = [];
+ object.externalData = [];
+ }
+ if (options.defaults) {
+ object.dataType = 0;
+ object.segment = null;
+ object.name = "";
+ if (options.bytes === String)
+ object.rawData = "";
+ else {
+ object.rawData = [];
+ if (options.bytes !== Array)
+ object.rawData = $util.newBuffer(object.rawData);
+ }
+ object.docString = "";
+ object.dataLocation = options.enums === String ? "DEFAULT" : 0;
+ }
+ if (message.dims && message.dims.length) {
+ object.dims = [];
+ for (var j = 0; j < message.dims.length; ++j)
+ if (typeof message.dims[j] === "number")
+ object.dims[j] = options.longs === String ? String(message.dims[j]) : message.dims[j];
+ else
+ object.dims[j] = options.longs === String ? $util.Long.prototype.toString.call(message.dims[j]) : options.longs === Number ? new $util.LongBits(message.dims[j].low >>> 0, message.dims[j].high >>> 0).toNumber() : message.dims[j];
+ }
+ if (message.dataType != null && message.hasOwnProperty("dataType"))
+ object.dataType = message.dataType;
+ if (message.segment != null && message.hasOwnProperty("segment"))
+ object.segment = $root.onnx.TensorProto.Segment.toObject(message.segment, options);
+ if (message.floatData && message.floatData.length) {
+ object.floatData = [];
+ for (var j = 0; j < message.floatData.length; ++j)
+ object.floatData[j] = options.json && !isFinite(message.floatData[j]) ? String(message.floatData[j]) : message.floatData[j];
+ }
+ if (message.int32Data && message.int32Data.length) {
+ object.int32Data = [];
+ for (var j = 0; j < message.int32Data.length; ++j)
+ object.int32Data[j] = message.int32Data[j];
+ }
+ if (message.stringData && message.stringData.length) {
+ object.stringData = [];
+ for (var j = 0; j < message.stringData.length; ++j)
+ object.stringData[j] = options.bytes === String ? $util.base64.encode(message.stringData[j], 0, message.stringData[j].length) : options.bytes === Array ? Array.prototype.slice.call(message.stringData[j]) : message.stringData[j];
+ }
+ if (message.int64Data && message.int64Data.length) {
+ object.int64Data = [];
+ for (var j = 0; j < message.int64Data.length; ++j)
+ if (typeof message.int64Data[j] === "number")
+ object.int64Data[j] = options.longs === String ? String(message.int64Data[j]) : message.int64Data[j];
+ else
+ object.int64Data[j] = options.longs === String ? $util.Long.prototype.toString.call(message.int64Data[j]) : options.longs === Number ? new $util.LongBits(message.int64Data[j].low >>> 0, message.int64Data[j].high >>> 0).toNumber() : message.int64Data[j];
+ }
+ if (message.name != null && message.hasOwnProperty("name"))
+ object.name = message.name;
+ if (message.rawData != null && message.hasOwnProperty("rawData"))
+ object.rawData = options.bytes === String ? $util.base64.encode(message.rawData, 0, message.rawData.length) : options.bytes === Array ? Array.prototype.slice.call(message.rawData) : message.rawData;
+ if (message.doubleData && message.doubleData.length) {
+ object.doubleData = [];
+ for (var j = 0; j < message.doubleData.length; ++j)
+ object.doubleData[j] = options.json && !isFinite(message.doubleData[j]) ? String(message.doubleData[j]) : message.doubleData[j];
+ }
+ if (message.uint64Data && message.uint64Data.length) {
+ object.uint64Data = [];
+ for (var j = 0; j < message.uint64Data.length; ++j)
+ if (typeof message.uint64Data[j] === "number")
+ object.uint64Data[j] = options.longs === String ? String(message.uint64Data[j]) : message.uint64Data[j];
+ else
+ object.uint64Data[j] = options.longs === String ? $util.Long.prototype.toString.call(message.uint64Data[j]) : options.longs === Number ? new $util.LongBits(message.uint64Data[j].low >>> 0, message.uint64Data[j].high >>> 0).toNumber(true) : message.uint64Data[j];
+ }
+ if (message.docString != null && message.hasOwnProperty("docString"))
+ object.docString = message.docString;
+ if (message.externalData && message.externalData.length) {
+ object.externalData = [];
+ for (var j = 0; j < message.externalData.length; ++j)
+ object.externalData[j] = $root.onnx.StringStringEntryProto.toObject(message.externalData[j], options);
+ }
+ if (message.dataLocation != null && message.hasOwnProperty("dataLocation"))
+ object.dataLocation = options.enums === String ? $root.onnx.TensorProto.DataLocation[message.dataLocation] === undefined ? message.dataLocation : $root.onnx.TensorProto.DataLocation[message.dataLocation] : message.dataLocation;
+ return object;
+ };
+
+ /**
+ * Converts this TensorProto to JSON.
+ * @function toJSON
+ * @memberof onnx.TensorProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ TensorProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for TensorProto
+ * @function getTypeUrl
+ * @memberof onnx.TensorProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ TensorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TensorProto";
+ };
+
+ /**
+ * DataType enum.
+ * @name onnx.TensorProto.DataType
+ * @enum {number}
+ * @property {number} UNDEFINED=0 UNDEFINED value
+ * @property {number} FLOAT=1 FLOAT value
+ * @property {number} UINT8=2 UINT8 value
+ * @property {number} INT8=3 INT8 value
+ * @property {number} UINT16=4 UINT16 value
+ * @property {number} INT16=5 INT16 value
+ * @property {number} INT32=6 INT32 value
+ * @property {number} INT64=7 INT64 value
+ * @property {number} STRING=8 STRING value
+ * @property {number} BOOL=9 BOOL value
+ * @property {number} FLOAT16=10 FLOAT16 value
+ * @property {number} DOUBLE=11 DOUBLE value
+ * @property {number} UINT32=12 UINT32 value
+ * @property {number} UINT64=13 UINT64 value
+ * @property {number} COMPLEX64=14 COMPLEX64 value
+ * @property {number} COMPLEX128=15 COMPLEX128 value
+ * @property {number} BFLOAT16=16 BFLOAT16 value
+ * @property {number} FLOAT8E4M3FN=17 FLOAT8E4M3FN value
+ * @property {number} FLOAT8E4M3FNUZ=18 FLOAT8E4M3FNUZ value
+ * @property {number} FLOAT8E5M2=19 FLOAT8E5M2 value
+ * @property {number} FLOAT8E5M2FNUZ=20 FLOAT8E5M2FNUZ value
+ */
+ TensorProto.DataType = (function() {
+ var valuesById = {}, values = Object.create(valuesById);
+ values[valuesById[0] = "UNDEFINED"] = 0;
+ values[valuesById[1] = "FLOAT"] = 1;
+ values[valuesById[2] = "UINT8"] = 2;
+ values[valuesById[3] = "INT8"] = 3;
+ values[valuesById[4] = "UINT16"] = 4;
+ values[valuesById[5] = "INT16"] = 5;
+ values[valuesById[6] = "INT32"] = 6;
+ values[valuesById[7] = "INT64"] = 7;
+ values[valuesById[8] = "STRING"] = 8;
+ values[valuesById[9] = "BOOL"] = 9;
+ values[valuesById[10] = "FLOAT16"] = 10;
+ values[valuesById[11] = "DOUBLE"] = 11;
+ values[valuesById[12] = "UINT32"] = 12;
+ values[valuesById[13] = "UINT64"] = 13;
+ values[valuesById[14] = "COMPLEX64"] = 14;
+ values[valuesById[15] = "COMPLEX128"] = 15;
+ values[valuesById[16] = "BFLOAT16"] = 16;
+ values[valuesById[17] = "FLOAT8E4M3FN"] = 17;
+ values[valuesById[18] = "FLOAT8E4M3FNUZ"] = 18;
+ values[valuesById[19] = "FLOAT8E5M2"] = 19;
+ values[valuesById[20] = "FLOAT8E5M2FNUZ"] = 20;
+ return values;
+ })();
+
+ TensorProto.Segment = (function() {
+
+ /**
+ * Properties of a Segment.
+ * @memberof onnx.TensorProto
+ * @interface ISegment
+ * @property {number|Long|null} [begin] Segment begin
+ * @property {number|Long|null} [end] Segment end
+ */
+
+ /**
+ * Constructs a new Segment.
+ * @memberof onnx.TensorProto
+ * @classdesc Represents a Segment.
+ * @implements ISegment
+ * @constructor
+ * @param {onnx.TensorProto.ISegment=} [properties] Properties to set
+ */
+ function Segment(properties) {
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * Segment begin.
+ * @member {number|Long} begin
+ * @memberof onnx.TensorProto.Segment
+ * @instance
+ */
+ Segment.prototype.begin = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
+
+ /**
+ * Segment end.
+ * @member {number|Long} end
+ * @memberof onnx.TensorProto.Segment
+ * @instance
+ */
+ Segment.prototype.end = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
+
+ /**
+ * Creates a new Segment instance using the specified properties.
+ * @function create
+ * @memberof onnx.TensorProto.Segment
+ * @static
+ * @param {onnx.TensorProto.ISegment=} [properties] Properties to set
+ * @returns {onnx.TensorProto.Segment} Segment instance
+ */
+ Segment.create = function create(properties) {
+ return new Segment(properties);
+ };
+
+ /**
+ * Encodes the specified Segment message. Does not implicitly {@link onnx.TensorProto.Segment.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TensorProto.Segment
+ * @static
+ * @param {onnx.TensorProto.ISegment} message Segment message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Segment.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.begin != null && Object.hasOwnProperty.call(message, "begin"))
+ writer.uint32(/* id 1, wireType 0 =*/8).int64(message.begin);
+ if (message.end != null && Object.hasOwnProperty.call(message, "end"))
+ writer.uint32(/* id 2, wireType 0 =*/16).int64(message.end);
+ return writer;
+ };
+
+ /**
+ * Encodes the specified Segment message, length delimited. Does not implicitly {@link onnx.TensorProto.Segment.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TensorProto.Segment
+ * @static
+ * @param {onnx.TensorProto.ISegment} message Segment message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Segment.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a Segment message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TensorProto.Segment
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TensorProto.Segment} Segment
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Segment.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TensorProto.Segment();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.begin = reader.int64();
+ break;
+ }
+ case 2: {
+ message.end = reader.int64();
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a Segment message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TensorProto.Segment
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TensorProto.Segment} Segment
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Segment.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a Segment message.
+ * @function verify
+ * @memberof onnx.TensorProto.Segment
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ Segment.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.begin != null && message.hasOwnProperty("begin"))
+ if (!$util.isInteger(message.begin) && !(message.begin && $util.isInteger(message.begin.low) && $util.isInteger(message.begin.high)))
+ return "begin: integer|Long expected";
+ if (message.end != null && message.hasOwnProperty("end"))
+ if (!$util.isInteger(message.end) && !(message.end && $util.isInteger(message.end.low) && $util.isInteger(message.end.high)))
+ return "end: integer|Long expected";
+ return null;
+ };
+
+ /**
+ * Creates a Segment message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TensorProto.Segment
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TensorProto.Segment} Segment
+ */
+ Segment.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TensorProto.Segment)
+ return object;
+ var message = new $root.onnx.TensorProto.Segment();
+ if (object.begin != null)
+ if ($util.Long)
+ (message.begin = $util.Long.fromValue(object.begin)).unsigned = false;
+ else if (typeof object.begin === "string")
+ message.begin = parseInt(object.begin, 10);
+ else if (typeof object.begin === "number")
+ message.begin = object.begin;
+ else if (typeof object.begin === "object")
+ message.begin = new $util.LongBits(object.begin.low >>> 0, object.begin.high >>> 0).toNumber();
+ if (object.end != null)
+ if ($util.Long)
+ (message.end = $util.Long.fromValue(object.end)).unsigned = false;
+ else if (typeof object.end === "string")
+ message.end = parseInt(object.end, 10);
+ else if (typeof object.end === "number")
+ message.end = object.end;
+ else if (typeof object.end === "object")
+ message.end = new $util.LongBits(object.end.low >>> 0, object.end.high >>> 0).toNumber();
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a Segment message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TensorProto.Segment
+ * @static
+ * @param {onnx.TensorProto.Segment} message Segment
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ Segment.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.defaults) {
+ if ($util.Long) {
+ var long = new $util.Long(0, 0, false);
+ object.begin = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
+ } else
+ object.begin = options.longs === String ? "0" : 0;
+ if ($util.Long) {
+ var long = new $util.Long(0, 0, false);
+ object.end = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
+ } else
+ object.end = options.longs === String ? "0" : 0;
+ }
+ if (message.begin != null && message.hasOwnProperty("begin"))
+ if (typeof message.begin === "number")
+ object.begin = options.longs === String ? String(message.begin) : message.begin;
+ else
+ object.begin = options.longs === String ? $util.Long.prototype.toString.call(message.begin) : options.longs === Number ? new $util.LongBits(message.begin.low >>> 0, message.begin.high >>> 0).toNumber() : message.begin;
+ if (message.end != null && message.hasOwnProperty("end"))
+ if (typeof message.end === "number")
+ object.end = options.longs === String ? String(message.end) : message.end;
+ else
+ object.end = options.longs === String ? $util.Long.prototype.toString.call(message.end) : options.longs === Number ? new $util.LongBits(message.end.low >>> 0, message.end.high >>> 0).toNumber() : message.end;
+ return object;
+ };
+
+ /**
+ * Converts this Segment to JSON.
+ * @function toJSON
+ * @memberof onnx.TensorProto.Segment
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ Segment.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for Segment
+ * @function getTypeUrl
+ * @memberof onnx.TensorProto.Segment
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ Segment.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TensorProto.Segment";
+ };
+
+ return Segment;
+ })();
+
+ /**
+ * DataLocation enum.
+ * @name onnx.TensorProto.DataLocation
+ * @enum {number}
+ * @property {number} DEFAULT=0 DEFAULT value
+ * @property {number} EXTERNAL=1 EXTERNAL value
+ */
+ TensorProto.DataLocation = (function() {
+ var valuesById = {}, values = Object.create(valuesById);
+ values[valuesById[0] = "DEFAULT"] = 0;
+ values[valuesById[1] = "EXTERNAL"] = 1;
+ return values;
+ })();
+
+ return TensorProto;
+ })();
+
+ onnx.SparseTensorProto = (function() {
+
+ /**
+ * Properties of a SparseTensorProto.
+ * @memberof onnx
+ * @interface ISparseTensorProto
+ * @property {onnx.ITensorProto|null} [values] SparseTensorProto values
+ * @property {onnx.ITensorProto|null} [indices] SparseTensorProto indices
+ * @property {Array.|null} [dims] SparseTensorProto dims
+ */
+
+ /**
+ * Constructs a new SparseTensorProto.
+ * @memberof onnx
+ * @classdesc Represents a SparseTensorProto.
+ * @implements ISparseTensorProto
+ * @constructor
+ * @param {onnx.ISparseTensorProto=} [properties] Properties to set
+ */
+ function SparseTensorProto(properties) {
+ this.dims = [];
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * SparseTensorProto values.
+ * @member {onnx.ITensorProto|null|undefined} values
+ * @memberof onnx.SparseTensorProto
+ * @instance
+ */
+ SparseTensorProto.prototype.values = null;
+
+ /**
+ * SparseTensorProto indices.
+ * @member {onnx.ITensorProto|null|undefined} indices
+ * @memberof onnx.SparseTensorProto
+ * @instance
+ */
+ SparseTensorProto.prototype.indices = null;
+
+ /**
+ * SparseTensorProto dims.
+ * @member {Array.} dims
+ * @memberof onnx.SparseTensorProto
+ * @instance
+ */
+ SparseTensorProto.prototype.dims = $util.emptyArray;
+
+ /**
+ * Creates a new SparseTensorProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.SparseTensorProto
+ * @static
+ * @param {onnx.ISparseTensorProto=} [properties] Properties to set
+ * @returns {onnx.SparseTensorProto} SparseTensorProto instance
+ */
+ SparseTensorProto.create = function create(properties) {
+ return new SparseTensorProto(properties);
+ };
+
+ /**
+ * Encodes the specified SparseTensorProto message. Does not implicitly {@link onnx.SparseTensorProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.SparseTensorProto
+ * @static
+ * @param {onnx.ISparseTensorProto} message SparseTensorProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ SparseTensorProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.values != null && Object.hasOwnProperty.call(message, "values"))
+ $root.onnx.TensorProto.encode(message.values, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
+ if (message.indices != null && Object.hasOwnProperty.call(message, "indices"))
+ $root.onnx.TensorProto.encode(message.indices, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
+ if (message.dims != null && message.dims.length) {
+ writer.uint32(/* id 3, wireType 2 =*/26).fork();
+ for (var i = 0; i < message.dims.length; ++i)
+ writer.int64(message.dims[i]);
+ writer.ldelim();
+ }
+ return writer;
+ };
+
+ /**
+ * Encodes the specified SparseTensorProto message, length delimited. Does not implicitly {@link onnx.SparseTensorProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.SparseTensorProto
+ * @static
+ * @param {onnx.ISparseTensorProto} message SparseTensorProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ SparseTensorProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a SparseTensorProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.SparseTensorProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.SparseTensorProto} SparseTensorProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ SparseTensorProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.SparseTensorProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.values = $root.onnx.TensorProto.decode(reader, reader.uint32());
+ break;
+ }
+ case 2: {
+ message.indices = $root.onnx.TensorProto.decode(reader, reader.uint32());
+ break;
+ }
+ case 3: {
+ if (!(message.dims && message.dims.length))
+ message.dims = [];
+ if ((tag & 7) === 2) {
+ var end2 = reader.uint32() + reader.pos;
+ while (reader.pos < end2)
+ message.dims.push(reader.int64());
+ } else
+ message.dims.push(reader.int64());
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a SparseTensorProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.SparseTensorProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.SparseTensorProto} SparseTensorProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ SparseTensorProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a SparseTensorProto message.
+ * @function verify
+ * @memberof onnx.SparseTensorProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ SparseTensorProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.values != null && message.hasOwnProperty("values")) {
+ var error = $root.onnx.TensorProto.verify(message.values);
+ if (error)
+ return "values." + error;
+ }
+ if (message.indices != null && message.hasOwnProperty("indices")) {
+ var error = $root.onnx.TensorProto.verify(message.indices);
+ if (error)
+ return "indices." + error;
+ }
+ if (message.dims != null && message.hasOwnProperty("dims")) {
+ if (!Array.isArray(message.dims))
+ return "dims: array expected";
+ for (var i = 0; i < message.dims.length; ++i)
+ if (!$util.isInteger(message.dims[i]) && !(message.dims[i] && $util.isInteger(message.dims[i].low) && $util.isInteger(message.dims[i].high)))
+ return "dims: integer|Long[] expected";
+ }
+ return null;
+ };
+
+ /**
+ * Creates a SparseTensorProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.SparseTensorProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.SparseTensorProto} SparseTensorProto
+ */
+ SparseTensorProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.SparseTensorProto)
+ return object;
+ var message = new $root.onnx.SparseTensorProto();
+ if (object.values != null) {
+ if (typeof object.values !== "object")
+ throw TypeError(".onnx.SparseTensorProto.values: object expected");
+ message.values = $root.onnx.TensorProto.fromObject(object.values);
+ }
+ if (object.indices != null) {
+ if (typeof object.indices !== "object")
+ throw TypeError(".onnx.SparseTensorProto.indices: object expected");
+ message.indices = $root.onnx.TensorProto.fromObject(object.indices);
+ }
+ if (object.dims) {
+ if (!Array.isArray(object.dims))
+ throw TypeError(".onnx.SparseTensorProto.dims: array expected");
+ message.dims = [];
+ for (var i = 0; i < object.dims.length; ++i)
+ if ($util.Long)
+ (message.dims[i] = $util.Long.fromValue(object.dims[i])).unsigned = false;
+ else if (typeof object.dims[i] === "string")
+ message.dims[i] = parseInt(object.dims[i], 10);
+ else if (typeof object.dims[i] === "number")
+ message.dims[i] = object.dims[i];
+ else if (typeof object.dims[i] === "object")
+ message.dims[i] = new $util.LongBits(object.dims[i].low >>> 0, object.dims[i].high >>> 0).toNumber();
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a SparseTensorProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.SparseTensorProto
+ * @static
+ * @param {onnx.SparseTensorProto} message SparseTensorProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ SparseTensorProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.arrays || options.defaults)
+ object.dims = [];
+ if (options.defaults) {
+ object.values = null;
+ object.indices = null;
+ }
+ if (message.values != null && message.hasOwnProperty("values"))
+ object.values = $root.onnx.TensorProto.toObject(message.values, options);
+ if (message.indices != null && message.hasOwnProperty("indices"))
+ object.indices = $root.onnx.TensorProto.toObject(message.indices, options);
+ if (message.dims && message.dims.length) {
+ object.dims = [];
+ for (var j = 0; j < message.dims.length; ++j)
+ if (typeof message.dims[j] === "number")
+ object.dims[j] = options.longs === String ? String(message.dims[j]) : message.dims[j];
+ else
+ object.dims[j] = options.longs === String ? $util.Long.prototype.toString.call(message.dims[j]) : options.longs === Number ? new $util.LongBits(message.dims[j].low >>> 0, message.dims[j].high >>> 0).toNumber() : message.dims[j];
+ }
+ return object;
+ };
+
+ /**
+ * Converts this SparseTensorProto to JSON.
+ * @function toJSON
+ * @memberof onnx.SparseTensorProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ SparseTensorProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for SparseTensorProto
+ * @function getTypeUrl
+ * @memberof onnx.SparseTensorProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ SparseTensorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.SparseTensorProto";
+ };
+
+ return SparseTensorProto;
+ })();
+
+ onnx.TensorShapeProto = (function() {
+
+ /**
+ * Properties of a TensorShapeProto.
+ * @memberof onnx
+ * @interface ITensorShapeProto
+ * @property {Array.|null} [dim] TensorShapeProto dim
+ */
+
+ /**
+ * Constructs a new TensorShapeProto.
+ * @memberof onnx
+ * @classdesc Represents a TensorShapeProto.
+ * @implements ITensorShapeProto
+ * @constructor
+ * @param {onnx.ITensorShapeProto=} [properties] Properties to set
+ */
+ function TensorShapeProto(properties) {
+ this.dim = [];
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * TensorShapeProto dim.
+ * @member {Array.} dim
+ * @memberof onnx.TensorShapeProto
+ * @instance
+ */
+ TensorShapeProto.prototype.dim = $util.emptyArray;
+
+ /**
+ * Creates a new TensorShapeProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.TensorShapeProto
+ * @static
+ * @param {onnx.ITensorShapeProto=} [properties] Properties to set
+ * @returns {onnx.TensorShapeProto} TensorShapeProto instance
+ */
+ TensorShapeProto.create = function create(properties) {
+ return new TensorShapeProto(properties);
+ };
+
+ /**
+ * Encodes the specified TensorShapeProto message. Does not implicitly {@link onnx.TensorShapeProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TensorShapeProto
+ * @static
+ * @param {onnx.ITensorShapeProto} message TensorShapeProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ TensorShapeProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.dim != null && message.dim.length)
+ for (var i = 0; i < message.dim.length; ++i)
+ $root.onnx.TensorShapeProto.Dimension.encode(message.dim[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified TensorShapeProto message, length delimited. Does not implicitly {@link onnx.TensorShapeProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TensorShapeProto
+ * @static
+ * @param {onnx.ITensorShapeProto} message TensorShapeProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ TensorShapeProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a TensorShapeProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TensorShapeProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TensorShapeProto} TensorShapeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ TensorShapeProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TensorShapeProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ if (!(message.dim && message.dim.length))
+ message.dim = [];
+ message.dim.push($root.onnx.TensorShapeProto.Dimension.decode(reader, reader.uint32()));
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a TensorShapeProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TensorShapeProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TensorShapeProto} TensorShapeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ TensorShapeProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a TensorShapeProto message.
+ * @function verify
+ * @memberof onnx.TensorShapeProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ TensorShapeProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.dim != null && message.hasOwnProperty("dim")) {
+ if (!Array.isArray(message.dim))
+ return "dim: array expected";
+ for (var i = 0; i < message.dim.length; ++i) {
+ var error = $root.onnx.TensorShapeProto.Dimension.verify(message.dim[i]);
+ if (error)
+ return "dim." + error;
+ }
+ }
+ return null;
+ };
+
+ /**
+ * Creates a TensorShapeProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TensorShapeProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TensorShapeProto} TensorShapeProto
+ */
+ TensorShapeProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TensorShapeProto)
+ return object;
+ var message = new $root.onnx.TensorShapeProto();
+ if (object.dim) {
+ if (!Array.isArray(object.dim))
+ throw TypeError(".onnx.TensorShapeProto.dim: array expected");
+ message.dim = [];
+ for (var i = 0; i < object.dim.length; ++i) {
+ if (typeof object.dim[i] !== "object")
+ throw TypeError(".onnx.TensorShapeProto.dim: object expected");
+ message.dim[i] = $root.onnx.TensorShapeProto.Dimension.fromObject(object.dim[i]);
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a TensorShapeProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TensorShapeProto
+ * @static
+ * @param {onnx.TensorShapeProto} message TensorShapeProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ TensorShapeProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.arrays || options.defaults)
+ object.dim = [];
+ if (message.dim && message.dim.length) {
+ object.dim = [];
+ for (var j = 0; j < message.dim.length; ++j)
+ object.dim[j] = $root.onnx.TensorShapeProto.Dimension.toObject(message.dim[j], options);
+ }
+ return object;
+ };
+
+ /**
+ * Converts this TensorShapeProto to JSON.
+ * @function toJSON
+ * @memberof onnx.TensorShapeProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ TensorShapeProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for TensorShapeProto
+ * @function getTypeUrl
+ * @memberof onnx.TensorShapeProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ TensorShapeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TensorShapeProto";
+ };
+
+ TensorShapeProto.Dimension = (function() {
+
+ /**
+ * Properties of a Dimension.
+ * @memberof onnx.TensorShapeProto
+ * @interface IDimension
+ * @property {number|Long|null} [dimValue] Dimension dimValue
+ * @property {string|null} [dimParam] Dimension dimParam
+ * @property {string|null} [denotation] Dimension denotation
+ */
+
+ /**
+ * Constructs a new Dimension.
+ * @memberof onnx.TensorShapeProto
+ * @classdesc Represents a Dimension.
+ * @implements IDimension
+ * @constructor
+ * @param {onnx.TensorShapeProto.IDimension=} [properties] Properties to set
+ */
+ function Dimension(properties) {
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * Dimension dimValue.
+ * @member {number|Long|null|undefined} dimValue
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @instance
+ */
+ Dimension.prototype.dimValue = null;
+
+ /**
+ * Dimension dimParam.
+ * @member {string|null|undefined} dimParam
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @instance
+ */
+ Dimension.prototype.dimParam = null;
+
+ /**
+ * Dimension denotation.
+ * @member {string} denotation
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @instance
+ */
+ Dimension.prototype.denotation = "";
+
+ // OneOf field names bound to virtual getters and setters
+ var $oneOfFields;
+
+ /**
+ * Dimension value.
+ * @member {"dimValue"|"dimParam"|undefined} value
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @instance
+ */
+ Object.defineProperty(Dimension.prototype, "value", {
+ get: $util.oneOfGetter($oneOfFields = ["dimValue", "dimParam"]),
+ set: $util.oneOfSetter($oneOfFields)
+ });
+
+ /**
+ * Creates a new Dimension instance using the specified properties.
+ * @function create
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @static
+ * @param {onnx.TensorShapeProto.IDimension=} [properties] Properties to set
+ * @returns {onnx.TensorShapeProto.Dimension} Dimension instance
+ */
+ Dimension.create = function create(properties) {
+ return new Dimension(properties);
+ };
+
+ /**
+ * Encodes the specified Dimension message. Does not implicitly {@link onnx.TensorShapeProto.Dimension.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @static
+ * @param {onnx.TensorShapeProto.IDimension} message Dimension message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Dimension.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.dimValue != null && Object.hasOwnProperty.call(message, "dimValue"))
+ writer.uint32(/* id 1, wireType 0 =*/8).int64(message.dimValue);
+ if (message.dimParam != null && Object.hasOwnProperty.call(message, "dimParam"))
+ writer.uint32(/* id 2, wireType 2 =*/18).string(message.dimParam);
+ if (message.denotation != null && Object.hasOwnProperty.call(message, "denotation"))
+ writer.uint32(/* id 3, wireType 2 =*/26).string(message.denotation);
+ return writer;
+ };
+
+ /**
+ * Encodes the specified Dimension message, length delimited. Does not implicitly {@link onnx.TensorShapeProto.Dimension.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @static
+ * @param {onnx.TensorShapeProto.IDimension} message Dimension message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Dimension.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a Dimension message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TensorShapeProto.Dimension} Dimension
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Dimension.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TensorShapeProto.Dimension();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.dimValue = reader.int64();
+ break;
+ }
+ case 2: {
+ message.dimParam = reader.string();
+ break;
+ }
+ case 3: {
+ message.denotation = reader.string();
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a Dimension message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TensorShapeProto.Dimension} Dimension
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Dimension.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a Dimension message.
+ * @function verify
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ Dimension.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ var properties = {};
+ if (message.dimValue != null && message.hasOwnProperty("dimValue")) {
+ properties.value = 1;
+ if (!$util.isInteger(message.dimValue) && !(message.dimValue && $util.isInteger(message.dimValue.low) && $util.isInteger(message.dimValue.high)))
+ return "dimValue: integer|Long expected";
+ }
+ if (message.dimParam != null && message.hasOwnProperty("dimParam")) {
+ if (properties.value === 1)
+ return "value: multiple values";
+ properties.value = 1;
+ if (!$util.isString(message.dimParam))
+ return "dimParam: string expected";
+ }
+ if (message.denotation != null && message.hasOwnProperty("denotation"))
+ if (!$util.isString(message.denotation))
+ return "denotation: string expected";
+ return null;
+ };
+
+ /**
+ * Creates a Dimension message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TensorShapeProto.Dimension} Dimension
+ */
+ Dimension.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TensorShapeProto.Dimension)
+ return object;
+ var message = new $root.onnx.TensorShapeProto.Dimension();
+ if (object.dimValue != null)
+ if ($util.Long)
+ (message.dimValue = $util.Long.fromValue(object.dimValue)).unsigned = false;
+ else if (typeof object.dimValue === "string")
+ message.dimValue = parseInt(object.dimValue, 10);
+ else if (typeof object.dimValue === "number")
+ message.dimValue = object.dimValue;
+ else if (typeof object.dimValue === "object")
+ message.dimValue = new $util.LongBits(object.dimValue.low >>> 0, object.dimValue.high >>> 0).toNumber();
+ if (object.dimParam != null)
+ message.dimParam = String(object.dimParam);
+ if (object.denotation != null)
+ message.denotation = String(object.denotation);
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a Dimension message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @static
+ * @param {onnx.TensorShapeProto.Dimension} message Dimension
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ Dimension.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.defaults)
+ object.denotation = "";
+ if (message.dimValue != null && message.hasOwnProperty("dimValue")) {
+ if (typeof message.dimValue === "number")
+ object.dimValue = options.longs === String ? String(message.dimValue) : message.dimValue;
+ else
+ object.dimValue = options.longs === String ? $util.Long.prototype.toString.call(message.dimValue) : options.longs === Number ? new $util.LongBits(message.dimValue.low >>> 0, message.dimValue.high >>> 0).toNumber() : message.dimValue;
+ if (options.oneofs)
+ object.value = "dimValue";
+ }
+ if (message.dimParam != null && message.hasOwnProperty("dimParam")) {
+ object.dimParam = message.dimParam;
+ if (options.oneofs)
+ object.value = "dimParam";
+ }
+ if (message.denotation != null && message.hasOwnProperty("denotation"))
+ object.denotation = message.denotation;
+ return object;
+ };
+
+ /**
+ * Converts this Dimension to JSON.
+ * @function toJSON
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ Dimension.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for Dimension
+ * @function getTypeUrl
+ * @memberof onnx.TensorShapeProto.Dimension
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ Dimension.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TensorShapeProto.Dimension";
+ };
+
+ return Dimension;
+ })();
+
+ return TensorShapeProto;
+ })();
+
+ onnx.TypeProto = (function() {
+
+ /**
+ * Properties of a TypeProto.
+ * @memberof onnx
+ * @interface ITypeProto
+ * @property {onnx.TypeProto.ITensor|null} [tensorType] TypeProto tensorType
+ * @property {onnx.TypeProto.ISequence|null} [sequenceType] TypeProto sequenceType
+ * @property {onnx.TypeProto.IMap|null} [mapType] TypeProto mapType
+ * @property {onnx.TypeProto.IOptional|null} [optionalType] TypeProto optionalType
+ * @property {onnx.TypeProto.ISparseTensor|null} [sparseTensorType] TypeProto sparseTensorType
+ * @property {string|null} [denotation] TypeProto denotation
+ */
+
+ /**
+ * Constructs a new TypeProto.
+ * @memberof onnx
+ * @classdesc Represents a TypeProto.
+ * @implements ITypeProto
+ * @constructor
+ * @param {onnx.ITypeProto=} [properties] Properties to set
+ */
+ function TypeProto(properties) {
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * TypeProto tensorType.
+ * @member {onnx.TypeProto.ITensor|null|undefined} tensorType
+ * @memberof onnx.TypeProto
+ * @instance
+ */
+ TypeProto.prototype.tensorType = null;
+
+ /**
+ * TypeProto sequenceType.
+ * @member {onnx.TypeProto.ISequence|null|undefined} sequenceType
+ * @memberof onnx.TypeProto
+ * @instance
+ */
+ TypeProto.prototype.sequenceType = null;
+
+ /**
+ * TypeProto mapType.
+ * @member {onnx.TypeProto.IMap|null|undefined} mapType
+ * @memberof onnx.TypeProto
+ * @instance
+ */
+ TypeProto.prototype.mapType = null;
+
+ /**
+ * TypeProto optionalType.
+ * @member {onnx.TypeProto.IOptional|null|undefined} optionalType
+ * @memberof onnx.TypeProto
+ * @instance
+ */
+ TypeProto.prototype.optionalType = null;
+
+ /**
+ * TypeProto sparseTensorType.
+ * @member {onnx.TypeProto.ISparseTensor|null|undefined} sparseTensorType
+ * @memberof onnx.TypeProto
+ * @instance
+ */
+ TypeProto.prototype.sparseTensorType = null;
+
+ /**
+ * TypeProto denotation.
+ * @member {string} denotation
+ * @memberof onnx.TypeProto
+ * @instance
+ */
+ TypeProto.prototype.denotation = "";
+
+ // OneOf field names bound to virtual getters and setters
+ var $oneOfFields;
+
+ /**
+ * TypeProto value.
+ * @member {"tensorType"|"sequenceType"|"mapType"|"optionalType"|"sparseTensorType"|undefined} value
+ * @memberof onnx.TypeProto
+ * @instance
+ */
+ Object.defineProperty(TypeProto.prototype, "value", {
+ get: $util.oneOfGetter($oneOfFields = ["tensorType", "sequenceType", "mapType", "optionalType", "sparseTensorType"]),
+ set: $util.oneOfSetter($oneOfFields)
+ });
+
+ /**
+ * Creates a new TypeProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.TypeProto
+ * @static
+ * @param {onnx.ITypeProto=} [properties] Properties to set
+ * @returns {onnx.TypeProto} TypeProto instance
+ */
+ TypeProto.create = function create(properties) {
+ return new TypeProto(properties);
+ };
+
+ /**
+ * Encodes the specified TypeProto message. Does not implicitly {@link onnx.TypeProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TypeProto
+ * @static
+ * @param {onnx.ITypeProto} message TypeProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ TypeProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.tensorType != null && Object.hasOwnProperty.call(message, "tensorType"))
+ $root.onnx.TypeProto.Tensor.encode(message.tensorType, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
+ if (message.sequenceType != null && Object.hasOwnProperty.call(message, "sequenceType"))
+ $root.onnx.TypeProto.Sequence.encode(message.sequenceType, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
+ if (message.mapType != null && Object.hasOwnProperty.call(message, "mapType"))
+ $root.onnx.TypeProto.Map.encode(message.mapType, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim();
+ if (message.denotation != null && Object.hasOwnProperty.call(message, "denotation"))
+ writer.uint32(/* id 6, wireType 2 =*/50).string(message.denotation);
+ if (message.sparseTensorType != null && Object.hasOwnProperty.call(message, "sparseTensorType"))
+ $root.onnx.TypeProto.SparseTensor.encode(message.sparseTensorType, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
+ if (message.optionalType != null && Object.hasOwnProperty.call(message, "optionalType"))
+ $root.onnx.TypeProto.Optional.encode(message.optionalType, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified TypeProto message, length delimited. Does not implicitly {@link onnx.TypeProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TypeProto
+ * @static
+ * @param {onnx.ITypeProto} message TypeProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ TypeProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a TypeProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TypeProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TypeProto} TypeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ TypeProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.tensorType = $root.onnx.TypeProto.Tensor.decode(reader, reader.uint32());
+ break;
+ }
+ case 4: {
+ message.sequenceType = $root.onnx.TypeProto.Sequence.decode(reader, reader.uint32());
+ break;
+ }
+ case 5: {
+ message.mapType = $root.onnx.TypeProto.Map.decode(reader, reader.uint32());
+ break;
+ }
+ case 9: {
+ message.optionalType = $root.onnx.TypeProto.Optional.decode(reader, reader.uint32());
+ break;
+ }
+ case 8: {
+ message.sparseTensorType = $root.onnx.TypeProto.SparseTensor.decode(reader, reader.uint32());
+ break;
+ }
+ case 6: {
+ message.denotation = reader.string();
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a TypeProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TypeProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TypeProto} TypeProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ TypeProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a TypeProto message.
+ * @function verify
+ * @memberof onnx.TypeProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ TypeProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ var properties = {};
+ if (message.tensorType != null && message.hasOwnProperty("tensorType")) {
+ properties.value = 1;
+ {
+ var error = $root.onnx.TypeProto.Tensor.verify(message.tensorType);
+ if (error)
+ return "tensorType." + error;
+ }
+ }
+ if (message.sequenceType != null && message.hasOwnProperty("sequenceType")) {
+ if (properties.value === 1)
+ return "value: multiple values";
+ properties.value = 1;
+ {
+ var error = $root.onnx.TypeProto.Sequence.verify(message.sequenceType);
+ if (error)
+ return "sequenceType." + error;
+ }
+ }
+ if (message.mapType != null && message.hasOwnProperty("mapType")) {
+ if (properties.value === 1)
+ return "value: multiple values";
+ properties.value = 1;
+ {
+ var error = $root.onnx.TypeProto.Map.verify(message.mapType);
+ if (error)
+ return "mapType." + error;
+ }
+ }
+ if (message.optionalType != null && message.hasOwnProperty("optionalType")) {
+ if (properties.value === 1)
+ return "value: multiple values";
+ properties.value = 1;
+ {
+ var error = $root.onnx.TypeProto.Optional.verify(message.optionalType);
+ if (error)
+ return "optionalType." + error;
+ }
+ }
+ if (message.sparseTensorType != null && message.hasOwnProperty("sparseTensorType")) {
+ if (properties.value === 1)
+ return "value: multiple values";
+ properties.value = 1;
+ {
+ var error = $root.onnx.TypeProto.SparseTensor.verify(message.sparseTensorType);
+ if (error)
+ return "sparseTensorType." + error;
+ }
+ }
+ if (message.denotation != null && message.hasOwnProperty("denotation"))
+ if (!$util.isString(message.denotation))
+ return "denotation: string expected";
+ return null;
+ };
+
+ /**
+ * Creates a TypeProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TypeProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TypeProto} TypeProto
+ */
+ TypeProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TypeProto)
+ return object;
+ var message = new $root.onnx.TypeProto();
+ if (object.tensorType != null) {
+ if (typeof object.tensorType !== "object")
+ throw TypeError(".onnx.TypeProto.tensorType: object expected");
+ message.tensorType = $root.onnx.TypeProto.Tensor.fromObject(object.tensorType);
+ }
+ if (object.sequenceType != null) {
+ if (typeof object.sequenceType !== "object")
+ throw TypeError(".onnx.TypeProto.sequenceType: object expected");
+ message.sequenceType = $root.onnx.TypeProto.Sequence.fromObject(object.sequenceType);
+ }
+ if (object.mapType != null) {
+ if (typeof object.mapType !== "object")
+ throw TypeError(".onnx.TypeProto.mapType: object expected");
+ message.mapType = $root.onnx.TypeProto.Map.fromObject(object.mapType);
+ }
+ if (object.optionalType != null) {
+ if (typeof object.optionalType !== "object")
+ throw TypeError(".onnx.TypeProto.optionalType: object expected");
+ message.optionalType = $root.onnx.TypeProto.Optional.fromObject(object.optionalType);
+ }
+ if (object.sparseTensorType != null) {
+ if (typeof object.sparseTensorType !== "object")
+ throw TypeError(".onnx.TypeProto.sparseTensorType: object expected");
+ message.sparseTensorType = $root.onnx.TypeProto.SparseTensor.fromObject(object.sparseTensorType);
+ }
+ if (object.denotation != null)
+ message.denotation = String(object.denotation);
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a TypeProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TypeProto
+ * @static
+ * @param {onnx.TypeProto} message TypeProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ TypeProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.defaults)
+ object.denotation = "";
+ if (message.tensorType != null && message.hasOwnProperty("tensorType")) {
+ object.tensorType = $root.onnx.TypeProto.Tensor.toObject(message.tensorType, options);
+ if (options.oneofs)
+ object.value = "tensorType";
+ }
+ if (message.sequenceType != null && message.hasOwnProperty("sequenceType")) {
+ object.sequenceType = $root.onnx.TypeProto.Sequence.toObject(message.sequenceType, options);
+ if (options.oneofs)
+ object.value = "sequenceType";
+ }
+ if (message.mapType != null && message.hasOwnProperty("mapType")) {
+ object.mapType = $root.onnx.TypeProto.Map.toObject(message.mapType, options);
+ if (options.oneofs)
+ object.value = "mapType";
+ }
+ if (message.denotation != null && message.hasOwnProperty("denotation"))
+ object.denotation = message.denotation;
+ if (message.sparseTensorType != null && message.hasOwnProperty("sparseTensorType")) {
+ object.sparseTensorType = $root.onnx.TypeProto.SparseTensor.toObject(message.sparseTensorType, options);
+ if (options.oneofs)
+ object.value = "sparseTensorType";
+ }
+ if (message.optionalType != null && message.hasOwnProperty("optionalType")) {
+ object.optionalType = $root.onnx.TypeProto.Optional.toObject(message.optionalType, options);
+ if (options.oneofs)
+ object.value = "optionalType";
+ }
+ return object;
+ };
+
+ /**
+ * Converts this TypeProto to JSON.
+ * @function toJSON
+ * @memberof onnx.TypeProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ TypeProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for TypeProto
+ * @function getTypeUrl
+ * @memberof onnx.TypeProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ TypeProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TypeProto";
+ };
+
+ TypeProto.Tensor = (function() {
+
+ /**
+ * Properties of a Tensor.
+ * @memberof onnx.TypeProto
+ * @interface ITensor
+ * @property {number|null} [elemType] Tensor elemType
+ * @property {onnx.ITensorShapeProto|null} [shape] Tensor shape
+ */
+
+ /**
+ * Constructs a new Tensor.
+ * @memberof onnx.TypeProto
+ * @classdesc Represents a Tensor.
+ * @implements ITensor
+ * @constructor
+ * @param {onnx.TypeProto.ITensor=} [properties] Properties to set
+ */
+ function Tensor(properties) {
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * Tensor elemType.
+ * @member {number} elemType
+ * @memberof onnx.TypeProto.Tensor
+ * @instance
+ */
+ Tensor.prototype.elemType = 0;
+
+ /**
+ * Tensor shape.
+ * @member {onnx.ITensorShapeProto|null|undefined} shape
+ * @memberof onnx.TypeProto.Tensor
+ * @instance
+ */
+ Tensor.prototype.shape = null;
+
+ /**
+ * Creates a new Tensor instance using the specified properties.
+ * @function create
+ * @memberof onnx.TypeProto.Tensor
+ * @static
+ * @param {onnx.TypeProto.ITensor=} [properties] Properties to set
+ * @returns {onnx.TypeProto.Tensor} Tensor instance
+ */
+ Tensor.create = function create(properties) {
+ return new Tensor(properties);
+ };
+
+ /**
+ * Encodes the specified Tensor message. Does not implicitly {@link onnx.TypeProto.Tensor.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TypeProto.Tensor
+ * @static
+ * @param {onnx.TypeProto.ITensor} message Tensor message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Tensor.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.elemType != null && Object.hasOwnProperty.call(message, "elemType"))
+ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.elemType);
+ if (message.shape != null && Object.hasOwnProperty.call(message, "shape"))
+ $root.onnx.TensorShapeProto.encode(message.shape, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified Tensor message, length delimited. Does not implicitly {@link onnx.TypeProto.Tensor.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TypeProto.Tensor
+ * @static
+ * @param {onnx.TypeProto.ITensor} message Tensor message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Tensor.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a Tensor message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TypeProto.Tensor
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TypeProto.Tensor} Tensor
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Tensor.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto.Tensor();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.elemType = reader.int32();
+ break;
+ }
+ case 2: {
+ message.shape = $root.onnx.TensorShapeProto.decode(reader, reader.uint32());
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a Tensor message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TypeProto.Tensor
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TypeProto.Tensor} Tensor
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Tensor.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a Tensor message.
+ * @function verify
+ * @memberof onnx.TypeProto.Tensor
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ Tensor.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.elemType != null && message.hasOwnProperty("elemType"))
+ if (!$util.isInteger(message.elemType))
+ return "elemType: integer expected";
+ if (message.shape != null && message.hasOwnProperty("shape")) {
+ var error = $root.onnx.TensorShapeProto.verify(message.shape);
+ if (error)
+ return "shape." + error;
+ }
+ return null;
+ };
+
+ /**
+ * Creates a Tensor message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TypeProto.Tensor
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TypeProto.Tensor} Tensor
+ */
+ Tensor.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TypeProto.Tensor)
+ return object;
+ var message = new $root.onnx.TypeProto.Tensor();
+ if (object.elemType != null)
+ message.elemType = object.elemType | 0;
+ if (object.shape != null) {
+ if (typeof object.shape !== "object")
+ throw TypeError(".onnx.TypeProto.Tensor.shape: object expected");
+ message.shape = $root.onnx.TensorShapeProto.fromObject(object.shape);
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a Tensor message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TypeProto.Tensor
+ * @static
+ * @param {onnx.TypeProto.Tensor} message Tensor
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ Tensor.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.defaults) {
+ object.elemType = 0;
+ object.shape = null;
+ }
+ if (message.elemType != null && message.hasOwnProperty("elemType"))
+ object.elemType = message.elemType;
+ if (message.shape != null && message.hasOwnProperty("shape"))
+ object.shape = $root.onnx.TensorShapeProto.toObject(message.shape, options);
+ return object;
+ };
+
+ /**
+ * Converts this Tensor to JSON.
+ * @function toJSON
+ * @memberof onnx.TypeProto.Tensor
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ Tensor.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for Tensor
+ * @function getTypeUrl
+ * @memberof onnx.TypeProto.Tensor
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ Tensor.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TypeProto.Tensor";
+ };
+
+ return Tensor;
+ })();
+
+ TypeProto.Sequence = (function() {
+
+ /**
+ * Properties of a Sequence.
+ * @memberof onnx.TypeProto
+ * @interface ISequence
+ * @property {onnx.ITypeProto|null} [elemType] Sequence elemType
+ */
+
+ /**
+ * Constructs a new Sequence.
+ * @memberof onnx.TypeProto
+ * @classdesc Represents a Sequence.
+ * @implements ISequence
+ * @constructor
+ * @param {onnx.TypeProto.ISequence=} [properties] Properties to set
+ */
+ function Sequence(properties) {
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * Sequence elemType.
+ * @member {onnx.ITypeProto|null|undefined} elemType
+ * @memberof onnx.TypeProto.Sequence
+ * @instance
+ */
+ Sequence.prototype.elemType = null;
+
+ /**
+ * Creates a new Sequence instance using the specified properties.
+ * @function create
+ * @memberof onnx.TypeProto.Sequence
+ * @static
+ * @param {onnx.TypeProto.ISequence=} [properties] Properties to set
+ * @returns {onnx.TypeProto.Sequence} Sequence instance
+ */
+ Sequence.create = function create(properties) {
+ return new Sequence(properties);
+ };
+
+ /**
+ * Encodes the specified Sequence message. Does not implicitly {@link onnx.TypeProto.Sequence.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TypeProto.Sequence
+ * @static
+ * @param {onnx.TypeProto.ISequence} message Sequence message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Sequence.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.elemType != null && Object.hasOwnProperty.call(message, "elemType"))
+ $root.onnx.TypeProto.encode(message.elemType, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified Sequence message, length delimited. Does not implicitly {@link onnx.TypeProto.Sequence.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TypeProto.Sequence
+ * @static
+ * @param {onnx.TypeProto.ISequence} message Sequence message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Sequence.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a Sequence message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TypeProto.Sequence
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TypeProto.Sequence} Sequence
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Sequence.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto.Sequence();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.elemType = $root.onnx.TypeProto.decode(reader, reader.uint32());
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a Sequence message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TypeProto.Sequence
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TypeProto.Sequence} Sequence
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Sequence.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a Sequence message.
+ * @function verify
+ * @memberof onnx.TypeProto.Sequence
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ Sequence.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.elemType != null && message.hasOwnProperty("elemType")) {
+ var error = $root.onnx.TypeProto.verify(message.elemType);
+ if (error)
+ return "elemType." + error;
+ }
+ return null;
+ };
+
+ /**
+ * Creates a Sequence message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TypeProto.Sequence
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TypeProto.Sequence} Sequence
+ */
+ Sequence.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TypeProto.Sequence)
+ return object;
+ var message = new $root.onnx.TypeProto.Sequence();
+ if (object.elemType != null) {
+ if (typeof object.elemType !== "object")
+ throw TypeError(".onnx.TypeProto.Sequence.elemType: object expected");
+ message.elemType = $root.onnx.TypeProto.fromObject(object.elemType);
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a Sequence message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TypeProto.Sequence
+ * @static
+ * @param {onnx.TypeProto.Sequence} message Sequence
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ Sequence.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.defaults)
+ object.elemType = null;
+ if (message.elemType != null && message.hasOwnProperty("elemType"))
+ object.elemType = $root.onnx.TypeProto.toObject(message.elemType, options);
+ return object;
+ };
+
+ /**
+ * Converts this Sequence to JSON.
+ * @function toJSON
+ * @memberof onnx.TypeProto.Sequence
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ Sequence.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for Sequence
+ * @function getTypeUrl
+ * @memberof onnx.TypeProto.Sequence
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ Sequence.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TypeProto.Sequence";
+ };
+
+ return Sequence;
+ })();
+
+ TypeProto.Map = (function() {
+
+ /**
+ * Properties of a Map.
+ * @memberof onnx.TypeProto
+ * @interface IMap
+ * @property {number|null} [keyType] Map keyType
+ * @property {onnx.ITypeProto|null} [valueType] Map valueType
+ */
+
+ /**
+ * Constructs a new Map.
+ * @memberof onnx.TypeProto
+ * @classdesc Represents a Map.
+ * @implements IMap
+ * @constructor
+ * @param {onnx.TypeProto.IMap=} [properties] Properties to set
+ */
+ function Map(properties) {
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * Map keyType.
+ * @member {number} keyType
+ * @memberof onnx.TypeProto.Map
+ * @instance
+ */
+ Map.prototype.keyType = 0;
+
+ /**
+ * Map valueType.
+ * @member {onnx.ITypeProto|null|undefined} valueType
+ * @memberof onnx.TypeProto.Map
+ * @instance
+ */
+ Map.prototype.valueType = null;
+
+ /**
+ * Creates a new Map instance using the specified properties.
+ * @function create
+ * @memberof onnx.TypeProto.Map
+ * @static
+ * @param {onnx.TypeProto.IMap=} [properties] Properties to set
+ * @returns {onnx.TypeProto.Map} Map instance
+ */
+ Map.create = function create(properties) {
+ return new Map(properties);
+ };
+
+ /**
+ * Encodes the specified Map message. Does not implicitly {@link onnx.TypeProto.Map.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TypeProto.Map
+ * @static
+ * @param {onnx.TypeProto.IMap} message Map message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Map.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.keyType != null && Object.hasOwnProperty.call(message, "keyType"))
+ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.keyType);
+ if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType"))
+ $root.onnx.TypeProto.encode(message.valueType, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified Map message, length delimited. Does not implicitly {@link onnx.TypeProto.Map.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TypeProto.Map
+ * @static
+ * @param {onnx.TypeProto.IMap} message Map message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Map.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a Map message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TypeProto.Map
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TypeProto.Map} Map
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Map.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto.Map();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.keyType = reader.int32();
+ break;
+ }
+ case 2: {
+ message.valueType = $root.onnx.TypeProto.decode(reader, reader.uint32());
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a Map message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TypeProto.Map
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TypeProto.Map} Map
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Map.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a Map message.
+ * @function verify
+ * @memberof onnx.TypeProto.Map
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ Map.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.keyType != null && message.hasOwnProperty("keyType"))
+ if (!$util.isInteger(message.keyType))
+ return "keyType: integer expected";
+ if (message.valueType != null && message.hasOwnProperty("valueType")) {
+ var error = $root.onnx.TypeProto.verify(message.valueType);
+ if (error)
+ return "valueType." + error;
+ }
+ return null;
+ };
+
+ /**
+ * Creates a Map message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TypeProto.Map
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TypeProto.Map} Map
+ */
+ Map.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TypeProto.Map)
+ return object;
+ var message = new $root.onnx.TypeProto.Map();
+ if (object.keyType != null)
+ message.keyType = object.keyType | 0;
+ if (object.valueType != null) {
+ if (typeof object.valueType !== "object")
+ throw TypeError(".onnx.TypeProto.Map.valueType: object expected");
+ message.valueType = $root.onnx.TypeProto.fromObject(object.valueType);
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a Map message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TypeProto.Map
+ * @static
+ * @param {onnx.TypeProto.Map} message Map
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ Map.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.defaults) {
+ object.keyType = 0;
+ object.valueType = null;
+ }
+ if (message.keyType != null && message.hasOwnProperty("keyType"))
+ object.keyType = message.keyType;
+ if (message.valueType != null && message.hasOwnProperty("valueType"))
+ object.valueType = $root.onnx.TypeProto.toObject(message.valueType, options);
+ return object;
+ };
+
+ /**
+ * Converts this Map to JSON.
+ * @function toJSON
+ * @memberof onnx.TypeProto.Map
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ Map.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for Map
+ * @function getTypeUrl
+ * @memberof onnx.TypeProto.Map
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ Map.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TypeProto.Map";
+ };
+
+ return Map;
+ })();
+
+ TypeProto.Optional = (function() {
+
+ /**
+ * Properties of an Optional.
+ * @memberof onnx.TypeProto
+ * @interface IOptional
+ * @property {onnx.ITypeProto|null} [elemType] Optional elemType
+ */
+
+ /**
+ * Constructs a new Optional.
+ * @memberof onnx.TypeProto
+ * @classdesc Represents an Optional.
+ * @implements IOptional
+ * @constructor
+ * @param {onnx.TypeProto.IOptional=} [properties] Properties to set
+ */
+ function Optional(properties) {
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * Optional elemType.
+ * @member {onnx.ITypeProto|null|undefined} elemType
+ * @memberof onnx.TypeProto.Optional
+ * @instance
+ */
+ Optional.prototype.elemType = null;
+
+ /**
+ * Creates a new Optional instance using the specified properties.
+ * @function create
+ * @memberof onnx.TypeProto.Optional
+ * @static
+ * @param {onnx.TypeProto.IOptional=} [properties] Properties to set
+ * @returns {onnx.TypeProto.Optional} Optional instance
+ */
+ Optional.create = function create(properties) {
+ return new Optional(properties);
+ };
+
+ /**
+ * Encodes the specified Optional message. Does not implicitly {@link onnx.TypeProto.Optional.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TypeProto.Optional
+ * @static
+ * @param {onnx.TypeProto.IOptional} message Optional message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Optional.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.elemType != null && Object.hasOwnProperty.call(message, "elemType"))
+ $root.onnx.TypeProto.encode(message.elemType, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified Optional message, length delimited. Does not implicitly {@link onnx.TypeProto.Optional.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TypeProto.Optional
+ * @static
+ * @param {onnx.TypeProto.IOptional} message Optional message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ Optional.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes an Optional message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TypeProto.Optional
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TypeProto.Optional} Optional
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Optional.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto.Optional();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.elemType = $root.onnx.TypeProto.decode(reader, reader.uint32());
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes an Optional message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TypeProto.Optional
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TypeProto.Optional} Optional
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ Optional.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies an Optional message.
+ * @function verify
+ * @memberof onnx.TypeProto.Optional
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ Optional.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.elemType != null && message.hasOwnProperty("elemType")) {
+ var error = $root.onnx.TypeProto.verify(message.elemType);
+ if (error)
+ return "elemType." + error;
+ }
+ return null;
+ };
+
+ /**
+ * Creates an Optional message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TypeProto.Optional
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TypeProto.Optional} Optional
+ */
+ Optional.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TypeProto.Optional)
+ return object;
+ var message = new $root.onnx.TypeProto.Optional();
+ if (object.elemType != null) {
+ if (typeof object.elemType !== "object")
+ throw TypeError(".onnx.TypeProto.Optional.elemType: object expected");
+ message.elemType = $root.onnx.TypeProto.fromObject(object.elemType);
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from an Optional message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TypeProto.Optional
+ * @static
+ * @param {onnx.TypeProto.Optional} message Optional
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ Optional.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.defaults)
+ object.elemType = null;
+ if (message.elemType != null && message.hasOwnProperty("elemType"))
+ object.elemType = $root.onnx.TypeProto.toObject(message.elemType, options);
+ return object;
+ };
+
+ /**
+ * Converts this Optional to JSON.
+ * @function toJSON
+ * @memberof onnx.TypeProto.Optional
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ Optional.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for Optional
+ * @function getTypeUrl
+ * @memberof onnx.TypeProto.Optional
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ Optional.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TypeProto.Optional";
+ };
+
+ return Optional;
+ })();
+
+ TypeProto.SparseTensor = (function() {
+
+ /**
+ * Properties of a SparseTensor.
+ * @memberof onnx.TypeProto
+ * @interface ISparseTensor
+ * @property {number|null} [elemType] SparseTensor elemType
+ * @property {onnx.ITensorShapeProto|null} [shape] SparseTensor shape
+ */
+
+ /**
+ * Constructs a new SparseTensor.
+ * @memberof onnx.TypeProto
+ * @classdesc Represents a SparseTensor.
+ * @implements ISparseTensor
+ * @constructor
+ * @param {onnx.TypeProto.ISparseTensor=} [properties] Properties to set
+ */
+ function SparseTensor(properties) {
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * SparseTensor elemType.
+ * @member {number} elemType
+ * @memberof onnx.TypeProto.SparseTensor
+ * @instance
+ */
+ SparseTensor.prototype.elemType = 0;
+
+ /**
+ * SparseTensor shape.
+ * @member {onnx.ITensorShapeProto|null|undefined} shape
+ * @memberof onnx.TypeProto.SparseTensor
+ * @instance
+ */
+ SparseTensor.prototype.shape = null;
+
+ /**
+ * Creates a new SparseTensor instance using the specified properties.
+ * @function create
+ * @memberof onnx.TypeProto.SparseTensor
+ * @static
+ * @param {onnx.TypeProto.ISparseTensor=} [properties] Properties to set
+ * @returns {onnx.TypeProto.SparseTensor} SparseTensor instance
+ */
+ SparseTensor.create = function create(properties) {
+ return new SparseTensor(properties);
+ };
+
+ /**
+ * Encodes the specified SparseTensor message. Does not implicitly {@link onnx.TypeProto.SparseTensor.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.TypeProto.SparseTensor
+ * @static
+ * @param {onnx.TypeProto.ISparseTensor} message SparseTensor message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ SparseTensor.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.elemType != null && Object.hasOwnProperty.call(message, "elemType"))
+ writer.uint32(/* id 1, wireType 0 =*/8).int32(message.elemType);
+ if (message.shape != null && Object.hasOwnProperty.call(message, "shape"))
+ $root.onnx.TensorShapeProto.encode(message.shape, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
+ return writer;
+ };
+
+ /**
+ * Encodes the specified SparseTensor message, length delimited. Does not implicitly {@link onnx.TypeProto.SparseTensor.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.TypeProto.SparseTensor
+ * @static
+ * @param {onnx.TypeProto.ISparseTensor} message SparseTensor message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ SparseTensor.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes a SparseTensor message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.TypeProto.SparseTensor
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.TypeProto.SparseTensor} SparseTensor
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ SparseTensor.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.TypeProto.SparseTensor();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.elemType = reader.int32();
+ break;
+ }
+ case 2: {
+ message.shape = $root.onnx.TensorShapeProto.decode(reader, reader.uint32());
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes a SparseTensor message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.TypeProto.SparseTensor
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.TypeProto.SparseTensor} SparseTensor
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ SparseTensor.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies a SparseTensor message.
+ * @function verify
+ * @memberof onnx.TypeProto.SparseTensor
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ SparseTensor.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.elemType != null && message.hasOwnProperty("elemType"))
+ if (!$util.isInteger(message.elemType))
+ return "elemType: integer expected";
+ if (message.shape != null && message.hasOwnProperty("shape")) {
+ var error = $root.onnx.TensorShapeProto.verify(message.shape);
+ if (error)
+ return "shape." + error;
+ }
+ return null;
+ };
+
+ /**
+ * Creates a SparseTensor message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.TypeProto.SparseTensor
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.TypeProto.SparseTensor} SparseTensor
+ */
+ SparseTensor.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.TypeProto.SparseTensor)
+ return object;
+ var message = new $root.onnx.TypeProto.SparseTensor();
+ if (object.elemType != null)
+ message.elemType = object.elemType | 0;
+ if (object.shape != null) {
+ if (typeof object.shape !== "object")
+ throw TypeError(".onnx.TypeProto.SparseTensor.shape: object expected");
+ message.shape = $root.onnx.TensorShapeProto.fromObject(object.shape);
+ }
+ return message;
+ };
+
+ /**
+ * Creates a plain object from a SparseTensor message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.TypeProto.SparseTensor
+ * @static
+ * @param {onnx.TypeProto.SparseTensor} message SparseTensor
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ SparseTensor.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.defaults) {
+ object.elemType = 0;
+ object.shape = null;
+ }
+ if (message.elemType != null && message.hasOwnProperty("elemType"))
+ object.elemType = message.elemType;
+ if (message.shape != null && message.hasOwnProperty("shape"))
+ object.shape = $root.onnx.TensorShapeProto.toObject(message.shape, options);
+ return object;
+ };
+
+ /**
+ * Converts this SparseTensor to JSON.
+ * @function toJSON
+ * @memberof onnx.TypeProto.SparseTensor
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ SparseTensor.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for SparseTensor
+ * @function getTypeUrl
+ * @memberof onnx.TypeProto.SparseTensor
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ SparseTensor.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.TypeProto.SparseTensor";
+ };
+
+ return SparseTensor;
+ })();
+
+ return TypeProto;
+ })();
+
+ onnx.OperatorSetIdProto = (function() {
+
+ /**
+ * Properties of an OperatorSetIdProto.
+ * @memberof onnx
+ * @interface IOperatorSetIdProto
+ * @property {string|null} [domain] OperatorSetIdProto domain
+ * @property {number|Long|null} [version] OperatorSetIdProto version
+ */
+
+ /**
+ * Constructs a new OperatorSetIdProto.
+ * @memberof onnx
+ * @classdesc Represents an OperatorSetIdProto.
+ * @implements IOperatorSetIdProto
+ * @constructor
+ * @param {onnx.IOperatorSetIdProto=} [properties] Properties to set
+ */
+ function OperatorSetIdProto(properties) {
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * OperatorSetIdProto domain.
+ * @member {string} domain
+ * @memberof onnx.OperatorSetIdProto
+ * @instance
+ */
+ OperatorSetIdProto.prototype.domain = "";
+
+ /**
+ * OperatorSetIdProto version.
+ * @member {number|Long} version
+ * @memberof onnx.OperatorSetIdProto
+ * @instance
+ */
+ OperatorSetIdProto.prototype.version = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
+
+ /**
+ * Creates a new OperatorSetIdProto instance using the specified properties.
+ * @function create
+ * @memberof onnx.OperatorSetIdProto
+ * @static
+ * @param {onnx.IOperatorSetIdProto=} [properties] Properties to set
+ * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto instance
+ */
+ OperatorSetIdProto.create = function create(properties) {
+ return new OperatorSetIdProto(properties);
+ };
+
+ /**
+ * Encodes the specified OperatorSetIdProto message. Does not implicitly {@link onnx.OperatorSetIdProto.verify|verify} messages.
+ * @function encode
+ * @memberof onnx.OperatorSetIdProto
+ * @static
+ * @param {onnx.IOperatorSetIdProto} message OperatorSetIdProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ OperatorSetIdProto.encode = function encode(message, writer) {
+ if (!writer)
+ writer = $Writer.create();
+ if (message.domain != null && Object.hasOwnProperty.call(message, "domain"))
+ writer.uint32(/* id 1, wireType 2 =*/10).string(message.domain);
+ if (message.version != null && Object.hasOwnProperty.call(message, "version"))
+ writer.uint32(/* id 2, wireType 0 =*/16).int64(message.version);
+ return writer;
+ };
+
+ /**
+ * Encodes the specified OperatorSetIdProto message, length delimited. Does not implicitly {@link onnx.OperatorSetIdProto.verify|verify} messages.
+ * @function encodeDelimited
+ * @memberof onnx.OperatorSetIdProto
+ * @static
+ * @param {onnx.IOperatorSetIdProto} message OperatorSetIdProto message or plain object to encode
+ * @param {$protobuf.Writer} [writer] Writer to encode to
+ * @returns {$protobuf.Writer} Writer
+ */
+ OperatorSetIdProto.encodeDelimited = function encodeDelimited(message, writer) {
+ return this.encode(message, writer).ldelim();
+ };
+
+ /**
+ * Decodes an OperatorSetIdProto message from the specified reader or buffer.
+ * @function decode
+ * @memberof onnx.OperatorSetIdProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @param {number} [length] Message length if known beforehand
+ * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ OperatorSetIdProto.decode = function decode(reader, length) {
+ if (!(reader instanceof $Reader))
+ reader = $Reader.create(reader);
+ var end = length === undefined ? reader.len : reader.pos + length, message = new $root.onnx.OperatorSetIdProto();
+ while (reader.pos < end) {
+ var tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1: {
+ message.domain = reader.string();
+ break;
+ }
+ case 2: {
+ message.version = reader.int64();
+ break;
+ }
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+ return message;
+ };
+
+ /**
+ * Decodes an OperatorSetIdProto message from the specified reader or buffer, length delimited.
+ * @function decodeDelimited
+ * @memberof onnx.OperatorSetIdProto
+ * @static
+ * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
+ * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto
+ * @throws {Error} If the payload is not a reader or valid buffer
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
+ */
+ OperatorSetIdProto.decodeDelimited = function decodeDelimited(reader) {
+ if (!(reader instanceof $Reader))
+ reader = new $Reader(reader);
+ return this.decode(reader, reader.uint32());
+ };
+
+ /**
+ * Verifies an OperatorSetIdProto message.
+ * @function verify
+ * @memberof onnx.OperatorSetIdProto
+ * @static
+ * @param {Object.} message Plain object to verify
+ * @returns {string|null} `null` if valid, otherwise the reason why it is not
+ */
+ OperatorSetIdProto.verify = function verify(message) {
+ if (typeof message !== "object" || message === null)
+ return "object expected";
+ if (message.domain != null && message.hasOwnProperty("domain"))
+ if (!$util.isString(message.domain))
+ return "domain: string expected";
+ if (message.version != null && message.hasOwnProperty("version"))
+ if (!$util.isInteger(message.version) && !(message.version && $util.isInteger(message.version.low) && $util.isInteger(message.version.high)))
+ return "version: integer|Long expected";
+ return null;
+ };
+
+ /**
+ * Creates an OperatorSetIdProto message from a plain object. Also converts values to their respective internal types.
+ * @function fromObject
+ * @memberof onnx.OperatorSetIdProto
+ * @static
+ * @param {Object.} object Plain object
+ * @returns {onnx.OperatorSetIdProto} OperatorSetIdProto
+ */
+ OperatorSetIdProto.fromObject = function fromObject(object) {
+ if (object instanceof $root.onnx.OperatorSetIdProto)
+ return object;
+ var message = new $root.onnx.OperatorSetIdProto();
+ if (object.domain != null)
+ message.domain = String(object.domain);
+ if (object.version != null)
+ if ($util.Long)
+ (message.version = $util.Long.fromValue(object.version)).unsigned = false;
+ else if (typeof object.version === "string")
+ message.version = parseInt(object.version, 10);
+ else if (typeof object.version === "number")
+ message.version = object.version;
+ else if (typeof object.version === "object")
+ message.version = new $util.LongBits(object.version.low >>> 0, object.version.high >>> 0).toNumber();
+ return message;
+ };
+
+ /**
+ * Creates a plain object from an OperatorSetIdProto message. Also converts values to other types if specified.
+ * @function toObject
+ * @memberof onnx.OperatorSetIdProto
+ * @static
+ * @param {onnx.OperatorSetIdProto} message OperatorSetIdProto
+ * @param {$protobuf.IConversionOptions} [options] Conversion options
+ * @returns {Object.} Plain object
+ */
+ OperatorSetIdProto.toObject = function toObject(message, options) {
+ if (!options)
+ options = {};
+ var object = {};
+ if (options.defaults) {
+ object.domain = "";
+ if ($util.Long) {
+ var long = new $util.Long(0, 0, false);
+ object.version = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
+ } else
+ object.version = options.longs === String ? "0" : 0;
+ }
+ if (message.domain != null && message.hasOwnProperty("domain"))
+ object.domain = message.domain;
+ if (message.version != null && message.hasOwnProperty("version"))
+ if (typeof message.version === "number")
+ object.version = options.longs === String ? String(message.version) : message.version;
+ else
+ object.version = options.longs === String ? $util.Long.prototype.toString.call(message.version) : options.longs === Number ? new $util.LongBits(message.version.low >>> 0, message.version.high >>> 0).toNumber() : message.version;
+ return object;
+ };
+
+ /**
+ * Converts this OperatorSetIdProto to JSON.
+ * @function toJSON
+ * @memberof onnx.OperatorSetIdProto
+ * @instance
+ * @returns {Object.} JSON object
+ */
+ OperatorSetIdProto.prototype.toJSON = function toJSON() {
+ return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
+ };
+
+ /**
+ * Gets the default type url for OperatorSetIdProto
+ * @function getTypeUrl
+ * @memberof onnx.OperatorSetIdProto
+ * @static
+ * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
+ * @returns {string} The default type url
+ */
+ OperatorSetIdProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
+ if (typeUrlPrefix === undefined) {
+ typeUrlPrefix = "type.googleapis.com";
+ }
+ return typeUrlPrefix + "/onnx.OperatorSetIdProto";
+ };
+
+ return OperatorSetIdProto;
+ })();
+
+ /**
+ * OperatorStatus enum.
+ * @name onnx.OperatorStatus
+ * @enum {number}
+ * @property {number} EXPERIMENTAL=0 EXPERIMENTAL value
+ * @property {number} STABLE=1 STABLE value
+ */
+ onnx.OperatorStatus = (function() {
+ var valuesById = {}, values = Object.create(valuesById);
+ values[valuesById[0] = "EXPERIMENTAL"] = 0;
+ values[valuesById[1] = "STABLE"] = 1;
+ return values;
+ })();
+
+ onnx.FunctionProto = (function() {
+
+ /**
+ * Properties of a FunctionProto.
+ * @memberof onnx
+ * @interface IFunctionProto
+ * @property {string|null} [name] FunctionProto name
+ * @property {Array.|null} [input] FunctionProto input
+ * @property {Array.|null} [output] FunctionProto output
+ * @property {Array.|null} [attribute] FunctionProto attribute
+ * @property {Array.|null} [attributeProto] FunctionProto attributeProto
+ * @property {Array.|null} [node] FunctionProto node
+ * @property {string|null} [docString] FunctionProto docString
+ * @property {Array.|null} [opsetImport] FunctionProto opsetImport
+ * @property {string|null} [domain] FunctionProto domain
+ */
+
+ /**
+ * Constructs a new FunctionProto.
+ * @memberof onnx
+ * @classdesc Represents a FunctionProto.
+ * @implements IFunctionProto
+ * @constructor
+ * @param {onnx.IFunctionProto=} [properties] Properties to set
+ */
+ function FunctionProto(properties) {
+ this.input = [];
+ this.output = [];
+ this.attribute = [];
+ this.attributeProto = [];
+ this.node = [];
+ this.opsetImport = [];
+ if (properties)
+ for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
+ if (properties[keys[i]] != null)
+ this[keys[i]] = properties[keys[i]];
+ }
+
+ /**
+ * FunctionProto name.
+ * @member {string} name
+ * @memberof onnx.FunctionProto
+ * @instance
+ */
+ FunctionProto.prototype.name = "";
+
+ /**
+ * FunctionProto input.
+ * @member {Array.