diff --git a/.gitignore b/.gitignore index d5507e0c24..3382c708c0 100644 --- a/.gitignore +++ b/.gitignore @@ -52,4 +52,6 @@ onnxruntime/python/version_info.py /tools/perf_util/target/classes /tools/perf_util/src/main/resources /orttraining/orttraining/eager/ort_aten.g.cpp -/orttraining/orttraining/eager/ort_customops.g.cpp \ No newline at end of file +/orttraining/orttraining/eager/ort_customops.g.cpp +/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/OnnxMl.cs +/csharp/test/Microsoft.ML.OnnxRuntime.Tests/OnnxMl.cs diff --git a/cmake/onnxruntime.cmake b/cmake/onnxruntime.cmake index 559ada8129..7e469c20a9 100644 --- a/cmake/onnxruntime.cmake +++ b/cmake/onnxruntime.cmake @@ -16,7 +16,7 @@ endif() # This macro is to get the path of header files for mobile packaging, for iOS and Android macro(get_mobile_api_headers _HEADERS) - # include both c and cxx api + # include both c and cxx api, and stubs to provide graceful error if EP is not included in build set(${_HEADERS} "${REPO_ROOT}/include/onnxruntime/core/session/onnxruntime_c_api.h" "${REPO_ROOT}/include/onnxruntime/core/session/onnxruntime_cxx_api.h" @@ -41,6 +41,7 @@ list(APPEND SYMBOL_FILES "${REPO_ROOT}/tools/ci_build/gen_def.py") foreach(f ${ONNXRUNTIME_PROVIDER_NAMES}) list(APPEND SYMBOL_FILES "${ONNXRUNTIME_ROOT}/core/providers/${f}/symbols.txt") endforeach() +list(APPEND SYMBOL_FILES "${ONNXRUNTIME_ROOT}/core/session/symbols.txt") add_custom_command(OUTPUT ${SYMBOL_FILE} ${CMAKE_CURRENT_BINARY_DIR}/generated_source.c COMMAND ${Python_EXECUTABLE} "${REPO_ROOT}/tools/ci_build/gen_def.py" diff --git a/cmake/onnxruntime_csharp.cmake b/cmake/onnxruntime_csharp.cmake index f9d26ea3b7..3c9c9f29e7 100644 --- a/cmake/onnxruntime_csharp.cmake +++ b/cmake/onnxruntime_csharp.cmake @@ -18,22 +18,34 @@ if (onnxruntime_USE_DNNL) STRING(APPEND CSHARP_PREPROCESSOR_DEFINES "USE_DNNL,") endif() -if (onnxruntime_USE_TENSORRT) - STRING(APPEND CSHARP_PREPROCESSOR_DEFINES "USE_TENSORRT,") +if (onnxruntime_USE_DML) + STRING(APPEND CSHARP_PREPROCESSOR_DEFINES "USE_DML,") endif() if (onnxruntime_USE_MIGRAPHX) STRING(APPEND CSHARP_PREPROCESSOR_DEFINES "USE_MIGRAPHX,") endif() -if (onnxruntime_USE_OPENVINO) - STRING(APPEND CSHARP_PREPROCESSOR_DEFINES "USE_OPENVINO,") +if (onnxruntime_USE_NNAPI_BUILTIN) + STRING(APPEND CSHARP_PREPROCESSOR_DEFINES "USE_NNAPI,") endif() if (onnxruntime_USE_NUPHAR) STRING(APPEND CSHARP_PREPROCESSOR_DEFINES "USE_NUPHAR,") endif() +if (onnxruntime_USE_OPENVINO) + STRING(APPEND CSHARP_PREPROCESSOR_DEFINES "USE_OPENVINO,") +endif() + +if (onnxruntime_USE_ROCM) + STRING(APPEND CSHARP_PREPROCESSOR_DEFINES "USE_ROCM,") +endif() + +if (onnxruntime_USE_TENSORRT) + STRING(APPEND CSHARP_PREPROCESSOR_DEFINES "USE_TENSORRT,") +endif() + include(CSharpUtilities) include_external_msproject(Microsoft.ML.OnnxRuntime @@ -57,7 +69,8 @@ include_external_msproject(Microsoft.ML.OnnxRuntime.PerfTool #Exclude them from the ALL_BUILD target, otherwise it will trigger errors like: #"Error : Project 'cmake\..\csharp\src\Microsoft.ML.OnnxRuntime\Microsoft.ML.OnnxRuntime.csproj' targets 'netstandard1.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.0'." #We can't fix it because cmake only supports the "TargetFrameworkVersion" property, not "TargetFramework". -set_target_properties(Microsoft.ML.OnnxRuntime Microsoft.ML.OnnxRuntime.InferenceSample Microsoft.ML.OnnxRuntime.Tests Microsoft.ML.OnnxRuntime.PerfTool PROPERTIES EXCLUDE_FROM_ALL 1) +set_target_properties(Microsoft.ML.OnnxRuntime Microsoft.ML.OnnxRuntime.InferenceSample Microsoft.ML.OnnxRuntime.Tests + Microsoft.ML.OnnxRuntime.PerfTool PROPERTIES EXCLUDE_FROM_ALL 1) # generate Directory.Build.props set(DIRECTORY_BUILD_PROPS_COMMENT "WARNING: This is a generated file, please do not check it in!") diff --git a/cmake/onnxruntime_session.cmake b/cmake/onnxruntime_session.cmake index eeedc004ee..14c729baac 100644 --- a/cmake/onnxruntime_session.cmake +++ b/cmake/onnxruntime_session.cmake @@ -5,6 +5,7 @@ file(GLOB onnxruntime_session_srcs CONFIGURE_DEPENDS "${ONNXRUNTIME_INCLUDE_DIR}/core/session/*.h" "${ONNXRUNTIME_ROOT}/core/session/*.h" "${ONNXRUNTIME_ROOT}/core/session/*.cc" + "${ONNXRUNTIME_ROOT}/core/session/symbols.txt" ) if (onnxruntime_MINIMAL_BUILD) diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/InferenceSession.cs b/csharp/src/Microsoft.ML.OnnxRuntime/InferenceSession.cs index f5d48794f9..58f9107c03 100644 --- a/csharp/src/Microsoft.ML.OnnxRuntime/InferenceSession.cs +++ b/csharp/src/Microsoft.ML.OnnxRuntime/InferenceSession.cs @@ -24,22 +24,23 @@ namespace Microsoft.ML.OnnxRuntime /// /// A pointer to a underlying native instance of OrtSession /// - protected IntPtr _nativeHandle; + private IntPtr _nativeHandle; /// /// Dictionary that represents input metadata /// - protected Dictionary _inputMetadata; + private Dictionary _inputMetadata; /// /// Dictionary that represent output metadata /// - protected Dictionary _outputMetadata; + private Dictionary _outputMetadata; /// /// Dictionary that represents overridableInitializers metadata /// - protected Dictionary _overridableInitializerMetadata; + private Dictionary _overridableInitializerMetadata; + private SessionOptions _builtInSessionOptions = null; private RunOptions _builtInRunOptions = null; private ModelMetadata _modelMetadata = null; diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.cs b/csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.cs index 6ab76110cc..a32e5ac071 100644 --- a/csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.cs +++ b/csharp/src/Microsoft.ML.OnnxRuntime/NativeMethods.cs @@ -206,6 +206,23 @@ namespace Microsoft.ML.OnnxRuntime public IntPtr UpdateTensorRTProviderOptions; public IntPtr GetTensorRTProviderOptionsAsString; public IntPtr ReleaseTensorRTProviderOptions; + public IntPtr EnableOrtCustomOps; + public IntPtr RegisterAllocator; + public IntPtr UnregisterAllocator; + public IntPtr IsSparseTensor; + public IntPtr CreateSparseTensorAsOrtValue; + public IntPtr FillSparseTensorCoo; + public IntPtr FillSparseTensorCsr; + public IntPtr FillSparseTensorBlockSparse; + public IntPtr CreateSparseTensorWithValuesAsOrtValue; + public IntPtr UseCooIndices; + public IntPtr UseCsrIndices; + public IntPtr UseBlockSparseIndices; + public IntPtr GetSparseTensorFormat; + public IntPtr GetSparseTensorValuesTypeAndShape; + public IntPtr GetSparseTensorValues; + public IntPtr GetSparseTensorIndicesTypeShape; + public IntPtr GetSparseTensorIndices; } internal static class NativeMethods @@ -453,7 +470,7 @@ namespace Microsoft.ML.OnnxRuntime IntPtr /* (OrtEnv*) */ environment, //[MarshalAs(UnmanagedType.LPStr)]string modelPath byte[] modelPath, - IntPtr /* (OrtSessionOptions*) */sessopnOptions, + IntPtr /* (OrtSessionOptions*) */sessionOptions, out IntPtr /**/ session); public static DOrtCreateSession OrtCreateSession; @@ -672,14 +689,15 @@ namespace Microsoft.ML.OnnxRuntime public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_CUDA(IntPtr /*(OrtSessionOptions*) */ options, int device_id); [DllImport(nativeLib, CharSet = charSet)] - public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_ROCM(IntPtr /*(OrtSessionOptions*) */ options, int device_id); + public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_ROCM( + IntPtr /*(OrtSessionOptions*) */ options, int device_id, UIntPtr gpu_mem_limit); [DllImport(nativeLib, CharSet = charSet)] public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_DML(IntPtr /*(OrtSessionOptions*) */ options, int device_id); [DllImport(nativeLib, CharSet = charSet)] public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_OpenVINO( - IntPtr /*(OrtSessionOptions*)*/ options, IntPtr /*(const char*)*/ device_id); + IntPtr /*(OrtSessionOptions*)*/ options, IntPtr /*(const char*)*/ device_id); [DllImport(nativeLib, CharSet = charSet)] public static extern IntPtr /*(OrtStatus*)*/ OrtSessionOptionsAppendExecutionProvider_Tensorrt(IntPtr /*(OrtSessionOptions*)*/ options, int device_id); diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs b/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs index b989e8a777..7409d24044 100644 --- a/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs +++ b/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs @@ -52,16 +52,6 @@ namespace Microsoft.ML.OnnxRuntime NativeApiStatus.VerifySuccess(NativeMethods.OrtCreateSessionOptions(out handle)); } - /// - /// A helper method to construct a SessionOptions object for CUDA execution. - /// Use only if CUDA is installed and you have the onnxruntime package specific to this Execution Provider. - /// - /// A SessionsOptions() object configured for execution on deviceId=0 - public static SessionOptions MakeSessionOptionWithCudaProvider() - { - return MakeSessionOptionWithCudaProvider(0); - } - /// /// A helper method to construct a SessionOptions object for CUDA execution. /// Use only if CUDA is installed and you have the onnxruntime package specific to this Execution Provider. @@ -151,22 +141,14 @@ namespace Microsoft.ML.OnnxRuntime /// A helper method to construct a SessionOptions object for ROCM execution. /// Use only if ROCM is installed and you have the onnxruntime package specific to this Execution Provider. /// - /// A SessionsOptions() object configured for execution on deviceId=0 - public static SessionOptions MakeSessionOptionWithRocmProvider() - { - return MakeSessionOptionWithRocmProvider(0); - } - - /// - /// A helper method to construct a SessionOptions object for ROCM execution. - /// Use only if ROCM is installed and you have the onnxruntime package specific to this Execution Provider. - /// - /// + /// Device Id + /// GPU memory limit. Defaults to no limit. /// A SessionsOptions() object configured for execution on deviceId - public static SessionOptions MakeSessionOptionWithRocmProvider(int deviceId = 0) + public static SessionOptions MakeSessionOptionWithRocmProvider(int deviceId = 0, UIntPtr gpuMemLimit = default) { SessionOptions options = new SessionOptions(); - NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_ROCM(options.Handle, deviceId)); + NativeApiStatus.VerifySuccess( + NativeMethods.OrtSessionOptionsAppendExecutionProvider_ROCM(options.Handle, deviceId, gpuMemLimit)); NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_CPU(options.Handle, 1)); return options; } @@ -178,7 +160,7 @@ namespace Microsoft.ML.OnnxRuntime /// Appends CPU EP to a list of available execution providers for the session. /// /// 1 - use arena, 0 - do not use arena - public void AppendExecutionProvider_CPU(int useArena) + public void AppendExecutionProvider_CPU(int useArena = 1) { NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_CPU(handle, useArena)); } @@ -187,7 +169,7 @@ namespace Microsoft.ML.OnnxRuntime /// Use only if you have the onnxruntime package specific to this Execution Provider. /// /// 1 - use allocation arena, 0 - otherwise - public void AppendExecutionProvider_Dnnl(int useArena) + public void AppendExecutionProvider_Dnnl(int useArena = 1) { NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Dnnl(handle, useArena)); } @@ -196,7 +178,7 @@ namespace Microsoft.ML.OnnxRuntime /// Use only if you have the onnxruntime package specific to this Execution Provider. /// /// integer device ID - public void AppendExecutionProvider_CUDA(int deviceId) + public void AppendExecutionProvider_CUDA(int deviceId = 0) { NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_CUDA(handle, deviceId)); } @@ -205,7 +187,7 @@ namespace Microsoft.ML.OnnxRuntime /// Use only if you have the onnxruntime package specific to this Execution Provider. /// /// device identification - public void AppendExecutionProvider_DML(int deviceId) + public void AppendExecutionProvider_DML(int deviceId = 0) { NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_DML(handle, deviceId)); } @@ -228,7 +210,7 @@ namespace Microsoft.ML.OnnxRuntime /// Use only if you have the onnxruntime package specific to this Execution Provider. /// /// device identification - public void AppendExecutionProvider_Tensorrt(int deviceId) + public void AppendExecutionProvider_Tensorrt(int deviceId = 0) { NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Tensorrt(handle, deviceId)); } @@ -246,17 +228,19 @@ namespace Microsoft.ML.OnnxRuntime /// /// Use only if you have the onnxruntime package specific to this Execution Provider. /// - /// integer device ID - public void AppendExecutionProvider_ROCM(int deviceId) + /// Device Id + /// GPU memory limit. Defaults to no limit. + public void AppendExecutionProvider_ROCM(int deviceId = 0, UIntPtr gpuMemLimit = default) { - NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_ROCM(handle, deviceId)); + NativeApiStatus.VerifySuccess( + NativeMethods.OrtSessionOptionsAppendExecutionProvider_ROCM(handle, deviceId, gpuMemLimit)); } - + /// /// Use only if you have the onnxruntime package specific to this Execution Provider. /// /// device identification - public void AppendExecutionProvider_MIGraphX(int deviceId) + public void AppendExecutionProvider_MIGraphX(int deviceId = 0) { NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_MIGraphX(handle, deviceId)); } @@ -265,7 +249,7 @@ namespace Microsoft.ML.OnnxRuntime /// Use only if you have the onnxruntime package specific to this Execution Provider. /// /// nnapi specific flag mask - public void AppendExecutionProvider_Nnapi(uint nnapi_flags) + public void AppendExecutionProvider_Nnapi(uint nnapi_flags = 0) { NativeApiStatus.VerifySuccess(NativeMethods.OrtSessionOptionsAppendExecutionProvider_Nnapi(handle, nnapi_flags)); } @@ -707,8 +691,6 @@ namespace Microsoft.ML.OnnxRuntime } return true; } - - #endregion #region SafeHandle /// diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs index 964be5cd03..f7fb3923cb 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs +++ b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs @@ -30,6 +30,9 @@ namespace Microsoft.ML.OnnxRuntime.Tests [Fact] public void TestSessionOptions() { + // get instance to setup logging + var ortEnvInstance = OrtEnv.Instance(); + using (SessionOptions opt = new SessionOptions()) { Assert.NotNull(opt); @@ -90,15 +93,20 @@ namespace Microsoft.ML.OnnxRuntime.Tests Assert.Contains("[ErrorCode:InvalidArgument] Config key is empty", ex.Message); opt.AppendExecutionProvider_CPU(1); -#if USE_DNNL - opt.AppendExecutionProvider_Dnnl(0); -#endif + #if USE_CUDA opt.AppendExecutionProvider_CUDA(0); +#else + try + { + opt.AppendExecutionProvider_CUDA(0); + } + catch (OnnxRuntimeException ortEx) + { + Assert.Contains("Failed to load shared library", ortEx.Message); + } #endif -#if USE_ROCM - opt.AppendExecutionProvider_ROCM(0); -#endif + #if USE_DML // Explicitly set dll probe path so that the (potentially) stale system DirectML.dll // doesn't get loaded by the test process when it is eventually delay loaded by onnruntime.dll @@ -110,22 +118,113 @@ namespace Microsoft.ML.OnnxRuntime.Tests // Restore the default dll search order SetDllDirectory(null); +#else + try + { + opt.AppendExecutionProvider_DML(0); + } + catch (OnnxRuntimeException ortEx) + { + Assert.Contains("is not enabled in this build", ortEx.Message); + } +#endif +#if USE_DNNL + opt.AppendExecutionProvider_Dnnl(0); +#else + try + { + opt.AppendExecutionProvider_Dnnl(0); + } + catch (OnnxRuntimeException ortEx) + { + Assert.Contains("Failed to load shared library", ortEx.Message); + } #endif -#if USE_OPENVINO - opt.AppendExecutionProvider_OpenVINO(); -#endif -#if USE_TENSORRT - opt.AppendExecutionProvider_Tensorrt(0); -#endif + #if USE_MIGRAPHX opt.AppendExecutionProvider_MIGraphX(0); +#else + try + { + opt.AppendExecutionProvider_MIGraphX(0); + } + catch (OnnxRuntimeException ortEx) + { + Assert.Contains("is not enabled in this build", ortEx.Message); + } + #endif + #if USE_NNAPI opt.AppendExecutionProvider_Nnapi(0); +#else + try + { + opt.AppendExecutionProvider_Nnapi(0); + } + catch (OnnxRuntimeException ortEx) + { + Assert.Contains("is not enabled in this build", ortEx.Message); + } + #endif +#if USE_NUPHAR + opt.AppendExecutionProvider_Nuphar(); +#else + try + { + opt.AppendExecutionProvider_Nnapi(); + } + catch (OnnxRuntimeException ortEx) + { + Assert.Contains("is not enabled in this build", ortEx.Message); + } +#endif + +#if USE_OPENVINO + opt.AppendExecutionProvider_OpenVINO(); +#else + try + { + opt.AppendExecutionProvider_OpenVINO(); + } + catch (OnnxRuntimeException ortEx) + { + Assert.Contains("Failed to load shared library", ortEx.Message); + } + +#endif + +#if USE_ROCM + opt.AppendExecutionProvider_ROCM(0); +#else + try + { + var gpuMemLimit = new UIntPtr(10*1024); + opt.AppendExecutionProvider_ROCM(0, gpuMemLimit); + } + catch (OnnxRuntimeException ortEx) + { + Assert.Contains("is not enabled in this build", ortEx.Message); + } + +#endif + +#if USE_TENSORRT + opt.AppendExecutionProvider_Tensorrt(0); +#else + try + { + opt.AppendExecutionProvider_Dnnl(0); + } + catch (OnnxRuntimeException ortEx) + { + Assert.Contains("Failed to load shared library", ortEx.Message); + } +#endif } } diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/Microsoft.ML.OnnxRuntime.Tests.csproj b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/Microsoft.ML.OnnxRuntime.Tests.csproj index cfb5a5a8f2..68ee6c8ee3 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/Microsoft.ML.OnnxRuntime.Tests.csproj +++ b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/Microsoft.ML.OnnxRuntime.Tests.csproj @@ -3,7 +3,7 @@ netcoreapp2.1 false - ..\.. + $(ProjectDir)..\.. AnyCPU;x86 bin\$(Configuration)\ false @@ -72,30 +72,35 @@ - + + + + + + - Always + PreserveNewest false - Always + PreserveNewest false - Always + PreserveNewest false - Always + PreserveNewest false - Always + PreserveNewest false diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/OnnxMl.cs b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/OnnxMl.cs deleted file mode 100644 index ab3b02749f..0000000000 --- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/OnnxMl.cs +++ /dev/null @@ -1,6870 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: onnx-ml.proto3 -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Onnx { - - /// Holder for reflection information generated from onnx-ml.proto3 - public static partial class OnnxMlReflection { - - #region Descriptor - /// File descriptor for onnx-ml.proto3 - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static OnnxMlReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Cg5vbm54LW1sLnByb3RvMxIEb25ueCLoBAoOQXR0cmlidXRlUHJvdG8SDAoE", - "bmFtZRgBIAEoCRIVCg1yZWZfYXR0cl9uYW1lGBUgASgJEhIKCmRvY19zdHJp", - "bmcYDSABKAkSMAoEdHlwZRgUIAEoDjIiLm9ubnguQXR0cmlidXRlUHJvdG8u", - "QXR0cmlidXRlVHlwZRIJCgFmGAIgASgCEgkKAWkYAyABKAMSCQoBcxgEIAEo", - "DBIcCgF0GAUgASgLMhEub25ueC5UZW5zb3JQcm90bxIbCgFnGAYgASgLMhAu", - "b25ueC5HcmFwaFByb3RvEi4KDXNwYXJzZV90ZW5zb3IYFiABKAsyFy5vbm54", - "LlNwYXJzZVRlbnNvclByb3RvEg4KBmZsb2F0cxgHIAMoAhIMCgRpbnRzGAgg", - "AygDEg8KB3N0cmluZ3MYCSADKAwSIgoHdGVuc29ycxgKIAMoCzIRLm9ubngu", - "VGVuc29yUHJvdG8SIAoGZ3JhcGhzGAsgAygLMhAub25ueC5HcmFwaFByb3Rv", - "Ei8KDnNwYXJzZV90ZW5zb3JzGBcgAygLMhcub25ueC5TcGFyc2VUZW5zb3JQ", - "cm90byK4AQoNQXR0cmlidXRlVHlwZRINCglVTkRFRklORUQQABIJCgVGTE9B", - "VBABEgcKA0lOVBACEgoKBlNUUklORxADEgoKBlRFTlNPUhAEEgkKBUdSQVBI", - "EAUSEQoNU1BBUlNFX1RFTlNPUhALEgoKBkZMT0FUUxAGEggKBElOVFMQBxIL", - "CgdTVFJJTkdTEAgSCwoHVEVOU09SUxAJEgoKBkdSQVBIUxAKEhIKDlNQQVJT", - "RV9URU5TT1JTEAwiUQoOVmFsdWVJbmZvUHJvdG8SDAoEbmFtZRgBIAEoCRId", - "CgR0eXBlGAIgASgLMg8ub25ueC5UeXBlUHJvdG8SEgoKZG9jX3N0cmluZxgD", - "IAEoCSKWAQoJTm9kZVByb3RvEg0KBWlucHV0GAEgAygJEg4KBm91dHB1dBgC", - "IAMoCRIMCgRuYW1lGAMgASgJEg8KB29wX3R5cGUYBCABKAkSDgoGZG9tYWlu", - "GAcgASgJEicKCWF0dHJpYnV0ZRgFIAMoCzIULm9ubnguQXR0cmlidXRlUHJv", - "dG8SEgoKZG9jX3N0cmluZxgGIAEoCSLWAQoRVHJhaW5pbmdJbmZvUHJvdG8S", - "KAoOaW5pdGlhbGl6YXRpb24YASABKAsyEC5vbm54LkdyYXBoUHJvdG8SIwoJ", - "YWxnb3JpdGhtGAIgASgLMhAub25ueC5HcmFwaFByb3RvEjwKFmluaXRpYWxp", - "emF0aW9uX2JpbmRpbmcYAyADKAsyHC5vbm54LlN0cmluZ1N0cmluZ0VudHJ5", - "UHJvdG8SNAoOdXBkYXRlX2JpbmRpbmcYBCADKAsyHC5vbm54LlN0cmluZ1N0", - "cmluZ0VudHJ5UHJvdG8iwwIKCk1vZGVsUHJvdG8SEgoKaXJfdmVyc2lvbhgB", - "IAEoAxIuCgxvcHNldF9pbXBvcnQYCCADKAsyGC5vbm54Lk9wZXJhdG9yU2V0", - "SWRQcm90bxIVCg1wcm9kdWNlcl9uYW1lGAIgASgJEhgKEHByb2R1Y2VyX3Zl", - "cnNpb24YAyABKAkSDgoGZG9tYWluGAQgASgJEhUKDW1vZGVsX3ZlcnNpb24Y", - "BSABKAMSEgoKZG9jX3N0cmluZxgGIAEoCRIfCgVncmFwaBgHIAEoCzIQLm9u", - "bnguR3JhcGhQcm90bxI0Cg5tZXRhZGF0YV9wcm9wcxgOIAMoCzIcLm9ubngu", - "U3RyaW5nU3RyaW5nRW50cnlQcm90bxIuCg10cmFpbmluZ19pbmZvGBQgAygL", - "Mhcub25ueC5UcmFpbmluZ0luZm9Qcm90byI0ChZTdHJpbmdTdHJpbmdFbnRy", - "eVByb3RvEgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCSJrChBUZW5zb3JB", - "bm5vdGF0aW9uEhMKC3RlbnNvcl9uYW1lGAEgASgJEkIKHHF1YW50X3BhcmFt", - "ZXRlcl90ZW5zb3JfbmFtZXMYAiADKAsyHC5vbm54LlN0cmluZ1N0cmluZ0Vu", - "dHJ5UHJvdG8i2AIKCkdyYXBoUHJvdG8SHQoEbm9kZRgBIAMoCzIPLm9ubngu", - "Tm9kZVByb3RvEgwKBG5hbWUYAiABKAkSJgoLaW5pdGlhbGl6ZXIYBSADKAsy", - "ES5vbm54LlRlbnNvclByb3RvEjMKEnNwYXJzZV9pbml0aWFsaXplchgPIAMo", - "CzIXLm9ubnguU3BhcnNlVGVuc29yUHJvdG8SEgoKZG9jX3N0cmluZxgKIAEo", - "CRIjCgVpbnB1dBgLIAMoCzIULm9ubnguVmFsdWVJbmZvUHJvdG8SJAoGb3V0", - "cHV0GAwgAygLMhQub25ueC5WYWx1ZUluZm9Qcm90bxIoCgp2YWx1ZV9pbmZv", - "GA0gAygLMhQub25ueC5WYWx1ZUluZm9Qcm90bxI3ChdxdWFudGl6YXRpb25f", - "YW5ub3RhdGlvbhgOIAMoCzIWLm9ubnguVGVuc29yQW5ub3RhdGlvbiK4BQoL", - "VGVuc29yUHJvdG8SDAoEZGltcxgBIAMoAxIRCglkYXRhX3R5cGUYAiABKAUS", - "KgoHc2VnbWVudBgDIAEoCzIZLm9ubnguVGVuc29yUHJvdG8uU2VnbWVudBIW", - "CgpmbG9hdF9kYXRhGAQgAygCQgIQARIWCgppbnQzMl9kYXRhGAUgAygFQgIQ", - "ARITCgtzdHJpbmdfZGF0YRgGIAMoDBIWCgppbnQ2NF9kYXRhGAcgAygDQgIQ", - "ARIMCgRuYW1lGAggASgJEhIKCmRvY19zdHJpbmcYDCABKAkSEAoIcmF3X2Rh", - "dGEYCSABKAwSMwoNZXh0ZXJuYWxfZGF0YRgNIAMoCzIcLm9ubnguU3RyaW5n", - "U3RyaW5nRW50cnlQcm90bxI1Cg1kYXRhX2xvY2F0aW9uGA4gASgOMh4ub25u", - "eC5UZW5zb3JQcm90by5EYXRhTG9jYXRpb24SFwoLZG91YmxlX2RhdGEYCiAD", - "KAFCAhABEhcKC3VpbnQ2NF9kYXRhGAsgAygEQgIQARolCgdTZWdtZW50Eg0K", - "BWJlZ2luGAEgASgDEgsKA2VuZBgCIAEoAyLaAQoIRGF0YVR5cGUSDQoJVU5E", - "RUZJTkVEEAASCQoFRkxPQVQQARIJCgVVSU5UOBACEggKBElOVDgQAxIKCgZV", - "SU5UMTYQBBIJCgVJTlQxNhAFEgkKBUlOVDMyEAYSCQoFSU5UNjQQBxIKCgZT", - "VFJJTkcQCBIICgRCT09MEAkSCwoHRkxPQVQxNhAKEgoKBkRPVUJMRRALEgoK", - "BlVJTlQzMhAMEgoKBlVJTlQ2NBANEg0KCUNPTVBMRVg2NBAOEg4KCkNPTVBM", - "RVgxMjgQDxIMCghCRkxPQVQxNhAQIikKDERhdGFMb2NhdGlvbhILCgdERUZB", - "VUxUEAASDAoIRVhURVJOQUwQASJoChFTcGFyc2VUZW5zb3JQcm90bxIhCgZ2", - "YWx1ZXMYASABKAsyES5vbm54LlRlbnNvclByb3RvEiIKB2luZGljZXMYAiAB", - "KAsyES5vbm54LlRlbnNvclByb3RvEgwKBGRpbXMYAyADKAMilQEKEFRlbnNv", - "clNoYXBlUHJvdG8SLQoDZGltGAEgAygLMiAub25ueC5UZW5zb3JTaGFwZVBy", - "b3RvLkRpbWVuc2lvbhpSCglEaW1lbnNpb24SEwoJZGltX3ZhbHVlGAEgASgD", - "SAASEwoJZGltX3BhcmFtGAIgASgJSAASEgoKZGVub3RhdGlvbhgDIAEoCUIH", - "CgV2YWx1ZSLCBAoJVHlwZVByb3RvEi0KC3RlbnNvcl90eXBlGAEgASgLMhYu", - "b25ueC5UeXBlUHJvdG8uVGVuc29ySAASMQoNc2VxdWVuY2VfdHlwZRgEIAEo", - "CzIYLm9ubnguVHlwZVByb3RvLlNlcXVlbmNlSAASJwoIbWFwX3R5cGUYBSAB", - "KAsyEy5vbm54LlR5cGVQcm90by5NYXBIABI6ChJzcGFyc2VfdGVuc29yX3R5", - "cGUYCCABKAsyHC5vbm54LlR5cGVQcm90by5TcGFyc2VUZW5zb3JIABItCgtv", - "cGFxdWVfdHlwZRgHIAEoCzIWLm9ubnguVHlwZVByb3RvLk9wYXF1ZUgAEhIK", - "CmRlbm90YXRpb24YBiABKAkaQgoGVGVuc29yEhEKCWVsZW1fdHlwZRgBIAEo", - "BRIlCgVzaGFwZRgCIAEoCzIWLm9ubnguVGVuc29yU2hhcGVQcm90bxouCghT", - "ZXF1ZW5jZRIiCgllbGVtX3R5cGUYASABKAsyDy5vbm54LlR5cGVQcm90bxo8", - "CgNNYXASEAoIa2V5X3R5cGUYASABKAUSIwoKdmFsdWVfdHlwZRgCIAEoCzIP", - "Lm9ubnguVHlwZVByb3RvGkgKDFNwYXJzZVRlbnNvchIRCgllbGVtX3R5cGUY", - "ASABKAUSJQoFc2hhcGUYAiABKAsyFi5vbm54LlRlbnNvclNoYXBlUHJvdG8a", - "JgoGT3BhcXVlEg4KBmRvbWFpbhgBIAEoCRIMCgRuYW1lGAIgASgJQgcKBXZh", - "bHVlIjUKEk9wZXJhdG9yU2V0SWRQcm90bxIOCgZkb21haW4YASABKAkSDwoH", - "dmVyc2lvbhgCIAEoAyrLAQoHVmVyc2lvbhISCg5fU1RBUlRfVkVSU0lPThAA", - "EhkKFUlSX1ZFUlNJT05fMjAxN18xMF8xMBABEhkKFUlSX1ZFUlNJT05fMjAx", - "N18xMF8zMBACEhgKFElSX1ZFUlNJT05fMjAxN18xMV8zEAMSGAoUSVJfVkVS", - "U0lPTl8yMDE5XzFfMjIQBBIYChRJUl9WRVJTSU9OXzIwMTlfM18xOBAFEhgK", - "FElSX1ZFUlNJT05fMjAxOV85XzE5EAYSDgoKSVJfVkVSU0lPThAHQgJIA2IG", - "cHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Onnx.Version), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.AttributeProto), global::Onnx.AttributeProto.Parser, new[]{ "Name", "RefAttrName", "DocString", "Type", "F", "I", "S", "T", "G", "SparseTensor", "Floats", "Ints", "Strings", "Tensors", "Graphs", "SparseTensors" }, null, new[]{ typeof(global::Onnx.AttributeProto.Types.AttributeType) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.ValueInfoProto), global::Onnx.ValueInfoProto.Parser, new[]{ "Name", "Type", "DocString" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.NodeProto), global::Onnx.NodeProto.Parser, new[]{ "Input", "Output", "Name", "OpType", "Domain", "Attribute", "DocString" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TrainingInfoProto), global::Onnx.TrainingInfoProto.Parser, new[]{ "Initialization", "Algorithm", "InitializationBinding", "UpdateBinding" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.ModelProto), global::Onnx.ModelProto.Parser, new[]{ "IrVersion", "OpsetImport", "ProducerName", "ProducerVersion", "Domain", "ModelVersion", "DocString", "Graph", "MetadataProps", "TrainingInfo" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.StringStringEntryProto), global::Onnx.StringStringEntryProto.Parser, new[]{ "Key", "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TensorAnnotation), global::Onnx.TensorAnnotation.Parser, new[]{ "TensorName", "QuantParameterTensorNames" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.GraphProto), global::Onnx.GraphProto.Parser, new[]{ "Node", "Name", "Initializer", "SparseInitializer", "DocString", "Input", "Output", "ValueInfo", "QuantizationAnnotation" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TensorProto), global::Onnx.TensorProto.Parser, new[]{ "Dims", "DataType", "Segment", "FloatData", "Int32Data", "StringData", "Int64Data", "Name", "DocString", "RawData", "ExternalData", "DataLocation", "DoubleData", "Uint64Data" }, null, new[]{ typeof(global::Onnx.TensorProto.Types.DataType), typeof(global::Onnx.TensorProto.Types.DataLocation) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TensorProto.Types.Segment), global::Onnx.TensorProto.Types.Segment.Parser, new[]{ "Begin", "End" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.SparseTensorProto), global::Onnx.SparseTensorProto.Parser, new[]{ "Values", "Indices", "Dims" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TensorShapeProto), global::Onnx.TensorShapeProto.Parser, new[]{ "Dim" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TensorShapeProto.Types.Dimension), global::Onnx.TensorShapeProto.Types.Dimension.Parser, new[]{ "DimValue", "DimParam", "Denotation" }, new[]{ "Value" }, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto), global::Onnx.TypeProto.Parser, new[]{ "TensorType", "SequenceType", "MapType", "SparseTensorType", "OpaqueType", "Denotation" }, new[]{ "Value" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto.Types.Tensor), global::Onnx.TypeProto.Types.Tensor.Parser, new[]{ "ElemType", "Shape" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto.Types.Sequence), global::Onnx.TypeProto.Types.Sequence.Parser, new[]{ "ElemType" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto.Types.Map), global::Onnx.TypeProto.Types.Map.Parser, new[]{ "KeyType", "ValueType" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto.Types.SparseTensor), global::Onnx.TypeProto.Types.SparseTensor.Parser, new[]{ "ElemType", "Shape" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto.Types.Opaque), global::Onnx.TypeProto.Types.Opaque.Parser, new[]{ "Domain", "Name" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.OperatorSetIdProto), global::Onnx.OperatorSetIdProto.Parser, new[]{ "Domain", "Version" }, null, null, null, null) - })); - } - #endregion - - } - #region Enums - /// - /// Versioning - /// - /// ONNX versioning is specified in docs/IR.md and elaborated on in docs/Versioning.md - /// - /// To be compatible with both proto2 and proto3, we will use a version number - /// that is not defined by the default value but an explicit enum number. - /// - public enum Version { - /// - /// proto3 requires the first enum value to be zero. - /// We add this just to appease the compiler. - /// - [pbr::OriginalName("_START_VERSION")] StartVersion = 0, - /// - /// The version field is always serialized and we will use it to store the - /// version that the graph is generated from. This helps us set up version - /// control. - /// For the IR, we are using simple numbers starting with 0x00000001, - /// which was the version we published on Oct 10, 2017. - /// - [pbr::OriginalName("IR_VERSION_2017_10_10")] IrVersion20171010 = 1, - /// - /// IR_VERSION 2 published on Oct 30, 2017 - /// - Added type discriminator to AttributeProto to support proto3 users - /// - [pbr::OriginalName("IR_VERSION_2017_10_30")] IrVersion20171030 = 2, - /// - /// IR VERSION 3 published on Nov 3, 2017 - /// - For operator versioning: - /// - Added new message OperatorSetIdProto - /// - Added opset_import in ModelProto - /// - For vendor extensions, added domain in NodeProto - /// - [pbr::OriginalName("IR_VERSION_2017_11_3")] IrVersion2017113 = 3, - /// - /// IR VERSION 4 published on Jan 22, 2019 - /// - Relax constraint that initializers should be a subset of graph inputs - /// - Add type BFLOAT16 - /// - [pbr::OriginalName("IR_VERSION_2019_1_22")] IrVersion2019122 = 4, - /// - /// IR VERSION 5 published on March 18, 2019 - /// - Add message TensorAnnotation. - /// - Add quantization annotation in GraphProto to map tensor with its scale and zero point quantization parameters. - /// - [pbr::OriginalName("IR_VERSION_2019_3_18")] IrVersion2019318 = 5, - /// - /// IR VERSION 6 published on Sep 19, 2019 - /// - Add support for sparse tensor constants stored in model. - /// - Add message SparseTensorProto - /// - Add sparse initializers - /// - [pbr::OriginalName("IR_VERSION_2019_9_19")] IrVersion2019919 = 6, - /// - /// IR VERSION 7 published on <TBD> - /// - Add support to allow function body graph to rely on multiple external opreator sets. - /// - Add a list to promote inference graph's initializers to global and - /// mutable variables. Global variables are visible in all graphs of the - /// stored models. - /// - Add message TrainingInfoProto to store initialization - /// method and training algorithm. The execution of TrainingInfoProto - /// can modify the values of mutable variables. - /// - Implicitly add inference graph into each TrainingInfoProto's algorithm. - /// - [pbr::OriginalName("IR_VERSION")] IrVersion = 7, - } - - #endregion - - #region Messages - /// - /// Attributes - /// - /// A named attribute containing either singular float, integer, string, graph, - /// and tensor values, or repeated float, integer, string, graph, and tensor values. - /// An AttributeProto MUST contain the name field, and *only one* of the - /// following content fields, effectively enforcing a C/C++ union equivalent. - /// - public sealed partial class AttributeProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AttributeProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AttributeProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AttributeProto(AttributeProto other) : this() { - name_ = other.name_; - refAttrName_ = other.refAttrName_; - docString_ = other.docString_; - type_ = other.type_; - f_ = other.f_; - i_ = other.i_; - s_ = other.s_; - t_ = other.t_ != null ? other.t_.Clone() : null; - g_ = other.g_ != null ? other.g_.Clone() : null; - sparseTensor_ = other.sparseTensor_ != null ? other.sparseTensor_.Clone() : null; - floats_ = other.floats_.Clone(); - ints_ = other.ints_.Clone(); - strings_ = other.strings_.Clone(); - tensors_ = other.tensors_.Clone(); - graphs_ = other.graphs_.Clone(); - sparseTensors_ = other.sparseTensors_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AttributeProto Clone() { - return new AttributeProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// The name field MUST be present for this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "ref_attr_name" field. - public const int RefAttrNameFieldNumber = 21; - private string refAttrName_ = ""; - /// - /// if ref_attr_name is not empty, ref_attr_name is the attribute name in parent function. - /// In this case, this AttributeProto does not contain data, and it's a reference of attribute - /// in parent scope. - /// NOTE: This should ONLY be used in function (sub-graph). It's invalid to be used in main graph. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string RefAttrName { - get { return refAttrName_; } - set { - refAttrName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 13; - private string docString_ = ""; - /// - /// A human-readable documentation for this attribute. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 20; - private global::Onnx.AttributeProto.Types.AttributeType type_ = global::Onnx.AttributeProto.Types.AttributeType.Undefined; - /// - /// The type field MUST be present for this version of the IR. - /// For 0.0.1 versions of the IR, this field was not defined, and - /// implementations needed to use has_field heuristics to determine - /// which value field was in use. For IR_VERSION 0.0.2 or later, this - /// field MUST be set and match the f|i|s|t|... field in use. This - /// change was made to accommodate proto3 implementations. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.AttributeProto.Types.AttributeType Type { - get { return type_; } - set { - type_ = value; - } - } - - /// Field number for the "f" field. - public const int FFieldNumber = 2; - private float f_; - /// - /// Exactly ONE of the following fields must be present for this version of the IR - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public float F { - get { return f_; } - set { - f_ = value; - } - } - - /// Field number for the "i" field. - public const int IFieldNumber = 3; - private long i_; - /// - /// int - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long I { - get { return i_; } - set { - i_ = value; - } - } - - /// Field number for the "s" field. - public const int SFieldNumber = 4; - private pb::ByteString s_ = pb::ByteString.Empty; - /// - /// UTF-8 string - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString S { - get { return s_; } - set { - s_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "t" field. - public const int TFieldNumber = 5; - private global::Onnx.TensorProto t_; - /// - /// tensor value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorProto T { - get { return t_; } - set { - t_ = value; - } - } - - /// Field number for the "g" field. - public const int GFieldNumber = 6; - private global::Onnx.GraphProto g_; - /// - /// graph - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.GraphProto G { - get { return g_; } - set { - g_ = value; - } - } - - /// Field number for the "sparse_tensor" field. - public const int SparseTensorFieldNumber = 22; - private global::Onnx.SparseTensorProto sparseTensor_; - /// - /// sparse tensor value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.SparseTensorProto SparseTensor { - get { return sparseTensor_; } - set { - sparseTensor_ = value; - } - } - - /// Field number for the "floats" field. - public const int FloatsFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_floats_codec - = pb::FieldCodec.ForFloat(58); - private readonly pbc::RepeatedField floats_ = new pbc::RepeatedField(); - /// - /// list of floats - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Floats { - get { return floats_; } - } - - /// Field number for the "ints" field. - public const int IntsFieldNumber = 8; - private static readonly pb::FieldCodec _repeated_ints_codec - = pb::FieldCodec.ForInt64(66); - private readonly pbc::RepeatedField ints_ = new pbc::RepeatedField(); - /// - /// list of ints - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Ints { - get { return ints_; } - } - - /// Field number for the "strings" field. - public const int StringsFieldNumber = 9; - private static readonly pb::FieldCodec _repeated_strings_codec - = pb::FieldCodec.ForBytes(74); - private readonly pbc::RepeatedField strings_ = new pbc::RepeatedField(); - /// - /// list of UTF-8 strings - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Strings { - get { return strings_; } - } - - /// Field number for the "tensors" field. - public const int TensorsFieldNumber = 10; - private static readonly pb::FieldCodec _repeated_tensors_codec - = pb::FieldCodec.ForMessage(82, global::Onnx.TensorProto.Parser); - private readonly pbc::RepeatedField tensors_ = new pbc::RepeatedField(); - /// - /// list of tensors - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Tensors { - get { return tensors_; } - } - - /// Field number for the "graphs" field. - public const int GraphsFieldNumber = 11; - private static readonly pb::FieldCodec _repeated_graphs_codec - = pb::FieldCodec.ForMessage(90, global::Onnx.GraphProto.Parser); - private readonly pbc::RepeatedField graphs_ = new pbc::RepeatedField(); - /// - /// list of graph - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Graphs { - get { return graphs_; } - } - - /// Field number for the "sparse_tensors" field. - public const int SparseTensorsFieldNumber = 23; - private static readonly pb::FieldCodec _repeated_sparseTensors_codec - = pb::FieldCodec.ForMessage(186, global::Onnx.SparseTensorProto.Parser); - private readonly pbc::RepeatedField sparseTensors_ = new pbc::RepeatedField(); - /// - /// list of sparse tensors - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField SparseTensors { - get { return sparseTensors_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AttributeProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AttributeProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (RefAttrName != other.RefAttrName) return false; - if (DocString != other.DocString) return false; - if (Type != other.Type) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(F, other.F)) return false; - if (I != other.I) return false; - if (S != other.S) return false; - if (!object.Equals(T, other.T)) return false; - if (!object.Equals(G, other.G)) return false; - if (!object.Equals(SparseTensor, other.SparseTensor)) return false; - if(!floats_.Equals(other.floats_)) return false; - if(!ints_.Equals(other.ints_)) return false; - if(!strings_.Equals(other.strings_)) return false; - if(!tensors_.Equals(other.tensors_)) return false; - if(!graphs_.Equals(other.graphs_)) return false; - if(!sparseTensors_.Equals(other.sparseTensors_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (RefAttrName.Length != 0) hash ^= RefAttrName.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - if (Type != global::Onnx.AttributeProto.Types.AttributeType.Undefined) hash ^= Type.GetHashCode(); - if (F != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(F); - if (I != 0L) hash ^= I.GetHashCode(); - if (S.Length != 0) hash ^= S.GetHashCode(); - if (t_ != null) hash ^= T.GetHashCode(); - if (g_ != null) hash ^= G.GetHashCode(); - if (sparseTensor_ != null) hash ^= SparseTensor.GetHashCode(); - hash ^= floats_.GetHashCode(); - hash ^= ints_.GetHashCode(); - hash ^= strings_.GetHashCode(); - hash ^= tensors_.GetHashCode(); - hash ^= graphs_.GetHashCode(); - hash ^= sparseTensors_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (F != 0F) { - output.WriteRawTag(21); - output.WriteFloat(F); - } - if (I != 0L) { - output.WriteRawTag(24); - output.WriteInt64(I); - } - if (S.Length != 0) { - output.WriteRawTag(34); - output.WriteBytes(S); - } - if (t_ != null) { - output.WriteRawTag(42); - output.WriteMessage(T); - } - if (g_ != null) { - output.WriteRawTag(50); - output.WriteMessage(G); - } - floats_.WriteTo(output, _repeated_floats_codec); - ints_.WriteTo(output, _repeated_ints_codec); - strings_.WriteTo(output, _repeated_strings_codec); - tensors_.WriteTo(output, _repeated_tensors_codec); - graphs_.WriteTo(output, _repeated_graphs_codec); - if (DocString.Length != 0) { - output.WriteRawTag(106); - output.WriteString(DocString); - } - if (Type != global::Onnx.AttributeProto.Types.AttributeType.Undefined) { - output.WriteRawTag(160, 1); - output.WriteEnum((int) Type); - } - if (RefAttrName.Length != 0) { - output.WriteRawTag(170, 1); - output.WriteString(RefAttrName); - } - if (sparseTensor_ != null) { - output.WriteRawTag(178, 1); - output.WriteMessage(SparseTensor); - } - sparseTensors_.WriteTo(output, _repeated_sparseTensors_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (F != 0F) { - output.WriteRawTag(21); - output.WriteFloat(F); - } - if (I != 0L) { - output.WriteRawTag(24); - output.WriteInt64(I); - } - if (S.Length != 0) { - output.WriteRawTag(34); - output.WriteBytes(S); - } - if (t_ != null) { - output.WriteRawTag(42); - output.WriteMessage(T); - } - if (g_ != null) { - output.WriteRawTag(50); - output.WriteMessage(G); - } - floats_.WriteTo(ref output, _repeated_floats_codec); - ints_.WriteTo(ref output, _repeated_ints_codec); - strings_.WriteTo(ref output, _repeated_strings_codec); - tensors_.WriteTo(ref output, _repeated_tensors_codec); - graphs_.WriteTo(ref output, _repeated_graphs_codec); - if (DocString.Length != 0) { - output.WriteRawTag(106); - output.WriteString(DocString); - } - if (Type != global::Onnx.AttributeProto.Types.AttributeType.Undefined) { - output.WriteRawTag(160, 1); - output.WriteEnum((int) Type); - } - if (RefAttrName.Length != 0) { - output.WriteRawTag(170, 1); - output.WriteString(RefAttrName); - } - if (sparseTensor_ != null) { - output.WriteRawTag(178, 1); - output.WriteMessage(SparseTensor); - } - sparseTensors_.WriteTo(ref output, _repeated_sparseTensors_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (RefAttrName.Length != 0) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(RefAttrName); - } - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - if (Type != global::Onnx.AttributeProto.Types.AttributeType.Undefined) { - size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) Type); - } - if (F != 0F) { - size += 1 + 4; - } - if (I != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(I); - } - if (S.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(S); - } - if (t_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(T); - } - if (g_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(G); - } - if (sparseTensor_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(SparseTensor); - } - size += floats_.CalculateSize(_repeated_floats_codec); - size += ints_.CalculateSize(_repeated_ints_codec); - size += strings_.CalculateSize(_repeated_strings_codec); - size += tensors_.CalculateSize(_repeated_tensors_codec); - size += graphs_.CalculateSize(_repeated_graphs_codec); - size += sparseTensors_.CalculateSize(_repeated_sparseTensors_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AttributeProto other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.RefAttrName.Length != 0) { - RefAttrName = other.RefAttrName; - } - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - if (other.Type != global::Onnx.AttributeProto.Types.AttributeType.Undefined) { - Type = other.Type; - } - if (other.F != 0F) { - F = other.F; - } - if (other.I != 0L) { - I = other.I; - } - if (other.S.Length != 0) { - S = other.S; - } - if (other.t_ != null) { - if (t_ == null) { - T = new global::Onnx.TensorProto(); - } - T.MergeFrom(other.T); - } - if (other.g_ != null) { - if (g_ == null) { - G = new global::Onnx.GraphProto(); - } - G.MergeFrom(other.G); - } - if (other.sparseTensor_ != null) { - if (sparseTensor_ == null) { - SparseTensor = new global::Onnx.SparseTensorProto(); - } - SparseTensor.MergeFrom(other.SparseTensor); - } - floats_.Add(other.floats_); - ints_.Add(other.ints_); - strings_.Add(other.strings_); - tensors_.Add(other.tensors_); - graphs_.Add(other.graphs_); - sparseTensors_.Add(other.sparseTensors_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 21: { - F = input.ReadFloat(); - break; - } - case 24: { - I = input.ReadInt64(); - break; - } - case 34: { - S = input.ReadBytes(); - break; - } - case 42: { - if (t_ == null) { - T = new global::Onnx.TensorProto(); - } - input.ReadMessage(T); - break; - } - case 50: { - if (g_ == null) { - G = new global::Onnx.GraphProto(); - } - input.ReadMessage(G); - break; - } - case 58: - case 61: { - floats_.AddEntriesFrom(input, _repeated_floats_codec); - break; - } - case 66: - case 64: { - ints_.AddEntriesFrom(input, _repeated_ints_codec); - break; - } - case 74: { - strings_.AddEntriesFrom(input, _repeated_strings_codec); - break; - } - case 82: { - tensors_.AddEntriesFrom(input, _repeated_tensors_codec); - break; - } - case 90: { - graphs_.AddEntriesFrom(input, _repeated_graphs_codec); - break; - } - case 106: { - DocString = input.ReadString(); - break; - } - case 160: { - Type = (global::Onnx.AttributeProto.Types.AttributeType) input.ReadEnum(); - break; - } - case 170: { - RefAttrName = input.ReadString(); - break; - } - case 178: { - if (sparseTensor_ == null) { - SparseTensor = new global::Onnx.SparseTensorProto(); - } - input.ReadMessage(SparseTensor); - break; - } - case 186: { - sparseTensors_.AddEntriesFrom(input, _repeated_sparseTensors_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 21: { - F = input.ReadFloat(); - break; - } - case 24: { - I = input.ReadInt64(); - break; - } - case 34: { - S = input.ReadBytes(); - break; - } - case 42: { - if (t_ == null) { - T = new global::Onnx.TensorProto(); - } - input.ReadMessage(T); - break; - } - case 50: { - if (g_ == null) { - G = new global::Onnx.GraphProto(); - } - input.ReadMessage(G); - break; - } - case 58: - case 61: { - floats_.AddEntriesFrom(ref input, _repeated_floats_codec); - break; - } - case 66: - case 64: { - ints_.AddEntriesFrom(ref input, _repeated_ints_codec); - break; - } - case 74: { - strings_.AddEntriesFrom(ref input, _repeated_strings_codec); - break; - } - case 82: { - tensors_.AddEntriesFrom(ref input, _repeated_tensors_codec); - break; - } - case 90: { - graphs_.AddEntriesFrom(ref input, _repeated_graphs_codec); - break; - } - case 106: { - DocString = input.ReadString(); - break; - } - case 160: { - Type = (global::Onnx.AttributeProto.Types.AttributeType) input.ReadEnum(); - break; - } - case 170: { - RefAttrName = input.ReadString(); - break; - } - case 178: { - if (sparseTensor_ == null) { - SparseTensor = new global::Onnx.SparseTensorProto(); - } - input.ReadMessage(SparseTensor); - break; - } - case 186: { - sparseTensors_.AddEntriesFrom(ref input, _repeated_sparseTensors_codec); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the AttributeProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - /// - /// Note: this enum is structurally identical to the OpSchema::AttrType - /// enum defined in schema.h. If you rev one, you likely need to rev the other. - /// - public enum AttributeType { - [pbr::OriginalName("UNDEFINED")] Undefined = 0, - [pbr::OriginalName("FLOAT")] Float = 1, - [pbr::OriginalName("INT")] Int = 2, - [pbr::OriginalName("STRING")] String = 3, - [pbr::OriginalName("TENSOR")] Tensor = 4, - [pbr::OriginalName("GRAPH")] Graph = 5, - [pbr::OriginalName("SPARSE_TENSOR")] SparseTensor = 11, - [pbr::OriginalName("FLOATS")] Floats = 6, - [pbr::OriginalName("INTS")] Ints = 7, - [pbr::OriginalName("STRINGS")] Strings = 8, - [pbr::OriginalName("TENSORS")] Tensors = 9, - [pbr::OriginalName("GRAPHS")] Graphs = 10, - [pbr::OriginalName("SPARSE_TENSORS")] SparseTensors = 12, - } - - } - #endregion - - } - - /// - /// Defines information on value, including the name, the type, and - /// the shape of the value. - /// - public sealed partial class ValueInfoProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ValueInfoProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValueInfoProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValueInfoProto(ValueInfoProto other) : this() { - name_ = other.name_; - type_ = other.type_ != null ? other.type_.Clone() : null; - docString_ = other.docString_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValueInfoProto Clone() { - return new ValueInfoProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// This field MUST be present in this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 2; - private global::Onnx.TypeProto type_; - /// - /// This field MUST be present in this version of the IR for - /// inputs and outputs of the top-level graph. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto Type { - get { return type_; } - set { - type_ = value; - } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 3; - private string docString_ = ""; - /// - /// A human-readable documentation for this value. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ValueInfoProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ValueInfoProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (!object.Equals(Type, other.Type)) return false; - if (DocString != other.DocString) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (type_ != null) hash ^= Type.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (type_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Type); - } - if (DocString.Length != 0) { - output.WriteRawTag(26); - output.WriteString(DocString); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (type_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Type); - } - if (DocString.Length != 0) { - output.WriteRawTag(26); - output.WriteString(DocString); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (type_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Type); - } - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ValueInfoProto other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.type_ != null) { - if (type_ == null) { - Type = new global::Onnx.TypeProto(); - } - Type.MergeFrom(other.Type); - } - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - if (type_ == null) { - Type = new global::Onnx.TypeProto(); - } - input.ReadMessage(Type); - break; - } - case 26: { - DocString = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - if (type_ == null) { - Type = new global::Onnx.TypeProto(); - } - input.ReadMessage(Type); - break; - } - case 26: { - DocString = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// Nodes - /// - /// Computation graphs are made up of a DAG of nodes, which represent what is - /// commonly called a "layer" or "pipeline stage" in machine learning frameworks. - /// - /// For example, it can be a node of type "Conv" that takes in an image, a filter - /// tensor and a bias tensor, and produces the convolved output. - /// - public sealed partial class NodeProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NodeProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NodeProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NodeProto(NodeProto other) : this() { - input_ = other.input_.Clone(); - output_ = other.output_.Clone(); - name_ = other.name_; - opType_ = other.opType_; - domain_ = other.domain_; - attribute_ = other.attribute_.Clone(); - docString_ = other.docString_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NodeProto Clone() { - return new NodeProto(this); - } - - /// Field number for the "input" field. - public const int InputFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_input_codec - = pb::FieldCodec.ForString(10); - private readonly pbc::RepeatedField input_ = new pbc::RepeatedField(); - /// - /// namespace Value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Input { - get { return input_; } - } - - /// Field number for the "output" field. - public const int OutputFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_output_codec - = pb::FieldCodec.ForString(18); - private readonly pbc::RepeatedField output_ = new pbc::RepeatedField(); - /// - /// namespace Value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Output { - get { return output_; } - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 3; - private string name_ = ""; - /// - /// An optional identifier for this node in a graph. - /// This field MAY be absent in ths version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "op_type" field. - public const int OpTypeFieldNumber = 4; - private string opType_ = ""; - /// - /// The symbolic identifier of the Operator to execute. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string OpType { - get { return opType_; } - set { - opType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "domain" field. - public const int DomainFieldNumber = 7; - private string domain_ = ""; - /// - /// The domain of the OperatorSet that specifies the operator named by op_type. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Domain { - get { return domain_; } - set { - domain_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "attribute" field. - public const int AttributeFieldNumber = 5; - private static readonly pb::FieldCodec _repeated_attribute_codec - = pb::FieldCodec.ForMessage(42, global::Onnx.AttributeProto.Parser); - private readonly pbc::RepeatedField attribute_ = new pbc::RepeatedField(); - /// - /// Additional named attributes. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Attribute { - get { return attribute_; } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 6; - private string docString_ = ""; - /// - /// A human-readable documentation for this node. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as NodeProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(NodeProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!input_.Equals(other.input_)) return false; - if(!output_.Equals(other.output_)) return false; - if (Name != other.Name) return false; - if (OpType != other.OpType) return false; - if (Domain != other.Domain) return false; - if(!attribute_.Equals(other.attribute_)) return false; - if (DocString != other.DocString) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= input_.GetHashCode(); - hash ^= output_.GetHashCode(); - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (OpType.Length != 0) hash ^= OpType.GetHashCode(); - if (Domain.Length != 0) hash ^= Domain.GetHashCode(); - hash ^= attribute_.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - input_.WriteTo(output, _repeated_input_codec); - output_.WriteTo(output, _repeated_output_codec); - if (Name.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Name); - } - if (OpType.Length != 0) { - output.WriteRawTag(34); - output.WriteString(OpType); - } - attribute_.WriteTo(output, _repeated_attribute_codec); - if (DocString.Length != 0) { - output.WriteRawTag(50); - output.WriteString(DocString); - } - if (Domain.Length != 0) { - output.WriteRawTag(58); - output.WriteString(Domain); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - input_.WriteTo(ref output, _repeated_input_codec); - output_.WriteTo(ref output, _repeated_output_codec); - if (Name.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Name); - } - if (OpType.Length != 0) { - output.WriteRawTag(34); - output.WriteString(OpType); - } - attribute_.WriteTo(ref output, _repeated_attribute_codec); - if (DocString.Length != 0) { - output.WriteRawTag(50); - output.WriteString(DocString); - } - if (Domain.Length != 0) { - output.WriteRawTag(58); - output.WriteString(Domain); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += input_.CalculateSize(_repeated_input_codec); - size += output_.CalculateSize(_repeated_output_codec); - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (OpType.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(OpType); - } - if (Domain.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Domain); - } - size += attribute_.CalculateSize(_repeated_attribute_codec); - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(NodeProto other) { - if (other == null) { - return; - } - input_.Add(other.input_); - output_.Add(other.output_); - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.OpType.Length != 0) { - OpType = other.OpType; - } - if (other.Domain.Length != 0) { - Domain = other.Domain; - } - attribute_.Add(other.attribute_); - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - input_.AddEntriesFrom(input, _repeated_input_codec); - break; - } - case 18: { - output_.AddEntriesFrom(input, _repeated_output_codec); - break; - } - case 26: { - Name = input.ReadString(); - break; - } - case 34: { - OpType = input.ReadString(); - break; - } - case 42: { - attribute_.AddEntriesFrom(input, _repeated_attribute_codec); - break; - } - case 50: { - DocString = input.ReadString(); - break; - } - case 58: { - Domain = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - input_.AddEntriesFrom(ref input, _repeated_input_codec); - break; - } - case 18: { - output_.AddEntriesFrom(ref input, _repeated_output_codec); - break; - } - case 26: { - Name = input.ReadString(); - break; - } - case 34: { - OpType = input.ReadString(); - break; - } - case 42: { - attribute_.AddEntriesFrom(ref input, _repeated_attribute_codec); - break; - } - case 50: { - DocString = input.ReadString(); - break; - } - case 58: { - Domain = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// Training information - /// TrainingInfoProto stores information for training a model. - /// In particular, this defines two functionalities: an initialization-step - /// and a training-algorithm-step. Initialization resets the model - /// back to its original state as if no training has been performed. - /// Training algorithm improves the model based on input data. - /// - /// The semantics of the initialization-step is that the initializers - /// in ModelProto.graph and in TrainingInfoProto.algorithm are first - /// initialized as specified by the initializers in the graph, and then - /// updated by the "initialization_binding" in every instance in - /// ModelProto.training_info. - /// - /// The field "algorithm" defines a computation graph which represents a - /// training algorithm's step. After the execution of a - /// TrainingInfoProto.algorithm, the initializers specified by "update_binding" - /// may be immediately updated. If the targeted training algorithm contains - /// consecutive update steps (such as block coordinate descent methods), - /// the user needs to create a TrainingInfoProto for each step. - /// - public sealed partial class TrainingInfoProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TrainingInfoProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TrainingInfoProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TrainingInfoProto(TrainingInfoProto other) : this() { - initialization_ = other.initialization_ != null ? other.initialization_.Clone() : null; - algorithm_ = other.algorithm_ != null ? other.algorithm_.Clone() : null; - initializationBinding_ = other.initializationBinding_.Clone(); - updateBinding_ = other.updateBinding_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TrainingInfoProto Clone() { - return new TrainingInfoProto(this); - } - - /// Field number for the "initialization" field. - public const int InitializationFieldNumber = 1; - private global::Onnx.GraphProto initialization_; - /// - /// This field describes a graph to compute the initial tensors - /// upon starting the training process. Initialization graph has no input - /// and can have multiple outputs. Usually, trainable tensors in neural - /// networks are randomly initialized. To achieve that, for each tensor, - /// the user can put a random number operator such as RandomNormal or - /// RandomUniform in TrainingInfoProto.initialization.node and assign its - /// random output to the specific tensor using "initialization_binding". - /// This graph can also set the initializers in "algorithm" in the same - /// TrainingInfoProto; a use case is resetting the number of training - /// iteration to zero. - /// - /// By default, this field is an empty graph and its evaluation does not - /// produce any output. Thus, no initializer would be changed by default. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.GraphProto Initialization { - get { return initialization_; } - set { - initialization_ = value; - } - } - - /// Field number for the "algorithm" field. - public const int AlgorithmFieldNumber = 2; - private global::Onnx.GraphProto algorithm_; - /// - /// This field represents a training algorithm step. Given required inputs, - /// it computes outputs to update initializers in its own or inference graph's - /// initializer lists. In general, this field contains loss node, gradient node, - /// optimizer node, increment of iteration count. - /// - /// An execution of the training algorithm step is performed by executing the - /// graph obtained by combining the inference graph (namely "ModelProto.graph") - /// and the "algorithm" graph. That is, the actual the actual - /// input/initializer/output/node/value_info/sparse_initializer list of - /// the training graph is the concatenation of - /// "ModelProto.graph.input/initializer/output/node/value_info/sparse_initializer" - /// and "algorithm.input/initializer/output/node/value_info/sparse_initializer" - /// in that order. This combined graph must satisfy the normal ONNX conditions. - /// Now, let's provide a visualization of graph combination for clarity. - /// Let the inference graph (i.e., "ModelProto.graph") be - /// tensor_a, tensor_b -> MatMul -> tensor_c -> Sigmoid -> tensor_d - /// and the "algorithm" graph be - /// tensor_d -> Add -> tensor_e - /// The combination process results - /// tensor_a, tensor_b -> MatMul -> tensor_c -> Sigmoid -> tensor_d -> Add -> tensor_e - /// - /// Notice that an input of a node in the "algorithm" graph may reference the - /// output of a node in the inference graph (but not the other way round). Also, inference - /// node cannot reference inputs of "algorithm". With these restrictions, inference graph - /// can always be run independently without training information. - /// - /// By default, this field is an empty graph and its evaluation does not - /// produce any output. Evaluating the default training step never - /// update any initializers. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.GraphProto Algorithm { - get { return algorithm_; } - set { - algorithm_ = value; - } - } - - /// Field number for the "initialization_binding" field. - public const int InitializationBindingFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_initializationBinding_codec - = pb::FieldCodec.ForMessage(26, global::Onnx.StringStringEntryProto.Parser); - private readonly pbc::RepeatedField initializationBinding_ = new pbc::RepeatedField(); - /// - /// This field specifies the bindings from the outputs of "initialization" to - /// some initializers in "ModelProto.graph.initializer" and - /// the "algorithm.initializer" in the same TrainingInfoProto. - /// See "update_binding" below for details. - /// - /// By default, this field is empty and no initializer would be changed - /// by the execution of "initialization". - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField InitializationBinding { - get { return initializationBinding_; } - } - - /// Field number for the "update_binding" field. - public const int UpdateBindingFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_updateBinding_codec - = pb::FieldCodec.ForMessage(34, global::Onnx.StringStringEntryProto.Parser); - private readonly pbc::RepeatedField updateBinding_ = new pbc::RepeatedField(); - /// - /// Gradient-based training is usually an iterative procedure. In one gradient - /// descent iteration, we apply - /// - /// x = x - r * g - /// - /// where "x" is the optimized tensor, "r" stands for learning rate, and "g" is - /// gradient of "x" with respect to a chosen loss. To avoid adding assignments - /// into the training graph, we split the update equation into - /// - /// y = x - r * g - /// x = y - /// - /// The user needs to save "y = x - r * g" into TrainingInfoProto.algorithm. To - /// tell that "y" should be assigned to "x", the field "update_binding" may - /// contain a key-value pair of strings, "x" (key of StringStringEntryProto) - /// and "y" (value of StringStringEntryProto). - /// For a neural network with multiple trainable (mutable) tensors, there can - /// be multiple key-value pairs in "update_binding". - /// - /// The initializers appears as keys in "update_binding" are considered - /// mutable variables. This implies some behaviors - /// as described below. - /// - /// 1. We have only unique keys in all "update_binding"s so that two - /// variables may not have the same name. This ensures that one - /// variable is assigned up to once. - /// 2. The keys must appear in names of "ModelProto.graph.initializer" or - /// "TrainingInfoProto.algorithm.initializer". - /// 3. The values must be output names of "algorithm" or "ModelProto.graph.output". - /// 4. Mutable variables are initialized to the value specified by the - /// corresponding initializer, and then potentially updated by - /// "initializer_binding"s and "update_binding"s in "TrainingInfoProto"s. - /// - /// This field usually contains names of trainable tensors - /// (in ModelProto.graph), optimizer states such as momentums in advanced - /// stochastic gradient methods (in TrainingInfoProto.graph), - /// and number of training iterations (in TrainingInfoProto.graph). - /// - /// By default, this field is empty and no initializer would be changed - /// by the execution of "algorithm". - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UpdateBinding { - get { return updateBinding_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TrainingInfoProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TrainingInfoProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Initialization, other.Initialization)) return false; - if (!object.Equals(Algorithm, other.Algorithm)) return false; - if(!initializationBinding_.Equals(other.initializationBinding_)) return false; - if(!updateBinding_.Equals(other.updateBinding_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (initialization_ != null) hash ^= Initialization.GetHashCode(); - if (algorithm_ != null) hash ^= Algorithm.GetHashCode(); - hash ^= initializationBinding_.GetHashCode(); - hash ^= updateBinding_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (initialization_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Initialization); - } - if (algorithm_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Algorithm); - } - initializationBinding_.WriteTo(output, _repeated_initializationBinding_codec); - updateBinding_.WriteTo(output, _repeated_updateBinding_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (initialization_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Initialization); - } - if (algorithm_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Algorithm); - } - initializationBinding_.WriteTo(ref output, _repeated_initializationBinding_codec); - updateBinding_.WriteTo(ref output, _repeated_updateBinding_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (initialization_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Initialization); - } - if (algorithm_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Algorithm); - } - size += initializationBinding_.CalculateSize(_repeated_initializationBinding_codec); - size += updateBinding_.CalculateSize(_repeated_updateBinding_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TrainingInfoProto other) { - if (other == null) { - return; - } - if (other.initialization_ != null) { - if (initialization_ == null) { - Initialization = new global::Onnx.GraphProto(); - } - Initialization.MergeFrom(other.Initialization); - } - if (other.algorithm_ != null) { - if (algorithm_ == null) { - Algorithm = new global::Onnx.GraphProto(); - } - Algorithm.MergeFrom(other.Algorithm); - } - initializationBinding_.Add(other.initializationBinding_); - updateBinding_.Add(other.updateBinding_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (initialization_ == null) { - Initialization = new global::Onnx.GraphProto(); - } - input.ReadMessage(Initialization); - break; - } - case 18: { - if (algorithm_ == null) { - Algorithm = new global::Onnx.GraphProto(); - } - input.ReadMessage(Algorithm); - break; - } - case 26: { - initializationBinding_.AddEntriesFrom(input, _repeated_initializationBinding_codec); - break; - } - case 34: { - updateBinding_.AddEntriesFrom(input, _repeated_updateBinding_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (initialization_ == null) { - Initialization = new global::Onnx.GraphProto(); - } - input.ReadMessage(Initialization); - break; - } - case 18: { - if (algorithm_ == null) { - Algorithm = new global::Onnx.GraphProto(); - } - input.ReadMessage(Algorithm); - break; - } - case 26: { - initializationBinding_.AddEntriesFrom(ref input, _repeated_initializationBinding_codec); - break; - } - case 34: { - updateBinding_.AddEntriesFrom(ref input, _repeated_updateBinding_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Models - /// - /// ModelProto is a top-level file/container format for bundling a ML model and - /// associating its computation graph with metadata. - /// - /// The semantics of the model are described by the associated GraphProto's. - /// - public sealed partial class ModelProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ModelProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ModelProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ModelProto(ModelProto other) : this() { - irVersion_ = other.irVersion_; - opsetImport_ = other.opsetImport_.Clone(); - producerName_ = other.producerName_; - producerVersion_ = other.producerVersion_; - domain_ = other.domain_; - modelVersion_ = other.modelVersion_; - docString_ = other.docString_; - graph_ = other.graph_ != null ? other.graph_.Clone() : null; - metadataProps_ = other.metadataProps_.Clone(); - trainingInfo_ = other.trainingInfo_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ModelProto Clone() { - return new ModelProto(this); - } - - /// Field number for the "ir_version" field. - public const int IrVersionFieldNumber = 1; - private long irVersion_; - /// - /// The version of the IR this model targets. See Version enum above. - /// This field MUST be present. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long IrVersion { - get { return irVersion_; } - set { - irVersion_ = value; - } - } - - /// Field number for the "opset_import" field. - public const int OpsetImportFieldNumber = 8; - private static readonly pb::FieldCodec _repeated_opsetImport_codec - = pb::FieldCodec.ForMessage(66, global::Onnx.OperatorSetIdProto.Parser); - private readonly pbc::RepeatedField opsetImport_ = new pbc::RepeatedField(); - /// - /// The OperatorSets this model relies on. - /// All ModelProtos MUST have at least one entry that - /// specifies which version of the ONNX OperatorSet is - /// being imported. - /// - /// All nodes in the ModelProto's graph will bind against the operator - /// with the same-domain/same-op_type operator with the HIGHEST version - /// in the referenced operator sets. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField OpsetImport { - get { return opsetImport_; } - } - - /// Field number for the "producer_name" field. - public const int ProducerNameFieldNumber = 2; - private string producerName_ = ""; - /// - /// The name of the framework or tool used to generate this model. - /// This field SHOULD be present to indicate which implementation/tool/framework - /// emitted the model. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ProducerName { - get { return producerName_; } - set { - producerName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "producer_version" field. - public const int ProducerVersionFieldNumber = 3; - private string producerVersion_ = ""; - /// - /// The version of the framework or tool used to generate this model. - /// This field SHOULD be present to indicate which implementation/tool/framework - /// emitted the model. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ProducerVersion { - get { return producerVersion_; } - set { - producerVersion_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "domain" field. - public const int DomainFieldNumber = 4; - private string domain_ = ""; - /// - /// Domain name of the model. - /// We use reverse domain names as name space indicators. For example: - /// `com.facebook.fair` or `com.microsoft.cognitiveservices` - /// - /// Together with `model_version` and GraphProto.name, this forms the unique identity of - /// the graph. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Domain { - get { return domain_; } - set { - domain_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "model_version" field. - public const int ModelVersionFieldNumber = 5; - private long modelVersion_; - /// - /// The version of the graph encoded. See Version enum below. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ModelVersion { - get { return modelVersion_; } - set { - modelVersion_ = value; - } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 6; - private string docString_ = ""; - /// - /// A human-readable documentation for this model. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "graph" field. - public const int GraphFieldNumber = 7; - private global::Onnx.GraphProto graph_; - /// - /// The parameterized graph that is evaluated to execute the model. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.GraphProto Graph { - get { return graph_; } - set { - graph_ = value; - } - } - - /// Field number for the "metadata_props" field. - public const int MetadataPropsFieldNumber = 14; - private static readonly pb::FieldCodec _repeated_metadataProps_codec - = pb::FieldCodec.ForMessage(114, global::Onnx.StringStringEntryProto.Parser); - private readonly pbc::RepeatedField metadataProps_ = new pbc::RepeatedField(); - /// - /// Named metadata values; keys should be distinct. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField MetadataProps { - get { return metadataProps_; } - } - - /// Field number for the "training_info" field. - public const int TrainingInfoFieldNumber = 20; - private static readonly pb::FieldCodec _repeated_trainingInfo_codec - = pb::FieldCodec.ForMessage(162, global::Onnx.TrainingInfoProto.Parser); - private readonly pbc::RepeatedField trainingInfo_ = new pbc::RepeatedField(); - /// - /// Training-specific information. Sequentially executing all stored - /// `TrainingInfoProto.algorithm`s and assigning their outputs following - /// the corresponding `TrainingInfoProto.update_binding`s is one training - /// iteration. Similarly, to initialize the model - /// (as if training hasn't happened), the user should sequentially execute - /// all stored `TrainingInfoProto.initialization`s and assigns their outputs - /// using `TrainingInfoProto.initialization_binding`s. - /// - /// If this field is empty, the training behavior of the model is undefined. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField TrainingInfo { - get { return trainingInfo_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ModelProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ModelProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (IrVersion != other.IrVersion) return false; - if(!opsetImport_.Equals(other.opsetImport_)) return false; - if (ProducerName != other.ProducerName) return false; - if (ProducerVersion != other.ProducerVersion) return false; - if (Domain != other.Domain) return false; - if (ModelVersion != other.ModelVersion) return false; - if (DocString != other.DocString) return false; - if (!object.Equals(Graph, other.Graph)) return false; - if(!metadataProps_.Equals(other.metadataProps_)) return false; - if(!trainingInfo_.Equals(other.trainingInfo_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (IrVersion != 0L) hash ^= IrVersion.GetHashCode(); - hash ^= opsetImport_.GetHashCode(); - if (ProducerName.Length != 0) hash ^= ProducerName.GetHashCode(); - if (ProducerVersion.Length != 0) hash ^= ProducerVersion.GetHashCode(); - if (Domain.Length != 0) hash ^= Domain.GetHashCode(); - if (ModelVersion != 0L) hash ^= ModelVersion.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - if (graph_ != null) hash ^= Graph.GetHashCode(); - hash ^= metadataProps_.GetHashCode(); - hash ^= trainingInfo_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (IrVersion != 0L) { - output.WriteRawTag(8); - output.WriteInt64(IrVersion); - } - if (ProducerName.Length != 0) { - output.WriteRawTag(18); - output.WriteString(ProducerName); - } - if (ProducerVersion.Length != 0) { - output.WriteRawTag(26); - output.WriteString(ProducerVersion); - } - if (Domain.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Domain); - } - if (ModelVersion != 0L) { - output.WriteRawTag(40); - output.WriteInt64(ModelVersion); - } - if (DocString.Length != 0) { - output.WriteRawTag(50); - output.WriteString(DocString); - } - if (graph_ != null) { - output.WriteRawTag(58); - output.WriteMessage(Graph); - } - opsetImport_.WriteTo(output, _repeated_opsetImport_codec); - metadataProps_.WriteTo(output, _repeated_metadataProps_codec); - trainingInfo_.WriteTo(output, _repeated_trainingInfo_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (IrVersion != 0L) { - output.WriteRawTag(8); - output.WriteInt64(IrVersion); - } - if (ProducerName.Length != 0) { - output.WriteRawTag(18); - output.WriteString(ProducerName); - } - if (ProducerVersion.Length != 0) { - output.WriteRawTag(26); - output.WriteString(ProducerVersion); - } - if (Domain.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Domain); - } - if (ModelVersion != 0L) { - output.WriteRawTag(40); - output.WriteInt64(ModelVersion); - } - if (DocString.Length != 0) { - output.WriteRawTag(50); - output.WriteString(DocString); - } - if (graph_ != null) { - output.WriteRawTag(58); - output.WriteMessage(Graph); - } - opsetImport_.WriteTo(ref output, _repeated_opsetImport_codec); - metadataProps_.WriteTo(ref output, _repeated_metadataProps_codec); - trainingInfo_.WriteTo(ref output, _repeated_trainingInfo_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (IrVersion != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(IrVersion); - } - size += opsetImport_.CalculateSize(_repeated_opsetImport_codec); - if (ProducerName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ProducerName); - } - if (ProducerVersion.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ProducerVersion); - } - if (Domain.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Domain); - } - if (ModelVersion != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ModelVersion); - } - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - if (graph_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Graph); - } - size += metadataProps_.CalculateSize(_repeated_metadataProps_codec); - size += trainingInfo_.CalculateSize(_repeated_trainingInfo_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ModelProto other) { - if (other == null) { - return; - } - if (other.IrVersion != 0L) { - IrVersion = other.IrVersion; - } - opsetImport_.Add(other.opsetImport_); - if (other.ProducerName.Length != 0) { - ProducerName = other.ProducerName; - } - if (other.ProducerVersion.Length != 0) { - ProducerVersion = other.ProducerVersion; - } - if (other.Domain.Length != 0) { - Domain = other.Domain; - } - if (other.ModelVersion != 0L) { - ModelVersion = other.ModelVersion; - } - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - if (other.graph_ != null) { - if (graph_ == null) { - Graph = new global::Onnx.GraphProto(); - } - Graph.MergeFrom(other.Graph); - } - metadataProps_.Add(other.metadataProps_); - trainingInfo_.Add(other.trainingInfo_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - IrVersion = input.ReadInt64(); - break; - } - case 18: { - ProducerName = input.ReadString(); - break; - } - case 26: { - ProducerVersion = input.ReadString(); - break; - } - case 34: { - Domain = input.ReadString(); - break; - } - case 40: { - ModelVersion = input.ReadInt64(); - break; - } - case 50: { - DocString = input.ReadString(); - break; - } - case 58: { - if (graph_ == null) { - Graph = new global::Onnx.GraphProto(); - } - input.ReadMessage(Graph); - break; - } - case 66: { - opsetImport_.AddEntriesFrom(input, _repeated_opsetImport_codec); - break; - } - case 114: { - metadataProps_.AddEntriesFrom(input, _repeated_metadataProps_codec); - break; - } - case 162: { - trainingInfo_.AddEntriesFrom(input, _repeated_trainingInfo_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - IrVersion = input.ReadInt64(); - break; - } - case 18: { - ProducerName = input.ReadString(); - break; - } - case 26: { - ProducerVersion = input.ReadString(); - break; - } - case 34: { - Domain = input.ReadString(); - break; - } - case 40: { - ModelVersion = input.ReadInt64(); - break; - } - case 50: { - DocString = input.ReadString(); - break; - } - case 58: { - if (graph_ == null) { - Graph = new global::Onnx.GraphProto(); - } - input.ReadMessage(Graph); - break; - } - case 66: { - opsetImport_.AddEntriesFrom(ref input, _repeated_opsetImport_codec); - break; - } - case 114: { - metadataProps_.AddEntriesFrom(ref input, _repeated_metadataProps_codec); - break; - } - case 162: { - trainingInfo_.AddEntriesFrom(ref input, _repeated_trainingInfo_codec); - break; - } - } - } - } - #endif - - } - - /// - /// StringStringEntryProto follows the pattern for cross-proto-version maps. - /// See https://developers.google.com/protocol-buffers/docs/proto3#maps - /// - public sealed partial class StringStringEntryProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StringStringEntryProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringStringEntryProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringStringEntryProto(StringStringEntryProto other) : this() { - key_ = other.key_; - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringStringEntryProto Clone() { - return new StringStringEntryProto(this); - } - - /// Field number for the "key" field. - public const int KeyFieldNumber = 1; - private string key_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } - set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 2; - private string value_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Value { - get { return value_; } - set { - value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as StringStringEntryProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StringStringEntryProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Key != other.Key) return false; - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Key.Length != 0) hash ^= Key.GetHashCode(); - if (Value.Length != 0) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Key.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Key); - } - if (Value.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Key.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Key); - } - if (Value.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); - } - if (Value.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Value); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StringStringEntryProto other) { - if (other == null) { - return; - } - if (other.Key.Length != 0) { - Key = other.Key; - } - if (other.Value.Length != 0) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Key = input.ReadString(); - break; - } - case 18: { - Value = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Key = input.ReadString(); - break; - } - case 18: { - Value = input.ReadString(); - break; - } - } - } - } - #endif - - } - - public sealed partial class TensorAnnotation : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorAnnotation()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorAnnotation() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorAnnotation(TensorAnnotation other) : this() { - tensorName_ = other.tensorName_; - quantParameterTensorNames_ = other.quantParameterTensorNames_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorAnnotation Clone() { - return new TensorAnnotation(this); - } - - /// Field number for the "tensor_name" field. - public const int TensorNameFieldNumber = 1; - private string tensorName_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TensorName { - get { return tensorName_; } - set { - tensorName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "quant_parameter_tensor_names" field. - public const int QuantParameterTensorNamesFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_quantParameterTensorNames_codec - = pb::FieldCodec.ForMessage(18, global::Onnx.StringStringEntryProto.Parser); - private readonly pbc::RepeatedField quantParameterTensorNames_ = new pbc::RepeatedField(); - /// - /// <key, value> pairs to annotate tensor specified by <tensor_name> above. - /// The keys used in the mapping below must be pre-defined in ONNX spec. - /// For example, for 8-bit linear quantization case, 'SCALE_TENSOR', 'ZERO_POINT_TENSOR' will be pre-defined as - /// quantization parameter keys. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField QuantParameterTensorNames { - get { return quantParameterTensorNames_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TensorAnnotation); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TensorAnnotation other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (TensorName != other.TensorName) return false; - if(!quantParameterTensorNames_.Equals(other.quantParameterTensorNames_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (TensorName.Length != 0) hash ^= TensorName.GetHashCode(); - hash ^= quantParameterTensorNames_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (TensorName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(TensorName); - } - quantParameterTensorNames_.WriteTo(output, _repeated_quantParameterTensorNames_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (TensorName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(TensorName); - } - quantParameterTensorNames_.WriteTo(ref output, _repeated_quantParameterTensorNames_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (TensorName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TensorName); - } - size += quantParameterTensorNames_.CalculateSize(_repeated_quantParameterTensorNames_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TensorAnnotation other) { - if (other == null) { - return; - } - if (other.TensorName.Length != 0) { - TensorName = other.TensorName; - } - quantParameterTensorNames_.Add(other.quantParameterTensorNames_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - TensorName = input.ReadString(); - break; - } - case 18: { - quantParameterTensorNames_.AddEntriesFrom(input, _repeated_quantParameterTensorNames_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - TensorName = input.ReadString(); - break; - } - case 18: { - quantParameterTensorNames_.AddEntriesFrom(ref input, _repeated_quantParameterTensorNames_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Graphs - /// - /// A graph defines the computational logic of a model and is comprised of a parameterized - /// list of nodes that form a directed acyclic graph based on their inputs and outputs. - /// This is the equivalent of the "network" or "graph" in many deep learning - /// frameworks. - /// - public sealed partial class GraphProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GraphProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GraphProto(GraphProto other) : this() { - node_ = other.node_.Clone(); - name_ = other.name_; - initializer_ = other.initializer_.Clone(); - sparseInitializer_ = other.sparseInitializer_.Clone(); - docString_ = other.docString_; - input_ = other.input_.Clone(); - output_ = other.output_.Clone(); - valueInfo_ = other.valueInfo_.Clone(); - quantizationAnnotation_ = other.quantizationAnnotation_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GraphProto Clone() { - return new GraphProto(this); - } - - /// Field number for the "node" field. - public const int NodeFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_node_codec - = pb::FieldCodec.ForMessage(10, global::Onnx.NodeProto.Parser); - private readonly pbc::RepeatedField node_ = new pbc::RepeatedField(); - /// - /// The nodes in the graph, sorted topologically. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Node { - get { return node_; } - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 2; - private string name_ = ""; - /// - /// The name of the graph. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "initializer" field. - public const int InitializerFieldNumber = 5; - private static readonly pb::FieldCodec _repeated_initializer_codec - = pb::FieldCodec.ForMessage(42, global::Onnx.TensorProto.Parser); - private readonly pbc::RepeatedField initializer_ = new pbc::RepeatedField(); - /// - /// A list of named tensor values, used to specify constant inputs of the graph. - /// Each initializer (both TensorProto as well SparseTensorProto) MUST have a name. - /// The name MUST be unique across both initializer and sparse_initializer, - /// but the name MAY also appear in the input list. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Initializer { - get { return initializer_; } - } - - /// Field number for the "sparse_initializer" field. - public const int SparseInitializerFieldNumber = 15; - private static readonly pb::FieldCodec _repeated_sparseInitializer_codec - = pb::FieldCodec.ForMessage(122, global::Onnx.SparseTensorProto.Parser); - private readonly pbc::RepeatedField sparseInitializer_ = new pbc::RepeatedField(); - /// - /// Initializers (see above) stored in sparse format. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField SparseInitializer { - get { return sparseInitializer_; } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 10; - private string docString_ = ""; - /// - /// A human-readable documentation for this graph. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "input" field. - public const int InputFieldNumber = 11; - private static readonly pb::FieldCodec _repeated_input_codec - = pb::FieldCodec.ForMessage(90, global::Onnx.ValueInfoProto.Parser); - private readonly pbc::RepeatedField input_ = new pbc::RepeatedField(); - /// - /// The inputs and outputs of the graph. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Input { - get { return input_; } - } - - /// Field number for the "output" field. - public const int OutputFieldNumber = 12; - private static readonly pb::FieldCodec _repeated_output_codec - = pb::FieldCodec.ForMessage(98, global::Onnx.ValueInfoProto.Parser); - private readonly pbc::RepeatedField output_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Output { - get { return output_; } - } - - /// Field number for the "value_info" field. - public const int ValueInfoFieldNumber = 13; - private static readonly pb::FieldCodec _repeated_valueInfo_codec - = pb::FieldCodec.ForMessage(106, global::Onnx.ValueInfoProto.Parser); - private readonly pbc::RepeatedField valueInfo_ = new pbc::RepeatedField(); - /// - /// Information for the values in the graph. The ValueInfoProto.name's - /// must be distinct. It is optional for a value to appear in value_info list. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField ValueInfo { - get { return valueInfo_; } - } - - /// Field number for the "quantization_annotation" field. - public const int QuantizationAnnotationFieldNumber = 14; - private static readonly pb::FieldCodec _repeated_quantizationAnnotation_codec - = pb::FieldCodec.ForMessage(114, global::Onnx.TensorAnnotation.Parser); - private readonly pbc::RepeatedField quantizationAnnotation_ = new pbc::RepeatedField(); - /// - /// This field carries information to indicate the mapping among a tensor and its - /// quantization parameter tensors. For example: - /// For tensor 'a', it may have {'SCALE_TENSOR', 'a_scale'} and {'ZERO_POINT_TENSOR', 'a_zero_point'} annotated, - /// which means, tensor 'a_scale' and tensor 'a_zero_point' are scale and zero point of tensor 'a' in the model. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField QuantizationAnnotation { - get { return quantizationAnnotation_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GraphProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GraphProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!node_.Equals(other.node_)) return false; - if (Name != other.Name) return false; - if(!initializer_.Equals(other.initializer_)) return false; - if(!sparseInitializer_.Equals(other.sparseInitializer_)) return false; - if (DocString != other.DocString) return false; - if(!input_.Equals(other.input_)) return false; - if(!output_.Equals(other.output_)) return false; - if(!valueInfo_.Equals(other.valueInfo_)) return false; - if(!quantizationAnnotation_.Equals(other.quantizationAnnotation_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= node_.GetHashCode(); - if (Name.Length != 0) hash ^= Name.GetHashCode(); - hash ^= initializer_.GetHashCode(); - hash ^= sparseInitializer_.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - hash ^= input_.GetHashCode(); - hash ^= output_.GetHashCode(); - hash ^= valueInfo_.GetHashCode(); - hash ^= quantizationAnnotation_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - node_.WriteTo(output, _repeated_node_codec); - if (Name.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Name); - } - initializer_.WriteTo(output, _repeated_initializer_codec); - if (DocString.Length != 0) { - output.WriteRawTag(82); - output.WriteString(DocString); - } - input_.WriteTo(output, _repeated_input_codec); - output_.WriteTo(output, _repeated_output_codec); - valueInfo_.WriteTo(output, _repeated_valueInfo_codec); - quantizationAnnotation_.WriteTo(output, _repeated_quantizationAnnotation_codec); - sparseInitializer_.WriteTo(output, _repeated_sparseInitializer_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - node_.WriteTo(ref output, _repeated_node_codec); - if (Name.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Name); - } - initializer_.WriteTo(ref output, _repeated_initializer_codec); - if (DocString.Length != 0) { - output.WriteRawTag(82); - output.WriteString(DocString); - } - input_.WriteTo(ref output, _repeated_input_codec); - output_.WriteTo(ref output, _repeated_output_codec); - valueInfo_.WriteTo(ref output, _repeated_valueInfo_codec); - quantizationAnnotation_.WriteTo(ref output, _repeated_quantizationAnnotation_codec); - sparseInitializer_.WriteTo(ref output, _repeated_sparseInitializer_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += node_.CalculateSize(_repeated_node_codec); - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - size += initializer_.CalculateSize(_repeated_initializer_codec); - size += sparseInitializer_.CalculateSize(_repeated_sparseInitializer_codec); - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - size += input_.CalculateSize(_repeated_input_codec); - size += output_.CalculateSize(_repeated_output_codec); - size += valueInfo_.CalculateSize(_repeated_valueInfo_codec); - size += quantizationAnnotation_.CalculateSize(_repeated_quantizationAnnotation_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GraphProto other) { - if (other == null) { - return; - } - node_.Add(other.node_); - if (other.Name.Length != 0) { - Name = other.Name; - } - initializer_.Add(other.initializer_); - sparseInitializer_.Add(other.sparseInitializer_); - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - input_.Add(other.input_); - output_.Add(other.output_); - valueInfo_.Add(other.valueInfo_); - quantizationAnnotation_.Add(other.quantizationAnnotation_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - node_.AddEntriesFrom(input, _repeated_node_codec); - break; - } - case 18: { - Name = input.ReadString(); - break; - } - case 42: { - initializer_.AddEntriesFrom(input, _repeated_initializer_codec); - break; - } - case 82: { - DocString = input.ReadString(); - break; - } - case 90: { - input_.AddEntriesFrom(input, _repeated_input_codec); - break; - } - case 98: { - output_.AddEntriesFrom(input, _repeated_output_codec); - break; - } - case 106: { - valueInfo_.AddEntriesFrom(input, _repeated_valueInfo_codec); - break; - } - case 114: { - quantizationAnnotation_.AddEntriesFrom(input, _repeated_quantizationAnnotation_codec); - break; - } - case 122: { - sparseInitializer_.AddEntriesFrom(input, _repeated_sparseInitializer_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - node_.AddEntriesFrom(ref input, _repeated_node_codec); - break; - } - case 18: { - Name = input.ReadString(); - break; - } - case 42: { - initializer_.AddEntriesFrom(ref input, _repeated_initializer_codec); - break; - } - case 82: { - DocString = input.ReadString(); - break; - } - case 90: { - input_.AddEntriesFrom(ref input, _repeated_input_codec); - break; - } - case 98: { - output_.AddEntriesFrom(ref input, _repeated_output_codec); - break; - } - case 106: { - valueInfo_.AddEntriesFrom(ref input, _repeated_valueInfo_codec); - break; - } - case 114: { - quantizationAnnotation_.AddEntriesFrom(ref input, _repeated_quantizationAnnotation_codec); - break; - } - case 122: { - sparseInitializer_.AddEntriesFrom(ref input, _repeated_sparseInitializer_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Tensors - /// - /// A serialized tensor value. - /// - public sealed partial class TensorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorProto(TensorProto other) : this() { - dims_ = other.dims_.Clone(); - dataType_ = other.dataType_; - segment_ = other.segment_ != null ? other.segment_.Clone() : null; - floatData_ = other.floatData_.Clone(); - int32Data_ = other.int32Data_.Clone(); - stringData_ = other.stringData_.Clone(); - int64Data_ = other.int64Data_.Clone(); - name_ = other.name_; - docString_ = other.docString_; - rawData_ = other.rawData_; - externalData_ = other.externalData_.Clone(); - dataLocation_ = other.dataLocation_; - doubleData_ = other.doubleData_.Clone(); - uint64Data_ = other.uint64Data_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorProto Clone() { - return new TensorProto(this); - } - - /// Field number for the "dims" field. - public const int DimsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_dims_codec - = pb::FieldCodec.ForInt64(10); - private readonly pbc::RepeatedField dims_ = new pbc::RepeatedField(); - /// - /// The shape of the tensor. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Dims { - get { return dims_; } - } - - /// Field number for the "data_type" field. - public const int DataTypeFieldNumber = 2; - private int dataType_; - /// - /// The data type of the tensor. - /// This field MUST have a valid TensorProto.DataType value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int DataType { - get { return dataType_; } - set { - dataType_ = value; - } - } - - /// Field number for the "segment" field. - public const int SegmentFieldNumber = 3; - private global::Onnx.TensorProto.Types.Segment segment_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorProto.Types.Segment Segment { - get { return segment_; } - set { - segment_ = value; - } - } - - /// Field number for the "float_data" field. - public const int FloatDataFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_floatData_codec - = pb::FieldCodec.ForFloat(34); - private readonly pbc::RepeatedField floatData_ = new pbc::RepeatedField(); - /// - /// For float and complex64 values - /// Complex64 tensors are encoded as a single array of floats, - /// with the real components appearing in odd numbered positions, - /// and the corresponding imaginary component appearing in the - /// subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] - /// is encoded as [1.0, 2.0 ,3.0 ,4.0] - /// When this field is present, the data_type field MUST be FLOAT or COMPLEX64. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField FloatData { - get { return floatData_; } - } - - /// Field number for the "int32_data" field. - public const int Int32DataFieldNumber = 5; - private static readonly pb::FieldCodec _repeated_int32Data_codec - = pb::FieldCodec.ForInt32(42); - private readonly pbc::RepeatedField int32Data_ = new pbc::RepeatedField(); - /// - /// For int32, uint8, int8, uint16, int16, bool, and float16 values - /// float16 values must be bit-wise converted to an uint16_t prior - /// to writing to the buffer. - /// When this field is present, the data_type field MUST be - /// INT32, INT16, INT8, UINT16, UINT8, BOOL, or FLOAT16 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Int32Data { - get { return int32Data_; } - } - - /// Field number for the "string_data" field. - public const int StringDataFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_stringData_codec - = pb::FieldCodec.ForBytes(50); - private readonly pbc::RepeatedField stringData_ = new pbc::RepeatedField(); - /// - /// For strings. - /// Each element of string_data is a UTF-8 encoded Unicode - /// string. No trailing null, no leading BOM. The protobuf "string" - /// scalar type is not used to match ML community conventions. - /// When this field is present, the data_type field MUST be STRING - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField StringData { - get { return stringData_; } - } - - /// Field number for the "int64_data" field. - public const int Int64DataFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_int64Data_codec - = pb::FieldCodec.ForInt64(58); - private readonly pbc::RepeatedField int64Data_ = new pbc::RepeatedField(); - /// - /// For int64. - /// When this field is present, the data_type field MUST be INT64 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Int64Data { - get { return int64Data_; } - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 8; - private string name_ = ""; - /// - /// Optionally, a name for the tensor. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 12; - private string docString_ = ""; - /// - /// A human-readable documentation for this tensor. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "raw_data" field. - public const int RawDataFieldNumber = 9; - private pb::ByteString rawData_ = pb::ByteString.Empty; - /// - /// Serializations can either use one of the fields above, or use this - /// raw bytes field. The only exception is the string case, where one is - /// required to store the content in the repeated bytes string_data field. - /// - /// When this raw_data field is used to store tensor value, elements MUST - /// be stored in as fixed-width, little-endian order. - /// Floating-point data types MUST be stored in IEEE 754 format. - /// Complex64 elements must be written as two consecutive FLOAT values, real component first. - /// Complex128 elements must be written as two consecutive DOUBLE values, real component first. - /// Boolean type MUST be written one byte per tensor element (00000001 for true, 00000000 for false). - /// - /// Note: the advantage of specific field rather than the raw_data field is - /// that in some cases (e.g. int data), protobuf does a better packing via - /// variable length storage, and may lead to smaller binary footprint. - /// When this field is present, the data_type field MUST NOT be STRING or UNDEFINED - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString RawData { - get { return rawData_; } - set { - rawData_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "external_data" field. - public const int ExternalDataFieldNumber = 13; - private static readonly pb::FieldCodec _repeated_externalData_codec - = pb::FieldCodec.ForMessage(106, global::Onnx.StringStringEntryProto.Parser); - private readonly pbc::RepeatedField externalData_ = new pbc::RepeatedField(); - /// - /// Data can be stored inside the protobuf file using type-specific fields or raw_data. - /// Alternatively, raw bytes data can be stored in an external file, using the external_data field. - /// external_data stores key-value pairs describing data location. Recognized keys are: - /// - "location" (required) - POSIX filesystem path relative to the directory where the ONNX - /// protobuf model was stored - /// - "offset" (optional) - position of byte at which stored data begins. Integer stored as string. - /// Offset values SHOULD be multiples 4096 (page size) to enable mmap support. - /// - "length" (optional) - number of bytes containing data. Integer stored as string. - /// - "checksum" (optional) - SHA1 digest of file specified in under 'location' key. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField ExternalData { - get { return externalData_; } - } - - /// Field number for the "data_location" field. - public const int DataLocationFieldNumber = 14; - private global::Onnx.TensorProto.Types.DataLocation dataLocation_ = global::Onnx.TensorProto.Types.DataLocation.Default; - /// - /// If value not set, data is stored in raw_data (if set) otherwise in type-specified field. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorProto.Types.DataLocation DataLocation { - get { return dataLocation_; } - set { - dataLocation_ = value; - } - } - - /// Field number for the "double_data" field. - public const int DoubleDataFieldNumber = 10; - private static readonly pb::FieldCodec _repeated_doubleData_codec - = pb::FieldCodec.ForDouble(82); - private readonly pbc::RepeatedField doubleData_ = new pbc::RepeatedField(); - /// - /// For double - /// Complex128 tensors are encoded as a single array of doubles, - /// with the real components appearing in odd numbered positions, - /// and the corresponding imaginary component appearing in the - /// subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] - /// is encoded as [1.0, 2.0 ,3.0 ,4.0] - /// When this field is present, the data_type field MUST be DOUBLE or COMPLEX128 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField DoubleData { - get { return doubleData_; } - } - - /// Field number for the "uint64_data" field. - public const int Uint64DataFieldNumber = 11; - private static readonly pb::FieldCodec _repeated_uint64Data_codec - = pb::FieldCodec.ForUInt64(90); - private readonly pbc::RepeatedField uint64Data_ = new pbc::RepeatedField(); - /// - /// For uint64 and uint32 values - /// When this field is present, the data_type field MUST be - /// UINT32 or UINT64 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Uint64Data { - get { return uint64Data_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TensorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TensorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!dims_.Equals(other.dims_)) return false; - if (DataType != other.DataType) return false; - if (!object.Equals(Segment, other.Segment)) return false; - if(!floatData_.Equals(other.floatData_)) return false; - if(!int32Data_.Equals(other.int32Data_)) return false; - if(!stringData_.Equals(other.stringData_)) return false; - if(!int64Data_.Equals(other.int64Data_)) return false; - if (Name != other.Name) return false; - if (DocString != other.DocString) return false; - if (RawData != other.RawData) return false; - if(!externalData_.Equals(other.externalData_)) return false; - if (DataLocation != other.DataLocation) return false; - if(!doubleData_.Equals(other.doubleData_)) return false; - if(!uint64Data_.Equals(other.uint64Data_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= dims_.GetHashCode(); - if (DataType != 0) hash ^= DataType.GetHashCode(); - if (segment_ != null) hash ^= Segment.GetHashCode(); - hash ^= floatData_.GetHashCode(); - hash ^= int32Data_.GetHashCode(); - hash ^= stringData_.GetHashCode(); - hash ^= int64Data_.GetHashCode(); - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - if (RawData.Length != 0) hash ^= RawData.GetHashCode(); - hash ^= externalData_.GetHashCode(); - if (DataLocation != global::Onnx.TensorProto.Types.DataLocation.Default) hash ^= DataLocation.GetHashCode(); - hash ^= doubleData_.GetHashCode(); - hash ^= uint64Data_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - dims_.WriteTo(output, _repeated_dims_codec); - if (DataType != 0) { - output.WriteRawTag(16); - output.WriteInt32(DataType); - } - if (segment_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Segment); - } - floatData_.WriteTo(output, _repeated_floatData_codec); - int32Data_.WriteTo(output, _repeated_int32Data_codec); - stringData_.WriteTo(output, _repeated_stringData_codec); - int64Data_.WriteTo(output, _repeated_int64Data_codec); - if (Name.Length != 0) { - output.WriteRawTag(66); - output.WriteString(Name); - } - if (RawData.Length != 0) { - output.WriteRawTag(74); - output.WriteBytes(RawData); - } - doubleData_.WriteTo(output, _repeated_doubleData_codec); - uint64Data_.WriteTo(output, _repeated_uint64Data_codec); - if (DocString.Length != 0) { - output.WriteRawTag(98); - output.WriteString(DocString); - } - externalData_.WriteTo(output, _repeated_externalData_codec); - if (DataLocation != global::Onnx.TensorProto.Types.DataLocation.Default) { - output.WriteRawTag(112); - output.WriteEnum((int) DataLocation); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - dims_.WriteTo(ref output, _repeated_dims_codec); - if (DataType != 0) { - output.WriteRawTag(16); - output.WriteInt32(DataType); - } - if (segment_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Segment); - } - floatData_.WriteTo(ref output, _repeated_floatData_codec); - int32Data_.WriteTo(ref output, _repeated_int32Data_codec); - stringData_.WriteTo(ref output, _repeated_stringData_codec); - int64Data_.WriteTo(ref output, _repeated_int64Data_codec); - if (Name.Length != 0) { - output.WriteRawTag(66); - output.WriteString(Name); - } - if (RawData.Length != 0) { - output.WriteRawTag(74); - output.WriteBytes(RawData); - } - doubleData_.WriteTo(ref output, _repeated_doubleData_codec); - uint64Data_.WriteTo(ref output, _repeated_uint64Data_codec); - if (DocString.Length != 0) { - output.WriteRawTag(98); - output.WriteString(DocString); - } - externalData_.WriteTo(ref output, _repeated_externalData_codec); - if (DataLocation != global::Onnx.TensorProto.Types.DataLocation.Default) { - output.WriteRawTag(112); - output.WriteEnum((int) DataLocation); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += dims_.CalculateSize(_repeated_dims_codec); - if (DataType != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(DataType); - } - if (segment_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Segment); - } - size += floatData_.CalculateSize(_repeated_floatData_codec); - size += int32Data_.CalculateSize(_repeated_int32Data_codec); - size += stringData_.CalculateSize(_repeated_stringData_codec); - size += int64Data_.CalculateSize(_repeated_int64Data_codec); - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - if (RawData.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(RawData); - } - size += externalData_.CalculateSize(_repeated_externalData_codec); - if (DataLocation != global::Onnx.TensorProto.Types.DataLocation.Default) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) DataLocation); - } - size += doubleData_.CalculateSize(_repeated_doubleData_codec); - size += uint64Data_.CalculateSize(_repeated_uint64Data_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TensorProto other) { - if (other == null) { - return; - } - dims_.Add(other.dims_); - if (other.DataType != 0) { - DataType = other.DataType; - } - if (other.segment_ != null) { - if (segment_ == null) { - Segment = new global::Onnx.TensorProto.Types.Segment(); - } - Segment.MergeFrom(other.Segment); - } - floatData_.Add(other.floatData_); - int32Data_.Add(other.int32Data_); - stringData_.Add(other.stringData_); - int64Data_.Add(other.int64Data_); - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - if (other.RawData.Length != 0) { - RawData = other.RawData; - } - externalData_.Add(other.externalData_); - if (other.DataLocation != global::Onnx.TensorProto.Types.DataLocation.Default) { - DataLocation = other.DataLocation; - } - doubleData_.Add(other.doubleData_); - uint64Data_.Add(other.uint64Data_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: - case 8: { - dims_.AddEntriesFrom(input, _repeated_dims_codec); - break; - } - case 16: { - DataType = input.ReadInt32(); - break; - } - case 26: { - if (segment_ == null) { - Segment = new global::Onnx.TensorProto.Types.Segment(); - } - input.ReadMessage(Segment); - break; - } - case 34: - case 37: { - floatData_.AddEntriesFrom(input, _repeated_floatData_codec); - break; - } - case 42: - case 40: { - int32Data_.AddEntriesFrom(input, _repeated_int32Data_codec); - break; - } - case 50: { - stringData_.AddEntriesFrom(input, _repeated_stringData_codec); - break; - } - case 58: - case 56: { - int64Data_.AddEntriesFrom(input, _repeated_int64Data_codec); - break; - } - case 66: { - Name = input.ReadString(); - break; - } - case 74: { - RawData = input.ReadBytes(); - break; - } - case 82: - case 81: { - doubleData_.AddEntriesFrom(input, _repeated_doubleData_codec); - break; - } - case 90: - case 88: { - uint64Data_.AddEntriesFrom(input, _repeated_uint64Data_codec); - break; - } - case 98: { - DocString = input.ReadString(); - break; - } - case 106: { - externalData_.AddEntriesFrom(input, _repeated_externalData_codec); - break; - } - case 112: { - DataLocation = (global::Onnx.TensorProto.Types.DataLocation) input.ReadEnum(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: - case 8: { - dims_.AddEntriesFrom(ref input, _repeated_dims_codec); - break; - } - case 16: { - DataType = input.ReadInt32(); - break; - } - case 26: { - if (segment_ == null) { - Segment = new global::Onnx.TensorProto.Types.Segment(); - } - input.ReadMessage(Segment); - break; - } - case 34: - case 37: { - floatData_.AddEntriesFrom(ref input, _repeated_floatData_codec); - break; - } - case 42: - case 40: { - int32Data_.AddEntriesFrom(ref input, _repeated_int32Data_codec); - break; - } - case 50: { - stringData_.AddEntriesFrom(ref input, _repeated_stringData_codec); - break; - } - case 58: - case 56: { - int64Data_.AddEntriesFrom(ref input, _repeated_int64Data_codec); - break; - } - case 66: { - Name = input.ReadString(); - break; - } - case 74: { - RawData = input.ReadBytes(); - break; - } - case 82: - case 81: { - doubleData_.AddEntriesFrom(ref input, _repeated_doubleData_codec); - break; - } - case 90: - case 88: { - uint64Data_.AddEntriesFrom(ref input, _repeated_uint64Data_codec); - break; - } - case 98: { - DocString = input.ReadString(); - break; - } - case 106: { - externalData_.AddEntriesFrom(ref input, _repeated_externalData_codec); - break; - } - case 112: { - DataLocation = (global::Onnx.TensorProto.Types.DataLocation) input.ReadEnum(); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the TensorProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public enum DataType { - [pbr::OriginalName("UNDEFINED")] Undefined = 0, - /// - /// Basic types. - /// - [pbr::OriginalName("FLOAT")] Float = 1, - /// - /// uint8_t - /// - [pbr::OriginalName("UINT8")] Uint8 = 2, - /// - /// int8_t - /// - [pbr::OriginalName("INT8")] Int8 = 3, - /// - /// uint16_t - /// - [pbr::OriginalName("UINT16")] Uint16 = 4, - /// - /// int16_t - /// - [pbr::OriginalName("INT16")] Int16 = 5, - /// - /// int32_t - /// - [pbr::OriginalName("INT32")] Int32 = 6, - /// - /// int64_t - /// - [pbr::OriginalName("INT64")] Int64 = 7, - /// - /// string - /// - [pbr::OriginalName("STRING")] String = 8, - /// - /// bool - /// - [pbr::OriginalName("BOOL")] Bool = 9, - /// - /// IEEE754 half-precision floating-point format (16 bits wide). - /// This format has 1 sign bit, 5 exponent bits, and 10 mantissa bits. - /// - [pbr::OriginalName("FLOAT16")] Float16 = 10, - [pbr::OriginalName("DOUBLE")] Double = 11, - [pbr::OriginalName("UINT32")] Uint32 = 12, - [pbr::OriginalName("UINT64")] Uint64 = 13, - /// - /// complex with float32 real and imaginary components - /// - [pbr::OriginalName("COMPLEX64")] Complex64 = 14, - /// - /// complex with float64 real and imaginary components - /// - [pbr::OriginalName("COMPLEX128")] Complex128 = 15, - /// - /// Non-IEEE floating-point format based on IEEE754 single-precision - /// floating-point number truncated to 16 bits. - /// This format has 1 sign bit, 8 exponent bits, and 7 mantissa bits. - /// - [pbr::OriginalName("BFLOAT16")] Bfloat16 = 16, - } - - /// - /// Location of the data for this tensor. MUST be one of: - /// - DEFAULT - data stored inside the protobuf message. Data is stored in raw_data (if set) otherwise in type-specified field. - /// - EXTERNAL - data stored in an external location as described by external_data field. - /// - public enum DataLocation { - [pbr::OriginalName("DEFAULT")] Default = 0, - [pbr::OriginalName("EXTERNAL")] External = 1, - } - - /// - /// For very large tensors, we may want to store them in chunks, in which - /// case the following fields will specify the segment that is stored in - /// the current TensorProto. - /// - public sealed partial class Segment : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Segment()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TensorProto.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Segment() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Segment(Segment other) : this() { - begin_ = other.begin_; - end_ = other.end_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Segment Clone() { - return new Segment(this); - } - - /// Field number for the "begin" field. - public const int BeginFieldNumber = 1; - private long begin_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Begin { - get { return begin_; } - set { - begin_ = value; - } - } - - /// Field number for the "end" field. - public const int EndFieldNumber = 2; - private long end_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long End { - get { return end_; } - set { - end_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Segment); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Segment other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Begin != other.Begin) return false; - if (End != other.End) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Begin != 0L) hash ^= Begin.GetHashCode(); - if (End != 0L) hash ^= End.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Begin != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Begin); - } - if (End != 0L) { - output.WriteRawTag(16); - output.WriteInt64(End); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Begin != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Begin); - } - if (End != 0L) { - output.WriteRawTag(16); - output.WriteInt64(End); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Begin != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Begin); - } - if (End != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(End); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Segment other) { - if (other == null) { - return; - } - if (other.Begin != 0L) { - Begin = other.Begin; - } - if (other.End != 0L) { - End = other.End; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Begin = input.ReadInt64(); - break; - } - case 16: { - End = input.ReadInt64(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Begin = input.ReadInt64(); - break; - } - case 16: { - End = input.ReadInt64(); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - /// - /// A serialized sparse-tensor value - /// - public sealed partial class SparseTensorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SparseTensorProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensorProto(SparseTensorProto other) : this() { - values_ = other.values_ != null ? other.values_.Clone() : null; - indices_ = other.indices_ != null ? other.indices_.Clone() : null; - dims_ = other.dims_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensorProto Clone() { - return new SparseTensorProto(this); - } - - /// Field number for the "values" field. - public const int ValuesFieldNumber = 1; - private global::Onnx.TensorProto values_; - /// - /// The sequence of non-default values are encoded as a tensor of shape [NNZ]. - /// The default-value is zero for numeric tensors, and empty-string for string tensors. - /// values must have a non-empty name present which serves as a name for SparseTensorProto - /// when used in sparse_initializer list. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorProto Values { - get { return values_; } - set { - values_ = value; - } - } - - /// Field number for the "indices" field. - public const int IndicesFieldNumber = 2; - private global::Onnx.TensorProto indices_; - /// - /// The indices of the non-default values, which may be stored in one of two formats. - /// (a) Indices can be a tensor of shape [NNZ, rank] with the [i,j]-th value - /// corresponding to the j-th index of the i-th value (in the values tensor). - /// (b) Indices can be a tensor of shape [NNZ], in which case the i-th value - /// must be the linearized-index of the i-th value (in the values tensor). - /// The linearized-index can be converted into an index tuple (k_1,...,k_rank) - /// using the shape provided below. - /// The indices must appear in ascending order without duplication. - /// In the first format, the ordering is lexicographic-ordering: - /// e.g., index-value [1,4] must appear before [2,1] - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorProto Indices { - get { return indices_; } - set { - indices_ = value; - } - } - - /// Field number for the "dims" field. - public const int DimsFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_dims_codec - = pb::FieldCodec.ForInt64(26); - private readonly pbc::RepeatedField dims_ = new pbc::RepeatedField(); - /// - /// The shape of the underlying dense-tensor: [dim_1, dim_2, ... dim_rank] - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Dims { - get { return dims_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SparseTensorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SparseTensorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Values, other.Values)) return false; - if (!object.Equals(Indices, other.Indices)) return false; - if(!dims_.Equals(other.dims_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (values_ != null) hash ^= Values.GetHashCode(); - if (indices_ != null) hash ^= Indices.GetHashCode(); - hash ^= dims_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (values_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Values); - } - if (indices_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Indices); - } - dims_.WriteTo(output, _repeated_dims_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (values_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Values); - } - if (indices_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Indices); - } - dims_.WriteTo(ref output, _repeated_dims_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (values_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Values); - } - if (indices_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Indices); - } - size += dims_.CalculateSize(_repeated_dims_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SparseTensorProto other) { - if (other == null) { - return; - } - if (other.values_ != null) { - if (values_ == null) { - Values = new global::Onnx.TensorProto(); - } - Values.MergeFrom(other.Values); - } - if (other.indices_ != null) { - if (indices_ == null) { - Indices = new global::Onnx.TensorProto(); - } - Indices.MergeFrom(other.Indices); - } - dims_.Add(other.dims_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (values_ == null) { - Values = new global::Onnx.TensorProto(); - } - input.ReadMessage(Values); - break; - } - case 18: { - if (indices_ == null) { - Indices = new global::Onnx.TensorProto(); - } - input.ReadMessage(Indices); - break; - } - case 26: - case 24: { - dims_.AddEntriesFrom(input, _repeated_dims_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (values_ == null) { - Values = new global::Onnx.TensorProto(); - } - input.ReadMessage(Values); - break; - } - case 18: { - if (indices_ == null) { - Indices = new global::Onnx.TensorProto(); - } - input.ReadMessage(Indices); - break; - } - case 26: - case 24: { - dims_.AddEntriesFrom(ref input, _repeated_dims_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Defines a tensor shape. A dimension can be either an integer value - /// or a symbolic variable. A symbolic variable represents an unknown - /// dimension. - /// - public sealed partial class TensorShapeProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorShapeProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorShapeProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorShapeProto(TensorShapeProto other) : this() { - dim_ = other.dim_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorShapeProto Clone() { - return new TensorShapeProto(this); - } - - /// Field number for the "dim" field. - public const int DimFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_dim_codec - = pb::FieldCodec.ForMessage(10, global::Onnx.TensorShapeProto.Types.Dimension.Parser); - private readonly pbc::RepeatedField dim_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Dim { - get { return dim_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TensorShapeProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TensorShapeProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!dim_.Equals(other.dim_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= dim_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - dim_.WriteTo(output, _repeated_dim_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - dim_.WriteTo(ref output, _repeated_dim_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += dim_.CalculateSize(_repeated_dim_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TensorShapeProto other) { - if (other == null) { - return; - } - dim_.Add(other.dim_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - dim_.AddEntriesFrom(input, _repeated_dim_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - dim_.AddEntriesFrom(ref input, _repeated_dim_codec); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the TensorShapeProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public sealed partial class Dimension : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Dimension()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TensorShapeProto.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Dimension() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Dimension(Dimension other) : this() { - denotation_ = other.denotation_; - switch (other.ValueCase) { - case ValueOneofCase.DimValue: - DimValue = other.DimValue; - break; - case ValueOneofCase.DimParam: - DimParam = other.DimParam; - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Dimension Clone() { - return new Dimension(this); - } - - /// Field number for the "dim_value" field. - public const int DimValueFieldNumber = 1; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long DimValue { - get { return valueCase_ == ValueOneofCase.DimValue ? (long) value_ : 0L; } - set { - value_ = value; - valueCase_ = ValueOneofCase.DimValue; - } - } - - /// Field number for the "dim_param" field. - public const int DimParamFieldNumber = 2; - /// - /// namespace Shape - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DimParam { - get { return valueCase_ == ValueOneofCase.DimParam ? (string) value_ : ""; } - set { - value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - valueCase_ = ValueOneofCase.DimParam; - } - } - - /// Field number for the "denotation" field. - public const int DenotationFieldNumber = 3; - private string denotation_ = ""; - /// - /// Standard denotation can optionally be used to denote tensor - /// dimensions with standard semantic descriptions to ensure - /// that operations are applied to the correct axis of a tensor. - /// Refer to https://github.com/onnx/onnx/blob/master/docs/DimensionDenotation.md#denotation-definition - /// for pre-defined dimension denotations. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Denotation { - get { return denotation_; } - set { - denotation_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - private object value_; - /// Enum of possible cases for the "value" oneof. - public enum ValueOneofCase { - None = 0, - DimValue = 1, - DimParam = 2, - } - private ValueOneofCase valueCase_ = ValueOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValueOneofCase ValueCase { - get { return valueCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearValue() { - valueCase_ = ValueOneofCase.None; - value_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Dimension); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Dimension other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (DimValue != other.DimValue) return false; - if (DimParam != other.DimParam) return false; - if (Denotation != other.Denotation) return false; - if (ValueCase != other.ValueCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (valueCase_ == ValueOneofCase.DimValue) hash ^= DimValue.GetHashCode(); - if (valueCase_ == ValueOneofCase.DimParam) hash ^= DimParam.GetHashCode(); - if (Denotation.Length != 0) hash ^= Denotation.GetHashCode(); - hash ^= (int) valueCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (valueCase_ == ValueOneofCase.DimValue) { - output.WriteRawTag(8); - output.WriteInt64(DimValue); - } - if (valueCase_ == ValueOneofCase.DimParam) { - output.WriteRawTag(18); - output.WriteString(DimParam); - } - if (Denotation.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Denotation); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (valueCase_ == ValueOneofCase.DimValue) { - output.WriteRawTag(8); - output.WriteInt64(DimValue); - } - if (valueCase_ == ValueOneofCase.DimParam) { - output.WriteRawTag(18); - output.WriteString(DimParam); - } - if (Denotation.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Denotation); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (valueCase_ == ValueOneofCase.DimValue) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(DimValue); - } - if (valueCase_ == ValueOneofCase.DimParam) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DimParam); - } - if (Denotation.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Denotation); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Dimension other) { - if (other == null) { - return; - } - if (other.Denotation.Length != 0) { - Denotation = other.Denotation; - } - switch (other.ValueCase) { - case ValueOneofCase.DimValue: - DimValue = other.DimValue; - break; - case ValueOneofCase.DimParam: - DimParam = other.DimParam; - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - DimValue = input.ReadInt64(); - break; - } - case 18: { - DimParam = input.ReadString(); - break; - } - case 26: { - Denotation = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - DimValue = input.ReadInt64(); - break; - } - case 18: { - DimParam = input.ReadString(); - break; - } - case 26: { - Denotation = input.ReadString(); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - /// - /// Types - /// - /// The standard ONNX data types. - /// - public sealed partial class TypeProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TypeProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[11]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TypeProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TypeProto(TypeProto other) : this() { - denotation_ = other.denotation_; - switch (other.ValueCase) { - case ValueOneofCase.TensorType: - TensorType = other.TensorType.Clone(); - break; - case ValueOneofCase.SequenceType: - SequenceType = other.SequenceType.Clone(); - break; - case ValueOneofCase.MapType: - MapType = other.MapType.Clone(); - break; - case ValueOneofCase.SparseTensorType: - SparseTensorType = other.SparseTensorType.Clone(); - break; - case ValueOneofCase.OpaqueType: - OpaqueType = other.OpaqueType.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TypeProto Clone() { - return new TypeProto(this); - } - - /// Field number for the "tensor_type" field. - public const int TensorTypeFieldNumber = 1; - /// - /// The type of a tensor. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto.Types.Tensor TensorType { - get { return valueCase_ == ValueOneofCase.TensorType ? (global::Onnx.TypeProto.Types.Tensor) value_ : null; } - set { - value_ = value; - valueCase_ = value == null ? ValueOneofCase.None : ValueOneofCase.TensorType; - } - } - - /// Field number for the "sequence_type" field. - public const int SequenceTypeFieldNumber = 4; - /// - /// The type of a sequence. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto.Types.Sequence SequenceType { - get { return valueCase_ == ValueOneofCase.SequenceType ? (global::Onnx.TypeProto.Types.Sequence) value_ : null; } - set { - value_ = value; - valueCase_ = value == null ? ValueOneofCase.None : ValueOneofCase.SequenceType; - } - } - - /// Field number for the "map_type" field. - public const int MapTypeFieldNumber = 5; - /// - /// The type of a map. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto.Types.Map MapType { - get { return valueCase_ == ValueOneofCase.MapType ? (global::Onnx.TypeProto.Types.Map) value_ : null; } - set { - value_ = value; - valueCase_ = value == null ? ValueOneofCase.None : ValueOneofCase.MapType; - } - } - - /// Field number for the "sparse_tensor_type" field. - public const int SparseTensorTypeFieldNumber = 8; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto.Types.SparseTensor SparseTensorType { - get { return valueCase_ == ValueOneofCase.SparseTensorType ? (global::Onnx.TypeProto.Types.SparseTensor) value_ : null; } - set { - value_ = value; - valueCase_ = value == null ? ValueOneofCase.None : ValueOneofCase.SparseTensorType; - } - } - - /// Field number for the "opaque_type" field. - public const int OpaqueTypeFieldNumber = 7; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto.Types.Opaque OpaqueType { - get { return valueCase_ == ValueOneofCase.OpaqueType ? (global::Onnx.TypeProto.Types.Opaque) value_ : null; } - set { - value_ = value; - valueCase_ = value == null ? ValueOneofCase.None : ValueOneofCase.OpaqueType; - } - } - - /// Field number for the "denotation" field. - public const int DenotationFieldNumber = 6; - private string denotation_ = ""; - /// - /// An optional denotation can be used to denote the whole - /// type with a standard semantic description as to what is - /// stored inside. Refer to https://github.com/onnx/onnx/blob/master/docs/TypeDenotation.md#type-denotation-definition - /// for pre-defined type denotations. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Denotation { - get { return denotation_; } - set { - denotation_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - private object value_; - /// Enum of possible cases for the "value" oneof. - public enum ValueOneofCase { - None = 0, - TensorType = 1, - SequenceType = 4, - MapType = 5, - SparseTensorType = 8, - OpaqueType = 7, - } - private ValueOneofCase valueCase_ = ValueOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValueOneofCase ValueCase { - get { return valueCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearValue() { - valueCase_ = ValueOneofCase.None; - value_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TypeProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TypeProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(TensorType, other.TensorType)) return false; - if (!object.Equals(SequenceType, other.SequenceType)) return false; - if (!object.Equals(MapType, other.MapType)) return false; - if (!object.Equals(SparseTensorType, other.SparseTensorType)) return false; - if (!object.Equals(OpaqueType, other.OpaqueType)) return false; - if (Denotation != other.Denotation) return false; - if (ValueCase != other.ValueCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (valueCase_ == ValueOneofCase.TensorType) hash ^= TensorType.GetHashCode(); - if (valueCase_ == ValueOneofCase.SequenceType) hash ^= SequenceType.GetHashCode(); - if (valueCase_ == ValueOneofCase.MapType) hash ^= MapType.GetHashCode(); - if (valueCase_ == ValueOneofCase.SparseTensorType) hash ^= SparseTensorType.GetHashCode(); - if (valueCase_ == ValueOneofCase.OpaqueType) hash ^= OpaqueType.GetHashCode(); - if (Denotation.Length != 0) hash ^= Denotation.GetHashCode(); - hash ^= (int) valueCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (valueCase_ == ValueOneofCase.TensorType) { - output.WriteRawTag(10); - output.WriteMessage(TensorType); - } - if (valueCase_ == ValueOneofCase.SequenceType) { - output.WriteRawTag(34); - output.WriteMessage(SequenceType); - } - if (valueCase_ == ValueOneofCase.MapType) { - output.WriteRawTag(42); - output.WriteMessage(MapType); - } - if (Denotation.Length != 0) { - output.WriteRawTag(50); - output.WriteString(Denotation); - } - if (valueCase_ == ValueOneofCase.OpaqueType) { - output.WriteRawTag(58); - output.WriteMessage(OpaqueType); - } - if (valueCase_ == ValueOneofCase.SparseTensorType) { - output.WriteRawTag(66); - output.WriteMessage(SparseTensorType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (valueCase_ == ValueOneofCase.TensorType) { - output.WriteRawTag(10); - output.WriteMessage(TensorType); - } - if (valueCase_ == ValueOneofCase.SequenceType) { - output.WriteRawTag(34); - output.WriteMessage(SequenceType); - } - if (valueCase_ == ValueOneofCase.MapType) { - output.WriteRawTag(42); - output.WriteMessage(MapType); - } - if (Denotation.Length != 0) { - output.WriteRawTag(50); - output.WriteString(Denotation); - } - if (valueCase_ == ValueOneofCase.OpaqueType) { - output.WriteRawTag(58); - output.WriteMessage(OpaqueType); - } - if (valueCase_ == ValueOneofCase.SparseTensorType) { - output.WriteRawTag(66); - output.WriteMessage(SparseTensorType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (valueCase_ == ValueOneofCase.TensorType) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(TensorType); - } - if (valueCase_ == ValueOneofCase.SequenceType) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SequenceType); - } - if (valueCase_ == ValueOneofCase.MapType) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MapType); - } - if (valueCase_ == ValueOneofCase.SparseTensorType) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SparseTensorType); - } - if (valueCase_ == ValueOneofCase.OpaqueType) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OpaqueType); - } - if (Denotation.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Denotation); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TypeProto other) { - if (other == null) { - return; - } - if (other.Denotation.Length != 0) { - Denotation = other.Denotation; - } - switch (other.ValueCase) { - case ValueOneofCase.TensorType: - if (TensorType == null) { - TensorType = new global::Onnx.TypeProto.Types.Tensor(); - } - TensorType.MergeFrom(other.TensorType); - break; - case ValueOneofCase.SequenceType: - if (SequenceType == null) { - SequenceType = new global::Onnx.TypeProto.Types.Sequence(); - } - SequenceType.MergeFrom(other.SequenceType); - break; - case ValueOneofCase.MapType: - if (MapType == null) { - MapType = new global::Onnx.TypeProto.Types.Map(); - } - MapType.MergeFrom(other.MapType); - break; - case ValueOneofCase.SparseTensorType: - if (SparseTensorType == null) { - SparseTensorType = new global::Onnx.TypeProto.Types.SparseTensor(); - } - SparseTensorType.MergeFrom(other.SparseTensorType); - break; - case ValueOneofCase.OpaqueType: - if (OpaqueType == null) { - OpaqueType = new global::Onnx.TypeProto.Types.Opaque(); - } - OpaqueType.MergeFrom(other.OpaqueType); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - global::Onnx.TypeProto.Types.Tensor subBuilder = new global::Onnx.TypeProto.Types.Tensor(); - if (valueCase_ == ValueOneofCase.TensorType) { - subBuilder.MergeFrom(TensorType); - } - input.ReadMessage(subBuilder); - TensorType = subBuilder; - break; - } - case 34: { - global::Onnx.TypeProto.Types.Sequence subBuilder = new global::Onnx.TypeProto.Types.Sequence(); - if (valueCase_ == ValueOneofCase.SequenceType) { - subBuilder.MergeFrom(SequenceType); - } - input.ReadMessage(subBuilder); - SequenceType = subBuilder; - break; - } - case 42: { - global::Onnx.TypeProto.Types.Map subBuilder = new global::Onnx.TypeProto.Types.Map(); - if (valueCase_ == ValueOneofCase.MapType) { - subBuilder.MergeFrom(MapType); - } - input.ReadMessage(subBuilder); - MapType = subBuilder; - break; - } - case 50: { - Denotation = input.ReadString(); - break; - } - case 58: { - global::Onnx.TypeProto.Types.Opaque subBuilder = new global::Onnx.TypeProto.Types.Opaque(); - if (valueCase_ == ValueOneofCase.OpaqueType) { - subBuilder.MergeFrom(OpaqueType); - } - input.ReadMessage(subBuilder); - OpaqueType = subBuilder; - break; - } - case 66: { - global::Onnx.TypeProto.Types.SparseTensor subBuilder = new global::Onnx.TypeProto.Types.SparseTensor(); - if (valueCase_ == ValueOneofCase.SparseTensorType) { - subBuilder.MergeFrom(SparseTensorType); - } - input.ReadMessage(subBuilder); - SparseTensorType = subBuilder; - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - global::Onnx.TypeProto.Types.Tensor subBuilder = new global::Onnx.TypeProto.Types.Tensor(); - if (valueCase_ == ValueOneofCase.TensorType) { - subBuilder.MergeFrom(TensorType); - } - input.ReadMessage(subBuilder); - TensorType = subBuilder; - break; - } - case 34: { - global::Onnx.TypeProto.Types.Sequence subBuilder = new global::Onnx.TypeProto.Types.Sequence(); - if (valueCase_ == ValueOneofCase.SequenceType) { - subBuilder.MergeFrom(SequenceType); - } - input.ReadMessage(subBuilder); - SequenceType = subBuilder; - break; - } - case 42: { - global::Onnx.TypeProto.Types.Map subBuilder = new global::Onnx.TypeProto.Types.Map(); - if (valueCase_ == ValueOneofCase.MapType) { - subBuilder.MergeFrom(MapType); - } - input.ReadMessage(subBuilder); - MapType = subBuilder; - break; - } - case 50: { - Denotation = input.ReadString(); - break; - } - case 58: { - global::Onnx.TypeProto.Types.Opaque subBuilder = new global::Onnx.TypeProto.Types.Opaque(); - if (valueCase_ == ValueOneofCase.OpaqueType) { - subBuilder.MergeFrom(OpaqueType); - } - input.ReadMessage(subBuilder); - OpaqueType = subBuilder; - break; - } - case 66: { - global::Onnx.TypeProto.Types.SparseTensor subBuilder = new global::Onnx.TypeProto.Types.SparseTensor(); - if (valueCase_ == ValueOneofCase.SparseTensorType) { - subBuilder.MergeFrom(SparseTensorType); - } - input.ReadMessage(subBuilder); - SparseTensorType = subBuilder; - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the TypeProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public sealed partial class Tensor : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Tensor()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TypeProto.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Tensor() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Tensor(Tensor other) : this() { - elemType_ = other.elemType_; - shape_ = other.shape_ != null ? other.shape_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Tensor Clone() { - return new Tensor(this); - } - - /// Field number for the "elem_type" field. - public const int ElemTypeFieldNumber = 1; - private int elemType_; - /// - /// This field MUST NOT have the value of UNDEFINED - /// This field MUST have a valid TensorProto.DataType value - /// This field MUST be present for this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int ElemType { - get { return elemType_; } - set { - elemType_ = value; - } - } - - /// Field number for the "shape" field. - public const int ShapeFieldNumber = 2; - private global::Onnx.TensorShapeProto shape_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorShapeProto Shape { - get { return shape_; } - set { - shape_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Tensor); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Tensor other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (ElemType != other.ElemType) return false; - if (!object.Equals(Shape, other.Shape)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (ElemType != 0) hash ^= ElemType.GetHashCode(); - if (shape_ != null) hash ^= Shape.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (ElemType != 0) { - output.WriteRawTag(8); - output.WriteInt32(ElemType); - } - if (shape_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Shape); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (ElemType != 0) { - output.WriteRawTag(8); - output.WriteInt32(ElemType); - } - if (shape_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Shape); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (ElemType != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(ElemType); - } - if (shape_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Shape); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Tensor other) { - if (other == null) { - return; - } - if (other.ElemType != 0) { - ElemType = other.ElemType; - } - if (other.shape_ != null) { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - Shape.MergeFrom(other.Shape); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - ElemType = input.ReadInt32(); - break; - } - case 18: { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - input.ReadMessage(Shape); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - ElemType = input.ReadInt32(); - break; - } - case 18: { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - input.ReadMessage(Shape); - break; - } - } - } - } - #endif - - } - - /// - /// repeated T - /// - public sealed partial class Sequence : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Sequence()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TypeProto.Descriptor.NestedTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Sequence() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Sequence(Sequence other) : this() { - elemType_ = other.elemType_ != null ? other.elemType_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Sequence Clone() { - return new Sequence(this); - } - - /// Field number for the "elem_type" field. - public const int ElemTypeFieldNumber = 1; - private global::Onnx.TypeProto elemType_; - /// - /// The type and optional shape of each element of the sequence. - /// This field MUST be present for this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto ElemType { - get { return elemType_; } - set { - elemType_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Sequence); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Sequence other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ElemType, other.ElemType)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (elemType_ != null) hash ^= ElemType.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (elemType_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ElemType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (elemType_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ElemType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (elemType_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ElemType); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Sequence other) { - if (other == null) { - return; - } - if (other.elemType_ != null) { - if (elemType_ == null) { - ElemType = new global::Onnx.TypeProto(); - } - ElemType.MergeFrom(other.ElemType); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (elemType_ == null) { - ElemType = new global::Onnx.TypeProto(); - } - input.ReadMessage(ElemType); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (elemType_ == null) { - ElemType = new global::Onnx.TypeProto(); - } - input.ReadMessage(ElemType); - break; - } - } - } - } - #endif - - } - - /// - /// map<K,V> - /// - public sealed partial class Map : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Map()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TypeProto.Descriptor.NestedTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Map() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Map(Map other) : this() { - keyType_ = other.keyType_; - valueType_ = other.valueType_ != null ? other.valueType_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Map Clone() { - return new Map(this); - } - - /// Field number for the "key_type" field. - public const int KeyTypeFieldNumber = 1; - private int keyType_; - /// - /// This field MUST have a valid TensorProto.DataType value - /// This field MUST be present for this version of the IR. - /// This field MUST refer to an integral type ([U]INT{8|16|32|64}) or STRING - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int KeyType { - get { return keyType_; } - set { - keyType_ = value; - } - } - - /// Field number for the "value_type" field. - public const int ValueTypeFieldNumber = 2; - private global::Onnx.TypeProto valueType_; - /// - /// This field MUST be present for this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto ValueType { - get { return valueType_; } - set { - valueType_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Map); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Map other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (KeyType != other.KeyType) return false; - if (!object.Equals(ValueType, other.ValueType)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (KeyType != 0) hash ^= KeyType.GetHashCode(); - if (valueType_ != null) hash ^= ValueType.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (KeyType != 0) { - output.WriteRawTag(8); - output.WriteInt32(KeyType); - } - if (valueType_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ValueType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (KeyType != 0) { - output.WriteRawTag(8); - output.WriteInt32(KeyType); - } - if (valueType_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ValueType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (KeyType != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(KeyType); - } - if (valueType_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ValueType); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Map other) { - if (other == null) { - return; - } - if (other.KeyType != 0) { - KeyType = other.KeyType; - } - if (other.valueType_ != null) { - if (valueType_ == null) { - ValueType = new global::Onnx.TypeProto(); - } - ValueType.MergeFrom(other.ValueType); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - KeyType = input.ReadInt32(); - break; - } - case 18: { - if (valueType_ == null) { - ValueType = new global::Onnx.TypeProto(); - } - input.ReadMessage(ValueType); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - KeyType = input.ReadInt32(); - break; - } - case 18: { - if (valueType_ == null) { - ValueType = new global::Onnx.TypeProto(); - } - input.ReadMessage(ValueType); - break; - } - } - } - } - #endif - - } - - public sealed partial class SparseTensor : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SparseTensor()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TypeProto.Descriptor.NestedTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensor() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensor(SparseTensor other) : this() { - elemType_ = other.elemType_; - shape_ = other.shape_ != null ? other.shape_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensor Clone() { - return new SparseTensor(this); - } - - /// Field number for the "elem_type" field. - public const int ElemTypeFieldNumber = 1; - private int elemType_; - /// - /// This field MUST NOT have the value of UNDEFINED - /// This field MUST have a valid TensorProto.DataType value - /// This field MUST be present for this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int ElemType { - get { return elemType_; } - set { - elemType_ = value; - } - } - - /// Field number for the "shape" field. - public const int ShapeFieldNumber = 2; - private global::Onnx.TensorShapeProto shape_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorShapeProto Shape { - get { return shape_; } - set { - shape_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SparseTensor); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SparseTensor other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (ElemType != other.ElemType) return false; - if (!object.Equals(Shape, other.Shape)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (ElemType != 0) hash ^= ElemType.GetHashCode(); - if (shape_ != null) hash ^= Shape.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (ElemType != 0) { - output.WriteRawTag(8); - output.WriteInt32(ElemType); - } - if (shape_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Shape); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (ElemType != 0) { - output.WriteRawTag(8); - output.WriteInt32(ElemType); - } - if (shape_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Shape); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (ElemType != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(ElemType); - } - if (shape_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Shape); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SparseTensor other) { - if (other == null) { - return; - } - if (other.ElemType != 0) { - ElemType = other.ElemType; - } - if (other.shape_ != null) { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - Shape.MergeFrom(other.Shape); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - ElemType = input.ReadInt32(); - break; - } - case 18: { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - input.ReadMessage(Shape); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - ElemType = input.ReadInt32(); - break; - } - case 18: { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - input.ReadMessage(Shape); - break; - } - } - } - } - #endif - - } - - public sealed partial class Opaque : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Opaque()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TypeProto.Descriptor.NestedTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Opaque() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Opaque(Opaque other) : this() { - domain_ = other.domain_; - name_ = other.name_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Opaque Clone() { - return new Opaque(this); - } - - /// Field number for the "domain" field. - public const int DomainFieldNumber = 1; - private string domain_ = ""; - /// - /// When missing, the domain is the same as the model's. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Domain { - get { return domain_; } - set { - domain_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 2; - private string name_ = ""; - /// - /// The name is optional but significant when provided. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Opaque); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Opaque other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Domain != other.Domain) return false; - if (Name != other.Name) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Domain.Length != 0) hash ^= Domain.GetHashCode(); - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Domain.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Domain); - } - if (Name.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Name); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Domain.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Domain); - } - if (Name.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Name); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Domain.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Domain); - } - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Opaque other) { - if (other == null) { - return; - } - if (other.Domain.Length != 0) { - Domain = other.Domain; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Domain = input.ReadString(); - break; - } - case 18: { - Name = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Domain = input.ReadString(); - break; - } - case 18: { - Name = input.ReadString(); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - /// - /// Operator Sets - /// - /// OperatorSets are uniquely identified by a (domain, opset_version) pair. - /// - public sealed partial class OperatorSetIdProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OperatorSetIdProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[12]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OperatorSetIdProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OperatorSetIdProto(OperatorSetIdProto other) : this() { - domain_ = other.domain_; - version_ = other.version_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OperatorSetIdProto Clone() { - return new OperatorSetIdProto(this); - } - - /// Field number for the "domain" field. - public const int DomainFieldNumber = 1; - private string domain_ = ""; - /// - /// The domain of the operator set being identified. - /// The empty string ("") or absence of this field implies the operator - /// set that is defined as part of the ONNX specification. - /// This field MUST be present in this version of the IR when referring to any other operator set. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Domain { - get { return domain_; } - set { - domain_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "version" field. - public const int VersionFieldNumber = 2; - private long version_; - /// - /// The version of the operator set being identified. - /// This field MUST be present in this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Version { - get { return version_; } - set { - version_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as OperatorSetIdProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(OperatorSetIdProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Domain != other.Domain) return false; - if (Version != other.Version) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Domain.Length != 0) hash ^= Domain.GetHashCode(); - if (Version != 0L) hash ^= Version.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Domain.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Domain); - } - if (Version != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Version); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Domain.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Domain); - } - if (Version != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Version); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Domain.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Domain); - } - if (Version != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Version); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(OperatorSetIdProto other) { - if (other == null) { - return; - } - if (other.Domain.Length != 0) { - Domain = other.Domain; - } - if (other.Version != 0L) { - Version = other.Version; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Domain = input.ReadString(); - break; - } - case 16: { - Version = input.ReadInt64(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Domain = input.ReadString(); - break; - } - case 16: { - Version = input.ReadInt64(); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj index 72c471e362..9c0a8062c8 100644 --- a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj +++ b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj @@ -4,7 +4,7 @@ Exe AnyCPU;x86 netcoreapp2.1 - ..\.. + $(ProjectDir)..\.. false Debug;Release;RelWithDebInfo false @@ -29,27 +29,35 @@ - Always + PreserveNewest false - Always + PreserveNewest false - - Always + + PreserveNewest false - - Always + + PreserveNewest false - - Always + + PreserveNewest + false + + + PreserveNewest + false + + + PreserveNewest false - Always + PreserveNewest false @@ -61,8 +69,13 @@ - + + + + + + diff --git a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/OnnxMl.cs b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/OnnxMl.cs deleted file mode 100644 index ab3b02749f..0000000000 --- a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/OnnxMl.cs +++ /dev/null @@ -1,6870 +0,0 @@ -// -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: onnx-ml.proto3 -// -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Onnx { - - /// Holder for reflection information generated from onnx-ml.proto3 - public static partial class OnnxMlReflection { - - #region Descriptor - /// File descriptor for onnx-ml.proto3 - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static OnnxMlReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "Cg5vbm54LW1sLnByb3RvMxIEb25ueCLoBAoOQXR0cmlidXRlUHJvdG8SDAoE", - "bmFtZRgBIAEoCRIVCg1yZWZfYXR0cl9uYW1lGBUgASgJEhIKCmRvY19zdHJp", - "bmcYDSABKAkSMAoEdHlwZRgUIAEoDjIiLm9ubnguQXR0cmlidXRlUHJvdG8u", - "QXR0cmlidXRlVHlwZRIJCgFmGAIgASgCEgkKAWkYAyABKAMSCQoBcxgEIAEo", - "DBIcCgF0GAUgASgLMhEub25ueC5UZW5zb3JQcm90bxIbCgFnGAYgASgLMhAu", - "b25ueC5HcmFwaFByb3RvEi4KDXNwYXJzZV90ZW5zb3IYFiABKAsyFy5vbm54", - "LlNwYXJzZVRlbnNvclByb3RvEg4KBmZsb2F0cxgHIAMoAhIMCgRpbnRzGAgg", - "AygDEg8KB3N0cmluZ3MYCSADKAwSIgoHdGVuc29ycxgKIAMoCzIRLm9ubngu", - "VGVuc29yUHJvdG8SIAoGZ3JhcGhzGAsgAygLMhAub25ueC5HcmFwaFByb3Rv", - "Ei8KDnNwYXJzZV90ZW5zb3JzGBcgAygLMhcub25ueC5TcGFyc2VUZW5zb3JQ", - "cm90byK4AQoNQXR0cmlidXRlVHlwZRINCglVTkRFRklORUQQABIJCgVGTE9B", - "VBABEgcKA0lOVBACEgoKBlNUUklORxADEgoKBlRFTlNPUhAEEgkKBUdSQVBI", - "EAUSEQoNU1BBUlNFX1RFTlNPUhALEgoKBkZMT0FUUxAGEggKBElOVFMQBxIL", - "CgdTVFJJTkdTEAgSCwoHVEVOU09SUxAJEgoKBkdSQVBIUxAKEhIKDlNQQVJT", - "RV9URU5TT1JTEAwiUQoOVmFsdWVJbmZvUHJvdG8SDAoEbmFtZRgBIAEoCRId", - "CgR0eXBlGAIgASgLMg8ub25ueC5UeXBlUHJvdG8SEgoKZG9jX3N0cmluZxgD", - "IAEoCSKWAQoJTm9kZVByb3RvEg0KBWlucHV0GAEgAygJEg4KBm91dHB1dBgC", - "IAMoCRIMCgRuYW1lGAMgASgJEg8KB29wX3R5cGUYBCABKAkSDgoGZG9tYWlu", - "GAcgASgJEicKCWF0dHJpYnV0ZRgFIAMoCzIULm9ubnguQXR0cmlidXRlUHJv", - "dG8SEgoKZG9jX3N0cmluZxgGIAEoCSLWAQoRVHJhaW5pbmdJbmZvUHJvdG8S", - "KAoOaW5pdGlhbGl6YXRpb24YASABKAsyEC5vbm54LkdyYXBoUHJvdG8SIwoJ", - "YWxnb3JpdGhtGAIgASgLMhAub25ueC5HcmFwaFByb3RvEjwKFmluaXRpYWxp", - "emF0aW9uX2JpbmRpbmcYAyADKAsyHC5vbm54LlN0cmluZ1N0cmluZ0VudHJ5", - "UHJvdG8SNAoOdXBkYXRlX2JpbmRpbmcYBCADKAsyHC5vbm54LlN0cmluZ1N0", - "cmluZ0VudHJ5UHJvdG8iwwIKCk1vZGVsUHJvdG8SEgoKaXJfdmVyc2lvbhgB", - "IAEoAxIuCgxvcHNldF9pbXBvcnQYCCADKAsyGC5vbm54Lk9wZXJhdG9yU2V0", - "SWRQcm90bxIVCg1wcm9kdWNlcl9uYW1lGAIgASgJEhgKEHByb2R1Y2VyX3Zl", - "cnNpb24YAyABKAkSDgoGZG9tYWluGAQgASgJEhUKDW1vZGVsX3ZlcnNpb24Y", - "BSABKAMSEgoKZG9jX3N0cmluZxgGIAEoCRIfCgVncmFwaBgHIAEoCzIQLm9u", - "bnguR3JhcGhQcm90bxI0Cg5tZXRhZGF0YV9wcm9wcxgOIAMoCzIcLm9ubngu", - "U3RyaW5nU3RyaW5nRW50cnlQcm90bxIuCg10cmFpbmluZ19pbmZvGBQgAygL", - "Mhcub25ueC5UcmFpbmluZ0luZm9Qcm90byI0ChZTdHJpbmdTdHJpbmdFbnRy", - "eVByb3RvEgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCSJrChBUZW5zb3JB", - "bm5vdGF0aW9uEhMKC3RlbnNvcl9uYW1lGAEgASgJEkIKHHF1YW50X3BhcmFt", - "ZXRlcl90ZW5zb3JfbmFtZXMYAiADKAsyHC5vbm54LlN0cmluZ1N0cmluZ0Vu", - "dHJ5UHJvdG8i2AIKCkdyYXBoUHJvdG8SHQoEbm9kZRgBIAMoCzIPLm9ubngu", - "Tm9kZVByb3RvEgwKBG5hbWUYAiABKAkSJgoLaW5pdGlhbGl6ZXIYBSADKAsy", - "ES5vbm54LlRlbnNvclByb3RvEjMKEnNwYXJzZV9pbml0aWFsaXplchgPIAMo", - "CzIXLm9ubnguU3BhcnNlVGVuc29yUHJvdG8SEgoKZG9jX3N0cmluZxgKIAEo", - "CRIjCgVpbnB1dBgLIAMoCzIULm9ubnguVmFsdWVJbmZvUHJvdG8SJAoGb3V0", - "cHV0GAwgAygLMhQub25ueC5WYWx1ZUluZm9Qcm90bxIoCgp2YWx1ZV9pbmZv", - "GA0gAygLMhQub25ueC5WYWx1ZUluZm9Qcm90bxI3ChdxdWFudGl6YXRpb25f", - "YW5ub3RhdGlvbhgOIAMoCzIWLm9ubnguVGVuc29yQW5ub3RhdGlvbiK4BQoL", - "VGVuc29yUHJvdG8SDAoEZGltcxgBIAMoAxIRCglkYXRhX3R5cGUYAiABKAUS", - "KgoHc2VnbWVudBgDIAEoCzIZLm9ubnguVGVuc29yUHJvdG8uU2VnbWVudBIW", - "CgpmbG9hdF9kYXRhGAQgAygCQgIQARIWCgppbnQzMl9kYXRhGAUgAygFQgIQ", - "ARITCgtzdHJpbmdfZGF0YRgGIAMoDBIWCgppbnQ2NF9kYXRhGAcgAygDQgIQ", - "ARIMCgRuYW1lGAggASgJEhIKCmRvY19zdHJpbmcYDCABKAkSEAoIcmF3X2Rh", - "dGEYCSABKAwSMwoNZXh0ZXJuYWxfZGF0YRgNIAMoCzIcLm9ubnguU3RyaW5n", - "U3RyaW5nRW50cnlQcm90bxI1Cg1kYXRhX2xvY2F0aW9uGA4gASgOMh4ub25u", - "eC5UZW5zb3JQcm90by5EYXRhTG9jYXRpb24SFwoLZG91YmxlX2RhdGEYCiAD", - "KAFCAhABEhcKC3VpbnQ2NF9kYXRhGAsgAygEQgIQARolCgdTZWdtZW50Eg0K", - "BWJlZ2luGAEgASgDEgsKA2VuZBgCIAEoAyLaAQoIRGF0YVR5cGUSDQoJVU5E", - "RUZJTkVEEAASCQoFRkxPQVQQARIJCgVVSU5UOBACEggKBElOVDgQAxIKCgZV", - "SU5UMTYQBBIJCgVJTlQxNhAFEgkKBUlOVDMyEAYSCQoFSU5UNjQQBxIKCgZT", - "VFJJTkcQCBIICgRCT09MEAkSCwoHRkxPQVQxNhAKEgoKBkRPVUJMRRALEgoK", - "BlVJTlQzMhAMEgoKBlVJTlQ2NBANEg0KCUNPTVBMRVg2NBAOEg4KCkNPTVBM", - "RVgxMjgQDxIMCghCRkxPQVQxNhAQIikKDERhdGFMb2NhdGlvbhILCgdERUZB", - "VUxUEAASDAoIRVhURVJOQUwQASJoChFTcGFyc2VUZW5zb3JQcm90bxIhCgZ2", - "YWx1ZXMYASABKAsyES5vbm54LlRlbnNvclByb3RvEiIKB2luZGljZXMYAiAB", - "KAsyES5vbm54LlRlbnNvclByb3RvEgwKBGRpbXMYAyADKAMilQEKEFRlbnNv", - "clNoYXBlUHJvdG8SLQoDZGltGAEgAygLMiAub25ueC5UZW5zb3JTaGFwZVBy", - "b3RvLkRpbWVuc2lvbhpSCglEaW1lbnNpb24SEwoJZGltX3ZhbHVlGAEgASgD", - "SAASEwoJZGltX3BhcmFtGAIgASgJSAASEgoKZGVub3RhdGlvbhgDIAEoCUIH", - "CgV2YWx1ZSLCBAoJVHlwZVByb3RvEi0KC3RlbnNvcl90eXBlGAEgASgLMhYu", - "b25ueC5UeXBlUHJvdG8uVGVuc29ySAASMQoNc2VxdWVuY2VfdHlwZRgEIAEo", - "CzIYLm9ubnguVHlwZVByb3RvLlNlcXVlbmNlSAASJwoIbWFwX3R5cGUYBSAB", - "KAsyEy5vbm54LlR5cGVQcm90by5NYXBIABI6ChJzcGFyc2VfdGVuc29yX3R5", - "cGUYCCABKAsyHC5vbm54LlR5cGVQcm90by5TcGFyc2VUZW5zb3JIABItCgtv", - "cGFxdWVfdHlwZRgHIAEoCzIWLm9ubnguVHlwZVByb3RvLk9wYXF1ZUgAEhIK", - "CmRlbm90YXRpb24YBiABKAkaQgoGVGVuc29yEhEKCWVsZW1fdHlwZRgBIAEo", - "BRIlCgVzaGFwZRgCIAEoCzIWLm9ubnguVGVuc29yU2hhcGVQcm90bxouCghT", - "ZXF1ZW5jZRIiCgllbGVtX3R5cGUYASABKAsyDy5vbm54LlR5cGVQcm90bxo8", - "CgNNYXASEAoIa2V5X3R5cGUYASABKAUSIwoKdmFsdWVfdHlwZRgCIAEoCzIP", - "Lm9ubnguVHlwZVByb3RvGkgKDFNwYXJzZVRlbnNvchIRCgllbGVtX3R5cGUY", - "ASABKAUSJQoFc2hhcGUYAiABKAsyFi5vbm54LlRlbnNvclNoYXBlUHJvdG8a", - "JgoGT3BhcXVlEg4KBmRvbWFpbhgBIAEoCRIMCgRuYW1lGAIgASgJQgcKBXZh", - "bHVlIjUKEk9wZXJhdG9yU2V0SWRQcm90bxIOCgZkb21haW4YASABKAkSDwoH", - "dmVyc2lvbhgCIAEoAyrLAQoHVmVyc2lvbhISCg5fU1RBUlRfVkVSU0lPThAA", - "EhkKFUlSX1ZFUlNJT05fMjAxN18xMF8xMBABEhkKFUlSX1ZFUlNJT05fMjAx", - "N18xMF8zMBACEhgKFElSX1ZFUlNJT05fMjAxN18xMV8zEAMSGAoUSVJfVkVS", - "U0lPTl8yMDE5XzFfMjIQBBIYChRJUl9WRVJTSU9OXzIwMTlfM18xOBAFEhgK", - "FElSX1ZFUlNJT05fMjAxOV85XzE5EAYSDgoKSVJfVkVSU0lPThAHQgJIA2IG", - "cHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Onnx.Version), }, null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.AttributeProto), global::Onnx.AttributeProto.Parser, new[]{ "Name", "RefAttrName", "DocString", "Type", "F", "I", "S", "T", "G", "SparseTensor", "Floats", "Ints", "Strings", "Tensors", "Graphs", "SparseTensors" }, null, new[]{ typeof(global::Onnx.AttributeProto.Types.AttributeType) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.ValueInfoProto), global::Onnx.ValueInfoProto.Parser, new[]{ "Name", "Type", "DocString" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.NodeProto), global::Onnx.NodeProto.Parser, new[]{ "Input", "Output", "Name", "OpType", "Domain", "Attribute", "DocString" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TrainingInfoProto), global::Onnx.TrainingInfoProto.Parser, new[]{ "Initialization", "Algorithm", "InitializationBinding", "UpdateBinding" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.ModelProto), global::Onnx.ModelProto.Parser, new[]{ "IrVersion", "OpsetImport", "ProducerName", "ProducerVersion", "Domain", "ModelVersion", "DocString", "Graph", "MetadataProps", "TrainingInfo" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.StringStringEntryProto), global::Onnx.StringStringEntryProto.Parser, new[]{ "Key", "Value" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TensorAnnotation), global::Onnx.TensorAnnotation.Parser, new[]{ "TensorName", "QuantParameterTensorNames" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.GraphProto), global::Onnx.GraphProto.Parser, new[]{ "Node", "Name", "Initializer", "SparseInitializer", "DocString", "Input", "Output", "ValueInfo", "QuantizationAnnotation" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TensorProto), global::Onnx.TensorProto.Parser, new[]{ "Dims", "DataType", "Segment", "FloatData", "Int32Data", "StringData", "Int64Data", "Name", "DocString", "RawData", "ExternalData", "DataLocation", "DoubleData", "Uint64Data" }, null, new[]{ typeof(global::Onnx.TensorProto.Types.DataType), typeof(global::Onnx.TensorProto.Types.DataLocation) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TensorProto.Types.Segment), global::Onnx.TensorProto.Types.Segment.Parser, new[]{ "Begin", "End" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.SparseTensorProto), global::Onnx.SparseTensorProto.Parser, new[]{ "Values", "Indices", "Dims" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TensorShapeProto), global::Onnx.TensorShapeProto.Parser, new[]{ "Dim" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TensorShapeProto.Types.Dimension), global::Onnx.TensorShapeProto.Types.Dimension.Parser, new[]{ "DimValue", "DimParam", "Denotation" }, new[]{ "Value" }, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto), global::Onnx.TypeProto.Parser, new[]{ "TensorType", "SequenceType", "MapType", "SparseTensorType", "OpaqueType", "Denotation" }, new[]{ "Value" }, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto.Types.Tensor), global::Onnx.TypeProto.Types.Tensor.Parser, new[]{ "ElemType", "Shape" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto.Types.Sequence), global::Onnx.TypeProto.Types.Sequence.Parser, new[]{ "ElemType" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto.Types.Map), global::Onnx.TypeProto.Types.Map.Parser, new[]{ "KeyType", "ValueType" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto.Types.SparseTensor), global::Onnx.TypeProto.Types.SparseTensor.Parser, new[]{ "ElemType", "Shape" }, null, null, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.TypeProto.Types.Opaque), global::Onnx.TypeProto.Types.Opaque.Parser, new[]{ "Domain", "Name" }, null, null, null, null)}), - new pbr::GeneratedClrTypeInfo(typeof(global::Onnx.OperatorSetIdProto), global::Onnx.OperatorSetIdProto.Parser, new[]{ "Domain", "Version" }, null, null, null, null) - })); - } - #endregion - - } - #region Enums - /// - /// Versioning - /// - /// ONNX versioning is specified in docs/IR.md and elaborated on in docs/Versioning.md - /// - /// To be compatible with both proto2 and proto3, we will use a version number - /// that is not defined by the default value but an explicit enum number. - /// - public enum Version { - /// - /// proto3 requires the first enum value to be zero. - /// We add this just to appease the compiler. - /// - [pbr::OriginalName("_START_VERSION")] StartVersion = 0, - /// - /// The version field is always serialized and we will use it to store the - /// version that the graph is generated from. This helps us set up version - /// control. - /// For the IR, we are using simple numbers starting with 0x00000001, - /// which was the version we published on Oct 10, 2017. - /// - [pbr::OriginalName("IR_VERSION_2017_10_10")] IrVersion20171010 = 1, - /// - /// IR_VERSION 2 published on Oct 30, 2017 - /// - Added type discriminator to AttributeProto to support proto3 users - /// - [pbr::OriginalName("IR_VERSION_2017_10_30")] IrVersion20171030 = 2, - /// - /// IR VERSION 3 published on Nov 3, 2017 - /// - For operator versioning: - /// - Added new message OperatorSetIdProto - /// - Added opset_import in ModelProto - /// - For vendor extensions, added domain in NodeProto - /// - [pbr::OriginalName("IR_VERSION_2017_11_3")] IrVersion2017113 = 3, - /// - /// IR VERSION 4 published on Jan 22, 2019 - /// - Relax constraint that initializers should be a subset of graph inputs - /// - Add type BFLOAT16 - /// - [pbr::OriginalName("IR_VERSION_2019_1_22")] IrVersion2019122 = 4, - /// - /// IR VERSION 5 published on March 18, 2019 - /// - Add message TensorAnnotation. - /// - Add quantization annotation in GraphProto to map tensor with its scale and zero point quantization parameters. - /// - [pbr::OriginalName("IR_VERSION_2019_3_18")] IrVersion2019318 = 5, - /// - /// IR VERSION 6 published on Sep 19, 2019 - /// - Add support for sparse tensor constants stored in model. - /// - Add message SparseTensorProto - /// - Add sparse initializers - /// - [pbr::OriginalName("IR_VERSION_2019_9_19")] IrVersion2019919 = 6, - /// - /// IR VERSION 7 published on <TBD> - /// - Add support to allow function body graph to rely on multiple external opreator sets. - /// - Add a list to promote inference graph's initializers to global and - /// mutable variables. Global variables are visible in all graphs of the - /// stored models. - /// - Add message TrainingInfoProto to store initialization - /// method and training algorithm. The execution of TrainingInfoProto - /// can modify the values of mutable variables. - /// - Implicitly add inference graph into each TrainingInfoProto's algorithm. - /// - [pbr::OriginalName("IR_VERSION")] IrVersion = 7, - } - - #endregion - - #region Messages - /// - /// Attributes - /// - /// A named attribute containing either singular float, integer, string, graph, - /// and tensor values, or repeated float, integer, string, graph, and tensor values. - /// An AttributeProto MUST contain the name field, and *only one* of the - /// following content fields, effectively enforcing a C/C++ union equivalent. - /// - public sealed partial class AttributeProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new AttributeProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AttributeProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AttributeProto(AttributeProto other) : this() { - name_ = other.name_; - refAttrName_ = other.refAttrName_; - docString_ = other.docString_; - type_ = other.type_; - f_ = other.f_; - i_ = other.i_; - s_ = other.s_; - t_ = other.t_ != null ? other.t_.Clone() : null; - g_ = other.g_ != null ? other.g_.Clone() : null; - sparseTensor_ = other.sparseTensor_ != null ? other.sparseTensor_.Clone() : null; - floats_ = other.floats_.Clone(); - ints_ = other.ints_.Clone(); - strings_ = other.strings_.Clone(); - tensors_ = other.tensors_.Clone(); - graphs_ = other.graphs_.Clone(); - sparseTensors_ = other.sparseTensors_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public AttributeProto Clone() { - return new AttributeProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// The name field MUST be present for this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "ref_attr_name" field. - public const int RefAttrNameFieldNumber = 21; - private string refAttrName_ = ""; - /// - /// if ref_attr_name is not empty, ref_attr_name is the attribute name in parent function. - /// In this case, this AttributeProto does not contain data, and it's a reference of attribute - /// in parent scope. - /// NOTE: This should ONLY be used in function (sub-graph). It's invalid to be used in main graph. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string RefAttrName { - get { return refAttrName_; } - set { - refAttrName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 13; - private string docString_ = ""; - /// - /// A human-readable documentation for this attribute. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 20; - private global::Onnx.AttributeProto.Types.AttributeType type_ = global::Onnx.AttributeProto.Types.AttributeType.Undefined; - /// - /// The type field MUST be present for this version of the IR. - /// For 0.0.1 versions of the IR, this field was not defined, and - /// implementations needed to use has_field heuristics to determine - /// which value field was in use. For IR_VERSION 0.0.2 or later, this - /// field MUST be set and match the f|i|s|t|... field in use. This - /// change was made to accommodate proto3 implementations. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.AttributeProto.Types.AttributeType Type { - get { return type_; } - set { - type_ = value; - } - } - - /// Field number for the "f" field. - public const int FFieldNumber = 2; - private float f_; - /// - /// Exactly ONE of the following fields must be present for this version of the IR - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public float F { - get { return f_; } - set { - f_ = value; - } - } - - /// Field number for the "i" field. - public const int IFieldNumber = 3; - private long i_; - /// - /// int - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long I { - get { return i_; } - set { - i_ = value; - } - } - - /// Field number for the "s" field. - public const int SFieldNumber = 4; - private pb::ByteString s_ = pb::ByteString.Empty; - /// - /// UTF-8 string - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString S { - get { return s_; } - set { - s_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "t" field. - public const int TFieldNumber = 5; - private global::Onnx.TensorProto t_; - /// - /// tensor value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorProto T { - get { return t_; } - set { - t_ = value; - } - } - - /// Field number for the "g" field. - public const int GFieldNumber = 6; - private global::Onnx.GraphProto g_; - /// - /// graph - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.GraphProto G { - get { return g_; } - set { - g_ = value; - } - } - - /// Field number for the "sparse_tensor" field. - public const int SparseTensorFieldNumber = 22; - private global::Onnx.SparseTensorProto sparseTensor_; - /// - /// sparse tensor value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.SparseTensorProto SparseTensor { - get { return sparseTensor_; } - set { - sparseTensor_ = value; - } - } - - /// Field number for the "floats" field. - public const int FloatsFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_floats_codec - = pb::FieldCodec.ForFloat(58); - private readonly pbc::RepeatedField floats_ = new pbc::RepeatedField(); - /// - /// list of floats - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Floats { - get { return floats_; } - } - - /// Field number for the "ints" field. - public const int IntsFieldNumber = 8; - private static readonly pb::FieldCodec _repeated_ints_codec - = pb::FieldCodec.ForInt64(66); - private readonly pbc::RepeatedField ints_ = new pbc::RepeatedField(); - /// - /// list of ints - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Ints { - get { return ints_; } - } - - /// Field number for the "strings" field. - public const int StringsFieldNumber = 9; - private static readonly pb::FieldCodec _repeated_strings_codec - = pb::FieldCodec.ForBytes(74); - private readonly pbc::RepeatedField strings_ = new pbc::RepeatedField(); - /// - /// list of UTF-8 strings - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Strings { - get { return strings_; } - } - - /// Field number for the "tensors" field. - public const int TensorsFieldNumber = 10; - private static readonly pb::FieldCodec _repeated_tensors_codec - = pb::FieldCodec.ForMessage(82, global::Onnx.TensorProto.Parser); - private readonly pbc::RepeatedField tensors_ = new pbc::RepeatedField(); - /// - /// list of tensors - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Tensors { - get { return tensors_; } - } - - /// Field number for the "graphs" field. - public const int GraphsFieldNumber = 11; - private static readonly pb::FieldCodec _repeated_graphs_codec - = pb::FieldCodec.ForMessage(90, global::Onnx.GraphProto.Parser); - private readonly pbc::RepeatedField graphs_ = new pbc::RepeatedField(); - /// - /// list of graph - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Graphs { - get { return graphs_; } - } - - /// Field number for the "sparse_tensors" field. - public const int SparseTensorsFieldNumber = 23; - private static readonly pb::FieldCodec _repeated_sparseTensors_codec - = pb::FieldCodec.ForMessage(186, global::Onnx.SparseTensorProto.Parser); - private readonly pbc::RepeatedField sparseTensors_ = new pbc::RepeatedField(); - /// - /// list of sparse tensors - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField SparseTensors { - get { return sparseTensors_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as AttributeProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(AttributeProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (RefAttrName != other.RefAttrName) return false; - if (DocString != other.DocString) return false; - if (Type != other.Type) return false; - if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(F, other.F)) return false; - if (I != other.I) return false; - if (S != other.S) return false; - if (!object.Equals(T, other.T)) return false; - if (!object.Equals(G, other.G)) return false; - if (!object.Equals(SparseTensor, other.SparseTensor)) return false; - if(!floats_.Equals(other.floats_)) return false; - if(!ints_.Equals(other.ints_)) return false; - if(!strings_.Equals(other.strings_)) return false; - if(!tensors_.Equals(other.tensors_)) return false; - if(!graphs_.Equals(other.graphs_)) return false; - if(!sparseTensors_.Equals(other.sparseTensors_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (RefAttrName.Length != 0) hash ^= RefAttrName.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - if (Type != global::Onnx.AttributeProto.Types.AttributeType.Undefined) hash ^= Type.GetHashCode(); - if (F != 0F) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(F); - if (I != 0L) hash ^= I.GetHashCode(); - if (S.Length != 0) hash ^= S.GetHashCode(); - if (t_ != null) hash ^= T.GetHashCode(); - if (g_ != null) hash ^= G.GetHashCode(); - if (sparseTensor_ != null) hash ^= SparseTensor.GetHashCode(); - hash ^= floats_.GetHashCode(); - hash ^= ints_.GetHashCode(); - hash ^= strings_.GetHashCode(); - hash ^= tensors_.GetHashCode(); - hash ^= graphs_.GetHashCode(); - hash ^= sparseTensors_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (F != 0F) { - output.WriteRawTag(21); - output.WriteFloat(F); - } - if (I != 0L) { - output.WriteRawTag(24); - output.WriteInt64(I); - } - if (S.Length != 0) { - output.WriteRawTag(34); - output.WriteBytes(S); - } - if (t_ != null) { - output.WriteRawTag(42); - output.WriteMessage(T); - } - if (g_ != null) { - output.WriteRawTag(50); - output.WriteMessage(G); - } - floats_.WriteTo(output, _repeated_floats_codec); - ints_.WriteTo(output, _repeated_ints_codec); - strings_.WriteTo(output, _repeated_strings_codec); - tensors_.WriteTo(output, _repeated_tensors_codec); - graphs_.WriteTo(output, _repeated_graphs_codec); - if (DocString.Length != 0) { - output.WriteRawTag(106); - output.WriteString(DocString); - } - if (Type != global::Onnx.AttributeProto.Types.AttributeType.Undefined) { - output.WriteRawTag(160, 1); - output.WriteEnum((int) Type); - } - if (RefAttrName.Length != 0) { - output.WriteRawTag(170, 1); - output.WriteString(RefAttrName); - } - if (sparseTensor_ != null) { - output.WriteRawTag(178, 1); - output.WriteMessage(SparseTensor); - } - sparseTensors_.WriteTo(output, _repeated_sparseTensors_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (F != 0F) { - output.WriteRawTag(21); - output.WriteFloat(F); - } - if (I != 0L) { - output.WriteRawTag(24); - output.WriteInt64(I); - } - if (S.Length != 0) { - output.WriteRawTag(34); - output.WriteBytes(S); - } - if (t_ != null) { - output.WriteRawTag(42); - output.WriteMessage(T); - } - if (g_ != null) { - output.WriteRawTag(50); - output.WriteMessage(G); - } - floats_.WriteTo(ref output, _repeated_floats_codec); - ints_.WriteTo(ref output, _repeated_ints_codec); - strings_.WriteTo(ref output, _repeated_strings_codec); - tensors_.WriteTo(ref output, _repeated_tensors_codec); - graphs_.WriteTo(ref output, _repeated_graphs_codec); - if (DocString.Length != 0) { - output.WriteRawTag(106); - output.WriteString(DocString); - } - if (Type != global::Onnx.AttributeProto.Types.AttributeType.Undefined) { - output.WriteRawTag(160, 1); - output.WriteEnum((int) Type); - } - if (RefAttrName.Length != 0) { - output.WriteRawTag(170, 1); - output.WriteString(RefAttrName); - } - if (sparseTensor_ != null) { - output.WriteRawTag(178, 1); - output.WriteMessage(SparseTensor); - } - sparseTensors_.WriteTo(ref output, _repeated_sparseTensors_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (RefAttrName.Length != 0) { - size += 2 + pb::CodedOutputStream.ComputeStringSize(RefAttrName); - } - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - if (Type != global::Onnx.AttributeProto.Types.AttributeType.Undefined) { - size += 2 + pb::CodedOutputStream.ComputeEnumSize((int) Type); - } - if (F != 0F) { - size += 1 + 4; - } - if (I != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(I); - } - if (S.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(S); - } - if (t_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(T); - } - if (g_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(G); - } - if (sparseTensor_ != null) { - size += 2 + pb::CodedOutputStream.ComputeMessageSize(SparseTensor); - } - size += floats_.CalculateSize(_repeated_floats_codec); - size += ints_.CalculateSize(_repeated_ints_codec); - size += strings_.CalculateSize(_repeated_strings_codec); - size += tensors_.CalculateSize(_repeated_tensors_codec); - size += graphs_.CalculateSize(_repeated_graphs_codec); - size += sparseTensors_.CalculateSize(_repeated_sparseTensors_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(AttributeProto other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.RefAttrName.Length != 0) { - RefAttrName = other.RefAttrName; - } - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - if (other.Type != global::Onnx.AttributeProto.Types.AttributeType.Undefined) { - Type = other.Type; - } - if (other.F != 0F) { - F = other.F; - } - if (other.I != 0L) { - I = other.I; - } - if (other.S.Length != 0) { - S = other.S; - } - if (other.t_ != null) { - if (t_ == null) { - T = new global::Onnx.TensorProto(); - } - T.MergeFrom(other.T); - } - if (other.g_ != null) { - if (g_ == null) { - G = new global::Onnx.GraphProto(); - } - G.MergeFrom(other.G); - } - if (other.sparseTensor_ != null) { - if (sparseTensor_ == null) { - SparseTensor = new global::Onnx.SparseTensorProto(); - } - SparseTensor.MergeFrom(other.SparseTensor); - } - floats_.Add(other.floats_); - ints_.Add(other.ints_); - strings_.Add(other.strings_); - tensors_.Add(other.tensors_); - graphs_.Add(other.graphs_); - sparseTensors_.Add(other.sparseTensors_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 21: { - F = input.ReadFloat(); - break; - } - case 24: { - I = input.ReadInt64(); - break; - } - case 34: { - S = input.ReadBytes(); - break; - } - case 42: { - if (t_ == null) { - T = new global::Onnx.TensorProto(); - } - input.ReadMessage(T); - break; - } - case 50: { - if (g_ == null) { - G = new global::Onnx.GraphProto(); - } - input.ReadMessage(G); - break; - } - case 58: - case 61: { - floats_.AddEntriesFrom(input, _repeated_floats_codec); - break; - } - case 66: - case 64: { - ints_.AddEntriesFrom(input, _repeated_ints_codec); - break; - } - case 74: { - strings_.AddEntriesFrom(input, _repeated_strings_codec); - break; - } - case 82: { - tensors_.AddEntriesFrom(input, _repeated_tensors_codec); - break; - } - case 90: { - graphs_.AddEntriesFrom(input, _repeated_graphs_codec); - break; - } - case 106: { - DocString = input.ReadString(); - break; - } - case 160: { - Type = (global::Onnx.AttributeProto.Types.AttributeType) input.ReadEnum(); - break; - } - case 170: { - RefAttrName = input.ReadString(); - break; - } - case 178: { - if (sparseTensor_ == null) { - SparseTensor = new global::Onnx.SparseTensorProto(); - } - input.ReadMessage(SparseTensor); - break; - } - case 186: { - sparseTensors_.AddEntriesFrom(input, _repeated_sparseTensors_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 21: { - F = input.ReadFloat(); - break; - } - case 24: { - I = input.ReadInt64(); - break; - } - case 34: { - S = input.ReadBytes(); - break; - } - case 42: { - if (t_ == null) { - T = new global::Onnx.TensorProto(); - } - input.ReadMessage(T); - break; - } - case 50: { - if (g_ == null) { - G = new global::Onnx.GraphProto(); - } - input.ReadMessage(G); - break; - } - case 58: - case 61: { - floats_.AddEntriesFrom(ref input, _repeated_floats_codec); - break; - } - case 66: - case 64: { - ints_.AddEntriesFrom(ref input, _repeated_ints_codec); - break; - } - case 74: { - strings_.AddEntriesFrom(ref input, _repeated_strings_codec); - break; - } - case 82: { - tensors_.AddEntriesFrom(ref input, _repeated_tensors_codec); - break; - } - case 90: { - graphs_.AddEntriesFrom(ref input, _repeated_graphs_codec); - break; - } - case 106: { - DocString = input.ReadString(); - break; - } - case 160: { - Type = (global::Onnx.AttributeProto.Types.AttributeType) input.ReadEnum(); - break; - } - case 170: { - RefAttrName = input.ReadString(); - break; - } - case 178: { - if (sparseTensor_ == null) { - SparseTensor = new global::Onnx.SparseTensorProto(); - } - input.ReadMessage(SparseTensor); - break; - } - case 186: { - sparseTensors_.AddEntriesFrom(ref input, _repeated_sparseTensors_codec); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the AttributeProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - /// - /// Note: this enum is structurally identical to the OpSchema::AttrType - /// enum defined in schema.h. If you rev one, you likely need to rev the other. - /// - public enum AttributeType { - [pbr::OriginalName("UNDEFINED")] Undefined = 0, - [pbr::OriginalName("FLOAT")] Float = 1, - [pbr::OriginalName("INT")] Int = 2, - [pbr::OriginalName("STRING")] String = 3, - [pbr::OriginalName("TENSOR")] Tensor = 4, - [pbr::OriginalName("GRAPH")] Graph = 5, - [pbr::OriginalName("SPARSE_TENSOR")] SparseTensor = 11, - [pbr::OriginalName("FLOATS")] Floats = 6, - [pbr::OriginalName("INTS")] Ints = 7, - [pbr::OriginalName("STRINGS")] Strings = 8, - [pbr::OriginalName("TENSORS")] Tensors = 9, - [pbr::OriginalName("GRAPHS")] Graphs = 10, - [pbr::OriginalName("SPARSE_TENSORS")] SparseTensors = 12, - } - - } - #endregion - - } - - /// - /// Defines information on value, including the name, the type, and - /// the shape of the value. - /// - public sealed partial class ValueInfoProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ValueInfoProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValueInfoProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValueInfoProto(ValueInfoProto other) : this() { - name_ = other.name_; - type_ = other.type_ != null ? other.type_.Clone() : null; - docString_ = other.docString_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValueInfoProto Clone() { - return new ValueInfoProto(this); - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 1; - private string name_ = ""; - /// - /// This field MUST be present in this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "type" field. - public const int TypeFieldNumber = 2; - private global::Onnx.TypeProto type_; - /// - /// This field MUST be present in this version of the IR for - /// inputs and outputs of the top-level graph. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto Type { - get { return type_; } - set { - type_ = value; - } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 3; - private string docString_ = ""; - /// - /// A human-readable documentation for this value. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ValueInfoProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ValueInfoProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Name != other.Name) return false; - if (!object.Equals(Type, other.Type)) return false; - if (DocString != other.DocString) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (type_ != null) hash ^= Type.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (type_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Type); - } - if (DocString.Length != 0) { - output.WriteRawTag(26); - output.WriteString(DocString); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Name.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Name); - } - if (type_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Type); - } - if (DocString.Length != 0) { - output.WriteRawTag(26); - output.WriteString(DocString); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (type_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Type); - } - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ValueInfoProto other) { - if (other == null) { - return; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.type_ != null) { - if (type_ == null) { - Type = new global::Onnx.TypeProto(); - } - Type.MergeFrom(other.Type); - } - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - if (type_ == null) { - Type = new global::Onnx.TypeProto(); - } - input.ReadMessage(Type); - break; - } - case 26: { - DocString = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Name = input.ReadString(); - break; - } - case 18: { - if (type_ == null) { - Type = new global::Onnx.TypeProto(); - } - input.ReadMessage(Type); - break; - } - case 26: { - DocString = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// Nodes - /// - /// Computation graphs are made up of a DAG of nodes, which represent what is - /// commonly called a "layer" or "pipeline stage" in machine learning frameworks. - /// - /// For example, it can be a node of type "Conv" that takes in an image, a filter - /// tensor and a bias tensor, and produces the convolved output. - /// - public sealed partial class NodeProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new NodeProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NodeProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NodeProto(NodeProto other) : this() { - input_ = other.input_.Clone(); - output_ = other.output_.Clone(); - name_ = other.name_; - opType_ = other.opType_; - domain_ = other.domain_; - attribute_ = other.attribute_.Clone(); - docString_ = other.docString_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public NodeProto Clone() { - return new NodeProto(this); - } - - /// Field number for the "input" field. - public const int InputFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_input_codec - = pb::FieldCodec.ForString(10); - private readonly pbc::RepeatedField input_ = new pbc::RepeatedField(); - /// - /// namespace Value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Input { - get { return input_; } - } - - /// Field number for the "output" field. - public const int OutputFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_output_codec - = pb::FieldCodec.ForString(18); - private readonly pbc::RepeatedField output_ = new pbc::RepeatedField(); - /// - /// namespace Value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Output { - get { return output_; } - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 3; - private string name_ = ""; - /// - /// An optional identifier for this node in a graph. - /// This field MAY be absent in ths version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "op_type" field. - public const int OpTypeFieldNumber = 4; - private string opType_ = ""; - /// - /// The symbolic identifier of the Operator to execute. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string OpType { - get { return opType_; } - set { - opType_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "domain" field. - public const int DomainFieldNumber = 7; - private string domain_ = ""; - /// - /// The domain of the OperatorSet that specifies the operator named by op_type. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Domain { - get { return domain_; } - set { - domain_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "attribute" field. - public const int AttributeFieldNumber = 5; - private static readonly pb::FieldCodec _repeated_attribute_codec - = pb::FieldCodec.ForMessage(42, global::Onnx.AttributeProto.Parser); - private readonly pbc::RepeatedField attribute_ = new pbc::RepeatedField(); - /// - /// Additional named attributes. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Attribute { - get { return attribute_; } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 6; - private string docString_ = ""; - /// - /// A human-readable documentation for this node. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as NodeProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(NodeProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!input_.Equals(other.input_)) return false; - if(!output_.Equals(other.output_)) return false; - if (Name != other.Name) return false; - if (OpType != other.OpType) return false; - if (Domain != other.Domain) return false; - if(!attribute_.Equals(other.attribute_)) return false; - if (DocString != other.DocString) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= input_.GetHashCode(); - hash ^= output_.GetHashCode(); - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (OpType.Length != 0) hash ^= OpType.GetHashCode(); - if (Domain.Length != 0) hash ^= Domain.GetHashCode(); - hash ^= attribute_.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - input_.WriteTo(output, _repeated_input_codec); - output_.WriteTo(output, _repeated_output_codec); - if (Name.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Name); - } - if (OpType.Length != 0) { - output.WriteRawTag(34); - output.WriteString(OpType); - } - attribute_.WriteTo(output, _repeated_attribute_codec); - if (DocString.Length != 0) { - output.WriteRawTag(50); - output.WriteString(DocString); - } - if (Domain.Length != 0) { - output.WriteRawTag(58); - output.WriteString(Domain); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - input_.WriteTo(ref output, _repeated_input_codec); - output_.WriteTo(ref output, _repeated_output_codec); - if (Name.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Name); - } - if (OpType.Length != 0) { - output.WriteRawTag(34); - output.WriteString(OpType); - } - attribute_.WriteTo(ref output, _repeated_attribute_codec); - if (DocString.Length != 0) { - output.WriteRawTag(50); - output.WriteString(DocString); - } - if (Domain.Length != 0) { - output.WriteRawTag(58); - output.WriteString(Domain); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += input_.CalculateSize(_repeated_input_codec); - size += output_.CalculateSize(_repeated_output_codec); - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (OpType.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(OpType); - } - if (Domain.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Domain); - } - size += attribute_.CalculateSize(_repeated_attribute_codec); - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(NodeProto other) { - if (other == null) { - return; - } - input_.Add(other.input_); - output_.Add(other.output_); - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.OpType.Length != 0) { - OpType = other.OpType; - } - if (other.Domain.Length != 0) { - Domain = other.Domain; - } - attribute_.Add(other.attribute_); - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - input_.AddEntriesFrom(input, _repeated_input_codec); - break; - } - case 18: { - output_.AddEntriesFrom(input, _repeated_output_codec); - break; - } - case 26: { - Name = input.ReadString(); - break; - } - case 34: { - OpType = input.ReadString(); - break; - } - case 42: { - attribute_.AddEntriesFrom(input, _repeated_attribute_codec); - break; - } - case 50: { - DocString = input.ReadString(); - break; - } - case 58: { - Domain = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - input_.AddEntriesFrom(ref input, _repeated_input_codec); - break; - } - case 18: { - output_.AddEntriesFrom(ref input, _repeated_output_codec); - break; - } - case 26: { - Name = input.ReadString(); - break; - } - case 34: { - OpType = input.ReadString(); - break; - } - case 42: { - attribute_.AddEntriesFrom(ref input, _repeated_attribute_codec); - break; - } - case 50: { - DocString = input.ReadString(); - break; - } - case 58: { - Domain = input.ReadString(); - break; - } - } - } - } - #endif - - } - - /// - /// Training information - /// TrainingInfoProto stores information for training a model. - /// In particular, this defines two functionalities: an initialization-step - /// and a training-algorithm-step. Initialization resets the model - /// back to its original state as if no training has been performed. - /// Training algorithm improves the model based on input data. - /// - /// The semantics of the initialization-step is that the initializers - /// in ModelProto.graph and in TrainingInfoProto.algorithm are first - /// initialized as specified by the initializers in the graph, and then - /// updated by the "initialization_binding" in every instance in - /// ModelProto.training_info. - /// - /// The field "algorithm" defines a computation graph which represents a - /// training algorithm's step. After the execution of a - /// TrainingInfoProto.algorithm, the initializers specified by "update_binding" - /// may be immediately updated. If the targeted training algorithm contains - /// consecutive update steps (such as block coordinate descent methods), - /// the user needs to create a TrainingInfoProto for each step. - /// - public sealed partial class TrainingInfoProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TrainingInfoProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TrainingInfoProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TrainingInfoProto(TrainingInfoProto other) : this() { - initialization_ = other.initialization_ != null ? other.initialization_.Clone() : null; - algorithm_ = other.algorithm_ != null ? other.algorithm_.Clone() : null; - initializationBinding_ = other.initializationBinding_.Clone(); - updateBinding_ = other.updateBinding_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TrainingInfoProto Clone() { - return new TrainingInfoProto(this); - } - - /// Field number for the "initialization" field. - public const int InitializationFieldNumber = 1; - private global::Onnx.GraphProto initialization_; - /// - /// This field describes a graph to compute the initial tensors - /// upon starting the training process. Initialization graph has no input - /// and can have multiple outputs. Usually, trainable tensors in neural - /// networks are randomly initialized. To achieve that, for each tensor, - /// the user can put a random number operator such as RandomNormal or - /// RandomUniform in TrainingInfoProto.initialization.node and assign its - /// random output to the specific tensor using "initialization_binding". - /// This graph can also set the initializers in "algorithm" in the same - /// TrainingInfoProto; a use case is resetting the number of training - /// iteration to zero. - /// - /// By default, this field is an empty graph and its evaluation does not - /// produce any output. Thus, no initializer would be changed by default. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.GraphProto Initialization { - get { return initialization_; } - set { - initialization_ = value; - } - } - - /// Field number for the "algorithm" field. - public const int AlgorithmFieldNumber = 2; - private global::Onnx.GraphProto algorithm_; - /// - /// This field represents a training algorithm step. Given required inputs, - /// it computes outputs to update initializers in its own or inference graph's - /// initializer lists. In general, this field contains loss node, gradient node, - /// optimizer node, increment of iteration count. - /// - /// An execution of the training algorithm step is performed by executing the - /// graph obtained by combining the inference graph (namely "ModelProto.graph") - /// and the "algorithm" graph. That is, the actual the actual - /// input/initializer/output/node/value_info/sparse_initializer list of - /// the training graph is the concatenation of - /// "ModelProto.graph.input/initializer/output/node/value_info/sparse_initializer" - /// and "algorithm.input/initializer/output/node/value_info/sparse_initializer" - /// in that order. This combined graph must satisfy the normal ONNX conditions. - /// Now, let's provide a visualization of graph combination for clarity. - /// Let the inference graph (i.e., "ModelProto.graph") be - /// tensor_a, tensor_b -> MatMul -> tensor_c -> Sigmoid -> tensor_d - /// and the "algorithm" graph be - /// tensor_d -> Add -> tensor_e - /// The combination process results - /// tensor_a, tensor_b -> MatMul -> tensor_c -> Sigmoid -> tensor_d -> Add -> tensor_e - /// - /// Notice that an input of a node in the "algorithm" graph may reference the - /// output of a node in the inference graph (but not the other way round). Also, inference - /// node cannot reference inputs of "algorithm". With these restrictions, inference graph - /// can always be run independently without training information. - /// - /// By default, this field is an empty graph and its evaluation does not - /// produce any output. Evaluating the default training step never - /// update any initializers. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.GraphProto Algorithm { - get { return algorithm_; } - set { - algorithm_ = value; - } - } - - /// Field number for the "initialization_binding" field. - public const int InitializationBindingFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_initializationBinding_codec - = pb::FieldCodec.ForMessage(26, global::Onnx.StringStringEntryProto.Parser); - private readonly pbc::RepeatedField initializationBinding_ = new pbc::RepeatedField(); - /// - /// This field specifies the bindings from the outputs of "initialization" to - /// some initializers in "ModelProto.graph.initializer" and - /// the "algorithm.initializer" in the same TrainingInfoProto. - /// See "update_binding" below for details. - /// - /// By default, this field is empty and no initializer would be changed - /// by the execution of "initialization". - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField InitializationBinding { - get { return initializationBinding_; } - } - - /// Field number for the "update_binding" field. - public const int UpdateBindingFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_updateBinding_codec - = pb::FieldCodec.ForMessage(34, global::Onnx.StringStringEntryProto.Parser); - private readonly pbc::RepeatedField updateBinding_ = new pbc::RepeatedField(); - /// - /// Gradient-based training is usually an iterative procedure. In one gradient - /// descent iteration, we apply - /// - /// x = x - r * g - /// - /// where "x" is the optimized tensor, "r" stands for learning rate, and "g" is - /// gradient of "x" with respect to a chosen loss. To avoid adding assignments - /// into the training graph, we split the update equation into - /// - /// y = x - r * g - /// x = y - /// - /// The user needs to save "y = x - r * g" into TrainingInfoProto.algorithm. To - /// tell that "y" should be assigned to "x", the field "update_binding" may - /// contain a key-value pair of strings, "x" (key of StringStringEntryProto) - /// and "y" (value of StringStringEntryProto). - /// For a neural network with multiple trainable (mutable) tensors, there can - /// be multiple key-value pairs in "update_binding". - /// - /// The initializers appears as keys in "update_binding" are considered - /// mutable variables. This implies some behaviors - /// as described below. - /// - /// 1. We have only unique keys in all "update_binding"s so that two - /// variables may not have the same name. This ensures that one - /// variable is assigned up to once. - /// 2. The keys must appear in names of "ModelProto.graph.initializer" or - /// "TrainingInfoProto.algorithm.initializer". - /// 3. The values must be output names of "algorithm" or "ModelProto.graph.output". - /// 4. Mutable variables are initialized to the value specified by the - /// corresponding initializer, and then potentially updated by - /// "initializer_binding"s and "update_binding"s in "TrainingInfoProto"s. - /// - /// This field usually contains names of trainable tensors - /// (in ModelProto.graph), optimizer states such as momentums in advanced - /// stochastic gradient methods (in TrainingInfoProto.graph), - /// and number of training iterations (in TrainingInfoProto.graph). - /// - /// By default, this field is empty and no initializer would be changed - /// by the execution of "algorithm". - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField UpdateBinding { - get { return updateBinding_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TrainingInfoProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TrainingInfoProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Initialization, other.Initialization)) return false; - if (!object.Equals(Algorithm, other.Algorithm)) return false; - if(!initializationBinding_.Equals(other.initializationBinding_)) return false; - if(!updateBinding_.Equals(other.updateBinding_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (initialization_ != null) hash ^= Initialization.GetHashCode(); - if (algorithm_ != null) hash ^= Algorithm.GetHashCode(); - hash ^= initializationBinding_.GetHashCode(); - hash ^= updateBinding_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (initialization_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Initialization); - } - if (algorithm_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Algorithm); - } - initializationBinding_.WriteTo(output, _repeated_initializationBinding_codec); - updateBinding_.WriteTo(output, _repeated_updateBinding_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (initialization_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Initialization); - } - if (algorithm_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Algorithm); - } - initializationBinding_.WriteTo(ref output, _repeated_initializationBinding_codec); - updateBinding_.WriteTo(ref output, _repeated_updateBinding_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (initialization_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Initialization); - } - if (algorithm_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Algorithm); - } - size += initializationBinding_.CalculateSize(_repeated_initializationBinding_codec); - size += updateBinding_.CalculateSize(_repeated_updateBinding_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TrainingInfoProto other) { - if (other == null) { - return; - } - if (other.initialization_ != null) { - if (initialization_ == null) { - Initialization = new global::Onnx.GraphProto(); - } - Initialization.MergeFrom(other.Initialization); - } - if (other.algorithm_ != null) { - if (algorithm_ == null) { - Algorithm = new global::Onnx.GraphProto(); - } - Algorithm.MergeFrom(other.Algorithm); - } - initializationBinding_.Add(other.initializationBinding_); - updateBinding_.Add(other.updateBinding_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (initialization_ == null) { - Initialization = new global::Onnx.GraphProto(); - } - input.ReadMessage(Initialization); - break; - } - case 18: { - if (algorithm_ == null) { - Algorithm = new global::Onnx.GraphProto(); - } - input.ReadMessage(Algorithm); - break; - } - case 26: { - initializationBinding_.AddEntriesFrom(input, _repeated_initializationBinding_codec); - break; - } - case 34: { - updateBinding_.AddEntriesFrom(input, _repeated_updateBinding_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (initialization_ == null) { - Initialization = new global::Onnx.GraphProto(); - } - input.ReadMessage(Initialization); - break; - } - case 18: { - if (algorithm_ == null) { - Algorithm = new global::Onnx.GraphProto(); - } - input.ReadMessage(Algorithm); - break; - } - case 26: { - initializationBinding_.AddEntriesFrom(ref input, _repeated_initializationBinding_codec); - break; - } - case 34: { - updateBinding_.AddEntriesFrom(ref input, _repeated_updateBinding_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Models - /// - /// ModelProto is a top-level file/container format for bundling a ML model and - /// associating its computation graph with metadata. - /// - /// The semantics of the model are described by the associated GraphProto's. - /// - public sealed partial class ModelProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ModelProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ModelProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ModelProto(ModelProto other) : this() { - irVersion_ = other.irVersion_; - opsetImport_ = other.opsetImport_.Clone(); - producerName_ = other.producerName_; - producerVersion_ = other.producerVersion_; - domain_ = other.domain_; - modelVersion_ = other.modelVersion_; - docString_ = other.docString_; - graph_ = other.graph_ != null ? other.graph_.Clone() : null; - metadataProps_ = other.metadataProps_.Clone(); - trainingInfo_ = other.trainingInfo_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ModelProto Clone() { - return new ModelProto(this); - } - - /// Field number for the "ir_version" field. - public const int IrVersionFieldNumber = 1; - private long irVersion_; - /// - /// The version of the IR this model targets. See Version enum above. - /// This field MUST be present. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long IrVersion { - get { return irVersion_; } - set { - irVersion_ = value; - } - } - - /// Field number for the "opset_import" field. - public const int OpsetImportFieldNumber = 8; - private static readonly pb::FieldCodec _repeated_opsetImport_codec - = pb::FieldCodec.ForMessage(66, global::Onnx.OperatorSetIdProto.Parser); - private readonly pbc::RepeatedField opsetImport_ = new pbc::RepeatedField(); - /// - /// The OperatorSets this model relies on. - /// All ModelProtos MUST have at least one entry that - /// specifies which version of the ONNX OperatorSet is - /// being imported. - /// - /// All nodes in the ModelProto's graph will bind against the operator - /// with the same-domain/same-op_type operator with the HIGHEST version - /// in the referenced operator sets. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField OpsetImport { - get { return opsetImport_; } - } - - /// Field number for the "producer_name" field. - public const int ProducerNameFieldNumber = 2; - private string producerName_ = ""; - /// - /// The name of the framework or tool used to generate this model. - /// This field SHOULD be present to indicate which implementation/tool/framework - /// emitted the model. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ProducerName { - get { return producerName_; } - set { - producerName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "producer_version" field. - public const int ProducerVersionFieldNumber = 3; - private string producerVersion_ = ""; - /// - /// The version of the framework or tool used to generate this model. - /// This field SHOULD be present to indicate which implementation/tool/framework - /// emitted the model. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string ProducerVersion { - get { return producerVersion_; } - set { - producerVersion_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "domain" field. - public const int DomainFieldNumber = 4; - private string domain_ = ""; - /// - /// Domain name of the model. - /// We use reverse domain names as name space indicators. For example: - /// `com.facebook.fair` or `com.microsoft.cognitiveservices` - /// - /// Together with `model_version` and GraphProto.name, this forms the unique identity of - /// the graph. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Domain { - get { return domain_; } - set { - domain_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "model_version" field. - public const int ModelVersionFieldNumber = 5; - private long modelVersion_; - /// - /// The version of the graph encoded. See Version enum below. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long ModelVersion { - get { return modelVersion_; } - set { - modelVersion_ = value; - } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 6; - private string docString_ = ""; - /// - /// A human-readable documentation for this model. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "graph" field. - public const int GraphFieldNumber = 7; - private global::Onnx.GraphProto graph_; - /// - /// The parameterized graph that is evaluated to execute the model. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.GraphProto Graph { - get { return graph_; } - set { - graph_ = value; - } - } - - /// Field number for the "metadata_props" field. - public const int MetadataPropsFieldNumber = 14; - private static readonly pb::FieldCodec _repeated_metadataProps_codec - = pb::FieldCodec.ForMessage(114, global::Onnx.StringStringEntryProto.Parser); - private readonly pbc::RepeatedField metadataProps_ = new pbc::RepeatedField(); - /// - /// Named metadata values; keys should be distinct. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField MetadataProps { - get { return metadataProps_; } - } - - /// Field number for the "training_info" field. - public const int TrainingInfoFieldNumber = 20; - private static readonly pb::FieldCodec _repeated_trainingInfo_codec - = pb::FieldCodec.ForMessage(162, global::Onnx.TrainingInfoProto.Parser); - private readonly pbc::RepeatedField trainingInfo_ = new pbc::RepeatedField(); - /// - /// Training-specific information. Sequentially executing all stored - /// `TrainingInfoProto.algorithm`s and assigning their outputs following - /// the corresponding `TrainingInfoProto.update_binding`s is one training - /// iteration. Similarly, to initialize the model - /// (as if training hasn't happened), the user should sequentially execute - /// all stored `TrainingInfoProto.initialization`s and assigns their outputs - /// using `TrainingInfoProto.initialization_binding`s. - /// - /// If this field is empty, the training behavior of the model is undefined. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField TrainingInfo { - get { return trainingInfo_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ModelProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ModelProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (IrVersion != other.IrVersion) return false; - if(!opsetImport_.Equals(other.opsetImport_)) return false; - if (ProducerName != other.ProducerName) return false; - if (ProducerVersion != other.ProducerVersion) return false; - if (Domain != other.Domain) return false; - if (ModelVersion != other.ModelVersion) return false; - if (DocString != other.DocString) return false; - if (!object.Equals(Graph, other.Graph)) return false; - if(!metadataProps_.Equals(other.metadataProps_)) return false; - if(!trainingInfo_.Equals(other.trainingInfo_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (IrVersion != 0L) hash ^= IrVersion.GetHashCode(); - hash ^= opsetImport_.GetHashCode(); - if (ProducerName.Length != 0) hash ^= ProducerName.GetHashCode(); - if (ProducerVersion.Length != 0) hash ^= ProducerVersion.GetHashCode(); - if (Domain.Length != 0) hash ^= Domain.GetHashCode(); - if (ModelVersion != 0L) hash ^= ModelVersion.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - if (graph_ != null) hash ^= Graph.GetHashCode(); - hash ^= metadataProps_.GetHashCode(); - hash ^= trainingInfo_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (IrVersion != 0L) { - output.WriteRawTag(8); - output.WriteInt64(IrVersion); - } - if (ProducerName.Length != 0) { - output.WriteRawTag(18); - output.WriteString(ProducerName); - } - if (ProducerVersion.Length != 0) { - output.WriteRawTag(26); - output.WriteString(ProducerVersion); - } - if (Domain.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Domain); - } - if (ModelVersion != 0L) { - output.WriteRawTag(40); - output.WriteInt64(ModelVersion); - } - if (DocString.Length != 0) { - output.WriteRawTag(50); - output.WriteString(DocString); - } - if (graph_ != null) { - output.WriteRawTag(58); - output.WriteMessage(Graph); - } - opsetImport_.WriteTo(output, _repeated_opsetImport_codec); - metadataProps_.WriteTo(output, _repeated_metadataProps_codec); - trainingInfo_.WriteTo(output, _repeated_trainingInfo_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (IrVersion != 0L) { - output.WriteRawTag(8); - output.WriteInt64(IrVersion); - } - if (ProducerName.Length != 0) { - output.WriteRawTag(18); - output.WriteString(ProducerName); - } - if (ProducerVersion.Length != 0) { - output.WriteRawTag(26); - output.WriteString(ProducerVersion); - } - if (Domain.Length != 0) { - output.WriteRawTag(34); - output.WriteString(Domain); - } - if (ModelVersion != 0L) { - output.WriteRawTag(40); - output.WriteInt64(ModelVersion); - } - if (DocString.Length != 0) { - output.WriteRawTag(50); - output.WriteString(DocString); - } - if (graph_ != null) { - output.WriteRawTag(58); - output.WriteMessage(Graph); - } - opsetImport_.WriteTo(ref output, _repeated_opsetImport_codec); - metadataProps_.WriteTo(ref output, _repeated_metadataProps_codec); - trainingInfo_.WriteTo(ref output, _repeated_trainingInfo_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (IrVersion != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(IrVersion); - } - size += opsetImport_.CalculateSize(_repeated_opsetImport_codec); - if (ProducerName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ProducerName); - } - if (ProducerVersion.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(ProducerVersion); - } - if (Domain.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Domain); - } - if (ModelVersion != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(ModelVersion); - } - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - if (graph_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Graph); - } - size += metadataProps_.CalculateSize(_repeated_metadataProps_codec); - size += trainingInfo_.CalculateSize(_repeated_trainingInfo_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ModelProto other) { - if (other == null) { - return; - } - if (other.IrVersion != 0L) { - IrVersion = other.IrVersion; - } - opsetImport_.Add(other.opsetImport_); - if (other.ProducerName.Length != 0) { - ProducerName = other.ProducerName; - } - if (other.ProducerVersion.Length != 0) { - ProducerVersion = other.ProducerVersion; - } - if (other.Domain.Length != 0) { - Domain = other.Domain; - } - if (other.ModelVersion != 0L) { - ModelVersion = other.ModelVersion; - } - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - if (other.graph_ != null) { - if (graph_ == null) { - Graph = new global::Onnx.GraphProto(); - } - Graph.MergeFrom(other.Graph); - } - metadataProps_.Add(other.metadataProps_); - trainingInfo_.Add(other.trainingInfo_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - IrVersion = input.ReadInt64(); - break; - } - case 18: { - ProducerName = input.ReadString(); - break; - } - case 26: { - ProducerVersion = input.ReadString(); - break; - } - case 34: { - Domain = input.ReadString(); - break; - } - case 40: { - ModelVersion = input.ReadInt64(); - break; - } - case 50: { - DocString = input.ReadString(); - break; - } - case 58: { - if (graph_ == null) { - Graph = new global::Onnx.GraphProto(); - } - input.ReadMessage(Graph); - break; - } - case 66: { - opsetImport_.AddEntriesFrom(input, _repeated_opsetImport_codec); - break; - } - case 114: { - metadataProps_.AddEntriesFrom(input, _repeated_metadataProps_codec); - break; - } - case 162: { - trainingInfo_.AddEntriesFrom(input, _repeated_trainingInfo_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - IrVersion = input.ReadInt64(); - break; - } - case 18: { - ProducerName = input.ReadString(); - break; - } - case 26: { - ProducerVersion = input.ReadString(); - break; - } - case 34: { - Domain = input.ReadString(); - break; - } - case 40: { - ModelVersion = input.ReadInt64(); - break; - } - case 50: { - DocString = input.ReadString(); - break; - } - case 58: { - if (graph_ == null) { - Graph = new global::Onnx.GraphProto(); - } - input.ReadMessage(Graph); - break; - } - case 66: { - opsetImport_.AddEntriesFrom(ref input, _repeated_opsetImport_codec); - break; - } - case 114: { - metadataProps_.AddEntriesFrom(ref input, _repeated_metadataProps_codec); - break; - } - case 162: { - trainingInfo_.AddEntriesFrom(ref input, _repeated_trainingInfo_codec); - break; - } - } - } - } - #endif - - } - - /// - /// StringStringEntryProto follows the pattern for cross-proto-version maps. - /// See https://developers.google.com/protocol-buffers/docs/proto3#maps - /// - public sealed partial class StringStringEntryProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new StringStringEntryProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[5]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringStringEntryProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringStringEntryProto(StringStringEntryProto other) : this() { - key_ = other.key_; - value_ = other.value_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public StringStringEntryProto Clone() { - return new StringStringEntryProto(this); - } - - /// Field number for the "key" field. - public const int KeyFieldNumber = 1; - private string key_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Key { - get { return key_; } - set { - key_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "value" field. - public const int ValueFieldNumber = 2; - private string value_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Value { - get { return value_; } - set { - value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as StringStringEntryProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(StringStringEntryProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Key != other.Key) return false; - if (Value != other.Value) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Key.Length != 0) hash ^= Key.GetHashCode(); - if (Value.Length != 0) hash ^= Value.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Key.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Key); - } - if (Value.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Key.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Key); - } - if (Value.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Value); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Key.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Key); - } - if (Value.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Value); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(StringStringEntryProto other) { - if (other == null) { - return; - } - if (other.Key.Length != 0) { - Key = other.Key; - } - if (other.Value.Length != 0) { - Value = other.Value; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Key = input.ReadString(); - break; - } - case 18: { - Value = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Key = input.ReadString(); - break; - } - case 18: { - Value = input.ReadString(); - break; - } - } - } - } - #endif - - } - - public sealed partial class TensorAnnotation : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorAnnotation()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[6]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorAnnotation() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorAnnotation(TensorAnnotation other) : this() { - tensorName_ = other.tensorName_; - quantParameterTensorNames_ = other.quantParameterTensorNames_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorAnnotation Clone() { - return new TensorAnnotation(this); - } - - /// Field number for the "tensor_name" field. - public const int TensorNameFieldNumber = 1; - private string tensorName_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string TensorName { - get { return tensorName_; } - set { - tensorName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "quant_parameter_tensor_names" field. - public const int QuantParameterTensorNamesFieldNumber = 2; - private static readonly pb::FieldCodec _repeated_quantParameterTensorNames_codec - = pb::FieldCodec.ForMessage(18, global::Onnx.StringStringEntryProto.Parser); - private readonly pbc::RepeatedField quantParameterTensorNames_ = new pbc::RepeatedField(); - /// - /// <key, value> pairs to annotate tensor specified by <tensor_name> above. - /// The keys used in the mapping below must be pre-defined in ONNX spec. - /// For example, for 8-bit linear quantization case, 'SCALE_TENSOR', 'ZERO_POINT_TENSOR' will be pre-defined as - /// quantization parameter keys. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField QuantParameterTensorNames { - get { return quantParameterTensorNames_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TensorAnnotation); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TensorAnnotation other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (TensorName != other.TensorName) return false; - if(!quantParameterTensorNames_.Equals(other.quantParameterTensorNames_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (TensorName.Length != 0) hash ^= TensorName.GetHashCode(); - hash ^= quantParameterTensorNames_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (TensorName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(TensorName); - } - quantParameterTensorNames_.WriteTo(output, _repeated_quantParameterTensorNames_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (TensorName.Length != 0) { - output.WriteRawTag(10); - output.WriteString(TensorName); - } - quantParameterTensorNames_.WriteTo(ref output, _repeated_quantParameterTensorNames_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (TensorName.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(TensorName); - } - size += quantParameterTensorNames_.CalculateSize(_repeated_quantParameterTensorNames_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TensorAnnotation other) { - if (other == null) { - return; - } - if (other.TensorName.Length != 0) { - TensorName = other.TensorName; - } - quantParameterTensorNames_.Add(other.quantParameterTensorNames_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - TensorName = input.ReadString(); - break; - } - case 18: { - quantParameterTensorNames_.AddEntriesFrom(input, _repeated_quantParameterTensorNames_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - TensorName = input.ReadString(); - break; - } - case 18: { - quantParameterTensorNames_.AddEntriesFrom(ref input, _repeated_quantParameterTensorNames_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Graphs - /// - /// A graph defines the computational logic of a model and is comprised of a parameterized - /// list of nodes that form a directed acyclic graph based on their inputs and outputs. - /// This is the equivalent of the "network" or "graph" in many deep learning - /// frameworks. - /// - public sealed partial class GraphProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new GraphProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[7]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GraphProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GraphProto(GraphProto other) : this() { - node_ = other.node_.Clone(); - name_ = other.name_; - initializer_ = other.initializer_.Clone(); - sparseInitializer_ = other.sparseInitializer_.Clone(); - docString_ = other.docString_; - input_ = other.input_.Clone(); - output_ = other.output_.Clone(); - valueInfo_ = other.valueInfo_.Clone(); - quantizationAnnotation_ = other.quantizationAnnotation_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public GraphProto Clone() { - return new GraphProto(this); - } - - /// Field number for the "node" field. - public const int NodeFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_node_codec - = pb::FieldCodec.ForMessage(10, global::Onnx.NodeProto.Parser); - private readonly pbc::RepeatedField node_ = new pbc::RepeatedField(); - /// - /// The nodes in the graph, sorted topologically. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Node { - get { return node_; } - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 2; - private string name_ = ""; - /// - /// The name of the graph. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "initializer" field. - public const int InitializerFieldNumber = 5; - private static readonly pb::FieldCodec _repeated_initializer_codec - = pb::FieldCodec.ForMessage(42, global::Onnx.TensorProto.Parser); - private readonly pbc::RepeatedField initializer_ = new pbc::RepeatedField(); - /// - /// A list of named tensor values, used to specify constant inputs of the graph. - /// Each initializer (both TensorProto as well SparseTensorProto) MUST have a name. - /// The name MUST be unique across both initializer and sparse_initializer, - /// but the name MAY also appear in the input list. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Initializer { - get { return initializer_; } - } - - /// Field number for the "sparse_initializer" field. - public const int SparseInitializerFieldNumber = 15; - private static readonly pb::FieldCodec _repeated_sparseInitializer_codec - = pb::FieldCodec.ForMessage(122, global::Onnx.SparseTensorProto.Parser); - private readonly pbc::RepeatedField sparseInitializer_ = new pbc::RepeatedField(); - /// - /// Initializers (see above) stored in sparse format. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField SparseInitializer { - get { return sparseInitializer_; } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 10; - private string docString_ = ""; - /// - /// A human-readable documentation for this graph. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "input" field. - public const int InputFieldNumber = 11; - private static readonly pb::FieldCodec _repeated_input_codec - = pb::FieldCodec.ForMessage(90, global::Onnx.ValueInfoProto.Parser); - private readonly pbc::RepeatedField input_ = new pbc::RepeatedField(); - /// - /// The inputs and outputs of the graph. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Input { - get { return input_; } - } - - /// Field number for the "output" field. - public const int OutputFieldNumber = 12; - private static readonly pb::FieldCodec _repeated_output_codec - = pb::FieldCodec.ForMessage(98, global::Onnx.ValueInfoProto.Parser); - private readonly pbc::RepeatedField output_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Output { - get { return output_; } - } - - /// Field number for the "value_info" field. - public const int ValueInfoFieldNumber = 13; - private static readonly pb::FieldCodec _repeated_valueInfo_codec - = pb::FieldCodec.ForMessage(106, global::Onnx.ValueInfoProto.Parser); - private readonly pbc::RepeatedField valueInfo_ = new pbc::RepeatedField(); - /// - /// Information for the values in the graph. The ValueInfoProto.name's - /// must be distinct. It is optional for a value to appear in value_info list. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField ValueInfo { - get { return valueInfo_; } - } - - /// Field number for the "quantization_annotation" field. - public const int QuantizationAnnotationFieldNumber = 14; - private static readonly pb::FieldCodec _repeated_quantizationAnnotation_codec - = pb::FieldCodec.ForMessage(114, global::Onnx.TensorAnnotation.Parser); - private readonly pbc::RepeatedField quantizationAnnotation_ = new pbc::RepeatedField(); - /// - /// This field carries information to indicate the mapping among a tensor and its - /// quantization parameter tensors. For example: - /// For tensor 'a', it may have {'SCALE_TENSOR', 'a_scale'} and {'ZERO_POINT_TENSOR', 'a_zero_point'} annotated, - /// which means, tensor 'a_scale' and tensor 'a_zero_point' are scale and zero point of tensor 'a' in the model. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField QuantizationAnnotation { - get { return quantizationAnnotation_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as GraphProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(GraphProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!node_.Equals(other.node_)) return false; - if (Name != other.Name) return false; - if(!initializer_.Equals(other.initializer_)) return false; - if(!sparseInitializer_.Equals(other.sparseInitializer_)) return false; - if (DocString != other.DocString) return false; - if(!input_.Equals(other.input_)) return false; - if(!output_.Equals(other.output_)) return false; - if(!valueInfo_.Equals(other.valueInfo_)) return false; - if(!quantizationAnnotation_.Equals(other.quantizationAnnotation_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= node_.GetHashCode(); - if (Name.Length != 0) hash ^= Name.GetHashCode(); - hash ^= initializer_.GetHashCode(); - hash ^= sparseInitializer_.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - hash ^= input_.GetHashCode(); - hash ^= output_.GetHashCode(); - hash ^= valueInfo_.GetHashCode(); - hash ^= quantizationAnnotation_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - node_.WriteTo(output, _repeated_node_codec); - if (Name.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Name); - } - initializer_.WriteTo(output, _repeated_initializer_codec); - if (DocString.Length != 0) { - output.WriteRawTag(82); - output.WriteString(DocString); - } - input_.WriteTo(output, _repeated_input_codec); - output_.WriteTo(output, _repeated_output_codec); - valueInfo_.WriteTo(output, _repeated_valueInfo_codec); - quantizationAnnotation_.WriteTo(output, _repeated_quantizationAnnotation_codec); - sparseInitializer_.WriteTo(output, _repeated_sparseInitializer_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - node_.WriteTo(ref output, _repeated_node_codec); - if (Name.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Name); - } - initializer_.WriteTo(ref output, _repeated_initializer_codec); - if (DocString.Length != 0) { - output.WriteRawTag(82); - output.WriteString(DocString); - } - input_.WriteTo(ref output, _repeated_input_codec); - output_.WriteTo(ref output, _repeated_output_codec); - valueInfo_.WriteTo(ref output, _repeated_valueInfo_codec); - quantizationAnnotation_.WriteTo(ref output, _repeated_quantizationAnnotation_codec); - sparseInitializer_.WriteTo(ref output, _repeated_sparseInitializer_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += node_.CalculateSize(_repeated_node_codec); - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - size += initializer_.CalculateSize(_repeated_initializer_codec); - size += sparseInitializer_.CalculateSize(_repeated_sparseInitializer_codec); - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - size += input_.CalculateSize(_repeated_input_codec); - size += output_.CalculateSize(_repeated_output_codec); - size += valueInfo_.CalculateSize(_repeated_valueInfo_codec); - size += quantizationAnnotation_.CalculateSize(_repeated_quantizationAnnotation_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(GraphProto other) { - if (other == null) { - return; - } - node_.Add(other.node_); - if (other.Name.Length != 0) { - Name = other.Name; - } - initializer_.Add(other.initializer_); - sparseInitializer_.Add(other.sparseInitializer_); - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - input_.Add(other.input_); - output_.Add(other.output_); - valueInfo_.Add(other.valueInfo_); - quantizationAnnotation_.Add(other.quantizationAnnotation_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - node_.AddEntriesFrom(input, _repeated_node_codec); - break; - } - case 18: { - Name = input.ReadString(); - break; - } - case 42: { - initializer_.AddEntriesFrom(input, _repeated_initializer_codec); - break; - } - case 82: { - DocString = input.ReadString(); - break; - } - case 90: { - input_.AddEntriesFrom(input, _repeated_input_codec); - break; - } - case 98: { - output_.AddEntriesFrom(input, _repeated_output_codec); - break; - } - case 106: { - valueInfo_.AddEntriesFrom(input, _repeated_valueInfo_codec); - break; - } - case 114: { - quantizationAnnotation_.AddEntriesFrom(input, _repeated_quantizationAnnotation_codec); - break; - } - case 122: { - sparseInitializer_.AddEntriesFrom(input, _repeated_sparseInitializer_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - node_.AddEntriesFrom(ref input, _repeated_node_codec); - break; - } - case 18: { - Name = input.ReadString(); - break; - } - case 42: { - initializer_.AddEntriesFrom(ref input, _repeated_initializer_codec); - break; - } - case 82: { - DocString = input.ReadString(); - break; - } - case 90: { - input_.AddEntriesFrom(ref input, _repeated_input_codec); - break; - } - case 98: { - output_.AddEntriesFrom(ref input, _repeated_output_codec); - break; - } - case 106: { - valueInfo_.AddEntriesFrom(ref input, _repeated_valueInfo_codec); - break; - } - case 114: { - quantizationAnnotation_.AddEntriesFrom(ref input, _repeated_quantizationAnnotation_codec); - break; - } - case 122: { - sparseInitializer_.AddEntriesFrom(ref input, _repeated_sparseInitializer_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Tensors - /// - /// A serialized tensor value. - /// - public sealed partial class TensorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[8]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorProto(TensorProto other) : this() { - dims_ = other.dims_.Clone(); - dataType_ = other.dataType_; - segment_ = other.segment_ != null ? other.segment_.Clone() : null; - floatData_ = other.floatData_.Clone(); - int32Data_ = other.int32Data_.Clone(); - stringData_ = other.stringData_.Clone(); - int64Data_ = other.int64Data_.Clone(); - name_ = other.name_; - docString_ = other.docString_; - rawData_ = other.rawData_; - externalData_ = other.externalData_.Clone(); - dataLocation_ = other.dataLocation_; - doubleData_ = other.doubleData_.Clone(); - uint64Data_ = other.uint64Data_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorProto Clone() { - return new TensorProto(this); - } - - /// Field number for the "dims" field. - public const int DimsFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_dims_codec - = pb::FieldCodec.ForInt64(10); - private readonly pbc::RepeatedField dims_ = new pbc::RepeatedField(); - /// - /// The shape of the tensor. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Dims { - get { return dims_; } - } - - /// Field number for the "data_type" field. - public const int DataTypeFieldNumber = 2; - private int dataType_; - /// - /// The data type of the tensor. - /// This field MUST have a valid TensorProto.DataType value - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int DataType { - get { return dataType_; } - set { - dataType_ = value; - } - } - - /// Field number for the "segment" field. - public const int SegmentFieldNumber = 3; - private global::Onnx.TensorProto.Types.Segment segment_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorProto.Types.Segment Segment { - get { return segment_; } - set { - segment_ = value; - } - } - - /// Field number for the "float_data" field. - public const int FloatDataFieldNumber = 4; - private static readonly pb::FieldCodec _repeated_floatData_codec - = pb::FieldCodec.ForFloat(34); - private readonly pbc::RepeatedField floatData_ = new pbc::RepeatedField(); - /// - /// For float and complex64 values - /// Complex64 tensors are encoded as a single array of floats, - /// with the real components appearing in odd numbered positions, - /// and the corresponding imaginary component appearing in the - /// subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] - /// is encoded as [1.0, 2.0 ,3.0 ,4.0] - /// When this field is present, the data_type field MUST be FLOAT or COMPLEX64. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField FloatData { - get { return floatData_; } - } - - /// Field number for the "int32_data" field. - public const int Int32DataFieldNumber = 5; - private static readonly pb::FieldCodec _repeated_int32Data_codec - = pb::FieldCodec.ForInt32(42); - private readonly pbc::RepeatedField int32Data_ = new pbc::RepeatedField(); - /// - /// For int32, uint8, int8, uint16, int16, bool, and float16 values - /// float16 values must be bit-wise converted to an uint16_t prior - /// to writing to the buffer. - /// When this field is present, the data_type field MUST be - /// INT32, INT16, INT8, UINT16, UINT8, BOOL, or FLOAT16 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Int32Data { - get { return int32Data_; } - } - - /// Field number for the "string_data" field. - public const int StringDataFieldNumber = 6; - private static readonly pb::FieldCodec _repeated_stringData_codec - = pb::FieldCodec.ForBytes(50); - private readonly pbc::RepeatedField stringData_ = new pbc::RepeatedField(); - /// - /// For strings. - /// Each element of string_data is a UTF-8 encoded Unicode - /// string. No trailing null, no leading BOM. The protobuf "string" - /// scalar type is not used to match ML community conventions. - /// When this field is present, the data_type field MUST be STRING - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField StringData { - get { return stringData_; } - } - - /// Field number for the "int64_data" field. - public const int Int64DataFieldNumber = 7; - private static readonly pb::FieldCodec _repeated_int64Data_codec - = pb::FieldCodec.ForInt64(58); - private readonly pbc::RepeatedField int64Data_ = new pbc::RepeatedField(); - /// - /// For int64. - /// When this field is present, the data_type field MUST be INT64 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Int64Data { - get { return int64Data_; } - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 8; - private string name_ = ""; - /// - /// Optionally, a name for the tensor. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "doc_string" field. - public const int DocStringFieldNumber = 12; - private string docString_ = ""; - /// - /// A human-readable documentation for this tensor. Markdown is allowed. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DocString { - get { return docString_; } - set { - docString_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "raw_data" field. - public const int RawDataFieldNumber = 9; - private pb::ByteString rawData_ = pb::ByteString.Empty; - /// - /// Serializations can either use one of the fields above, or use this - /// raw bytes field. The only exception is the string case, where one is - /// required to store the content in the repeated bytes string_data field. - /// - /// When this raw_data field is used to store tensor value, elements MUST - /// be stored in as fixed-width, little-endian order. - /// Floating-point data types MUST be stored in IEEE 754 format. - /// Complex64 elements must be written as two consecutive FLOAT values, real component first. - /// Complex128 elements must be written as two consecutive DOUBLE values, real component first. - /// Boolean type MUST be written one byte per tensor element (00000001 for true, 00000000 for false). - /// - /// Note: the advantage of specific field rather than the raw_data field is - /// that in some cases (e.g. int data), protobuf does a better packing via - /// variable length storage, and may lead to smaller binary footprint. - /// When this field is present, the data_type field MUST NOT be STRING or UNDEFINED - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pb::ByteString RawData { - get { return rawData_; } - set { - rawData_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "external_data" field. - public const int ExternalDataFieldNumber = 13; - private static readonly pb::FieldCodec _repeated_externalData_codec - = pb::FieldCodec.ForMessage(106, global::Onnx.StringStringEntryProto.Parser); - private readonly pbc::RepeatedField externalData_ = new pbc::RepeatedField(); - /// - /// Data can be stored inside the protobuf file using type-specific fields or raw_data. - /// Alternatively, raw bytes data can be stored in an external file, using the external_data field. - /// external_data stores key-value pairs describing data location. Recognized keys are: - /// - "location" (required) - POSIX filesystem path relative to the directory where the ONNX - /// protobuf model was stored - /// - "offset" (optional) - position of byte at which stored data begins. Integer stored as string. - /// Offset values SHOULD be multiples 4096 (page size) to enable mmap support. - /// - "length" (optional) - number of bytes containing data. Integer stored as string. - /// - "checksum" (optional) - SHA1 digest of file specified in under 'location' key. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField ExternalData { - get { return externalData_; } - } - - /// Field number for the "data_location" field. - public const int DataLocationFieldNumber = 14; - private global::Onnx.TensorProto.Types.DataLocation dataLocation_ = global::Onnx.TensorProto.Types.DataLocation.Default; - /// - /// If value not set, data is stored in raw_data (if set) otherwise in type-specified field. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorProto.Types.DataLocation DataLocation { - get { return dataLocation_; } - set { - dataLocation_ = value; - } - } - - /// Field number for the "double_data" field. - public const int DoubleDataFieldNumber = 10; - private static readonly pb::FieldCodec _repeated_doubleData_codec - = pb::FieldCodec.ForDouble(82); - private readonly pbc::RepeatedField doubleData_ = new pbc::RepeatedField(); - /// - /// For double - /// Complex128 tensors are encoded as a single array of doubles, - /// with the real components appearing in odd numbered positions, - /// and the corresponding imaginary component appearing in the - /// subsequent even numbered position. (e.g., [1.0 + 2.0i, 3.0 + 4.0i] - /// is encoded as [1.0, 2.0 ,3.0 ,4.0] - /// When this field is present, the data_type field MUST be DOUBLE or COMPLEX128 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField DoubleData { - get { return doubleData_; } - } - - /// Field number for the "uint64_data" field. - public const int Uint64DataFieldNumber = 11; - private static readonly pb::FieldCodec _repeated_uint64Data_codec - = pb::FieldCodec.ForUInt64(90); - private readonly pbc::RepeatedField uint64Data_ = new pbc::RepeatedField(); - /// - /// For uint64 and uint32 values - /// When this field is present, the data_type field MUST be - /// UINT32 or UINT64 - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Uint64Data { - get { return uint64Data_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TensorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TensorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!dims_.Equals(other.dims_)) return false; - if (DataType != other.DataType) return false; - if (!object.Equals(Segment, other.Segment)) return false; - if(!floatData_.Equals(other.floatData_)) return false; - if(!int32Data_.Equals(other.int32Data_)) return false; - if(!stringData_.Equals(other.stringData_)) return false; - if(!int64Data_.Equals(other.int64Data_)) return false; - if (Name != other.Name) return false; - if (DocString != other.DocString) return false; - if (RawData != other.RawData) return false; - if(!externalData_.Equals(other.externalData_)) return false; - if (DataLocation != other.DataLocation) return false; - if(!doubleData_.Equals(other.doubleData_)) return false; - if(!uint64Data_.Equals(other.uint64Data_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= dims_.GetHashCode(); - if (DataType != 0) hash ^= DataType.GetHashCode(); - if (segment_ != null) hash ^= Segment.GetHashCode(); - hash ^= floatData_.GetHashCode(); - hash ^= int32Data_.GetHashCode(); - hash ^= stringData_.GetHashCode(); - hash ^= int64Data_.GetHashCode(); - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (DocString.Length != 0) hash ^= DocString.GetHashCode(); - if (RawData.Length != 0) hash ^= RawData.GetHashCode(); - hash ^= externalData_.GetHashCode(); - if (DataLocation != global::Onnx.TensorProto.Types.DataLocation.Default) hash ^= DataLocation.GetHashCode(); - hash ^= doubleData_.GetHashCode(); - hash ^= uint64Data_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - dims_.WriteTo(output, _repeated_dims_codec); - if (DataType != 0) { - output.WriteRawTag(16); - output.WriteInt32(DataType); - } - if (segment_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Segment); - } - floatData_.WriteTo(output, _repeated_floatData_codec); - int32Data_.WriteTo(output, _repeated_int32Data_codec); - stringData_.WriteTo(output, _repeated_stringData_codec); - int64Data_.WriteTo(output, _repeated_int64Data_codec); - if (Name.Length != 0) { - output.WriteRawTag(66); - output.WriteString(Name); - } - if (RawData.Length != 0) { - output.WriteRawTag(74); - output.WriteBytes(RawData); - } - doubleData_.WriteTo(output, _repeated_doubleData_codec); - uint64Data_.WriteTo(output, _repeated_uint64Data_codec); - if (DocString.Length != 0) { - output.WriteRawTag(98); - output.WriteString(DocString); - } - externalData_.WriteTo(output, _repeated_externalData_codec); - if (DataLocation != global::Onnx.TensorProto.Types.DataLocation.Default) { - output.WriteRawTag(112); - output.WriteEnum((int) DataLocation); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - dims_.WriteTo(ref output, _repeated_dims_codec); - if (DataType != 0) { - output.WriteRawTag(16); - output.WriteInt32(DataType); - } - if (segment_ != null) { - output.WriteRawTag(26); - output.WriteMessage(Segment); - } - floatData_.WriteTo(ref output, _repeated_floatData_codec); - int32Data_.WriteTo(ref output, _repeated_int32Data_codec); - stringData_.WriteTo(ref output, _repeated_stringData_codec); - int64Data_.WriteTo(ref output, _repeated_int64Data_codec); - if (Name.Length != 0) { - output.WriteRawTag(66); - output.WriteString(Name); - } - if (RawData.Length != 0) { - output.WriteRawTag(74); - output.WriteBytes(RawData); - } - doubleData_.WriteTo(ref output, _repeated_doubleData_codec); - uint64Data_.WriteTo(ref output, _repeated_uint64Data_codec); - if (DocString.Length != 0) { - output.WriteRawTag(98); - output.WriteString(DocString); - } - externalData_.WriteTo(ref output, _repeated_externalData_codec); - if (DataLocation != global::Onnx.TensorProto.Types.DataLocation.Default) { - output.WriteRawTag(112); - output.WriteEnum((int) DataLocation); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += dims_.CalculateSize(_repeated_dims_codec); - if (DataType != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(DataType); - } - if (segment_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Segment); - } - size += floatData_.CalculateSize(_repeated_floatData_codec); - size += int32Data_.CalculateSize(_repeated_int32Data_codec); - size += stringData_.CalculateSize(_repeated_stringData_codec); - size += int64Data_.CalculateSize(_repeated_int64Data_codec); - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (DocString.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DocString); - } - if (RawData.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeBytesSize(RawData); - } - size += externalData_.CalculateSize(_repeated_externalData_codec); - if (DataLocation != global::Onnx.TensorProto.Types.DataLocation.Default) { - size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) DataLocation); - } - size += doubleData_.CalculateSize(_repeated_doubleData_codec); - size += uint64Data_.CalculateSize(_repeated_uint64Data_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TensorProto other) { - if (other == null) { - return; - } - dims_.Add(other.dims_); - if (other.DataType != 0) { - DataType = other.DataType; - } - if (other.segment_ != null) { - if (segment_ == null) { - Segment = new global::Onnx.TensorProto.Types.Segment(); - } - Segment.MergeFrom(other.Segment); - } - floatData_.Add(other.floatData_); - int32Data_.Add(other.int32Data_); - stringData_.Add(other.stringData_); - int64Data_.Add(other.int64Data_); - if (other.Name.Length != 0) { - Name = other.Name; - } - if (other.DocString.Length != 0) { - DocString = other.DocString; - } - if (other.RawData.Length != 0) { - RawData = other.RawData; - } - externalData_.Add(other.externalData_); - if (other.DataLocation != global::Onnx.TensorProto.Types.DataLocation.Default) { - DataLocation = other.DataLocation; - } - doubleData_.Add(other.doubleData_); - uint64Data_.Add(other.uint64Data_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: - case 8: { - dims_.AddEntriesFrom(input, _repeated_dims_codec); - break; - } - case 16: { - DataType = input.ReadInt32(); - break; - } - case 26: { - if (segment_ == null) { - Segment = new global::Onnx.TensorProto.Types.Segment(); - } - input.ReadMessage(Segment); - break; - } - case 34: - case 37: { - floatData_.AddEntriesFrom(input, _repeated_floatData_codec); - break; - } - case 42: - case 40: { - int32Data_.AddEntriesFrom(input, _repeated_int32Data_codec); - break; - } - case 50: { - stringData_.AddEntriesFrom(input, _repeated_stringData_codec); - break; - } - case 58: - case 56: { - int64Data_.AddEntriesFrom(input, _repeated_int64Data_codec); - break; - } - case 66: { - Name = input.ReadString(); - break; - } - case 74: { - RawData = input.ReadBytes(); - break; - } - case 82: - case 81: { - doubleData_.AddEntriesFrom(input, _repeated_doubleData_codec); - break; - } - case 90: - case 88: { - uint64Data_.AddEntriesFrom(input, _repeated_uint64Data_codec); - break; - } - case 98: { - DocString = input.ReadString(); - break; - } - case 106: { - externalData_.AddEntriesFrom(input, _repeated_externalData_codec); - break; - } - case 112: { - DataLocation = (global::Onnx.TensorProto.Types.DataLocation) input.ReadEnum(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: - case 8: { - dims_.AddEntriesFrom(ref input, _repeated_dims_codec); - break; - } - case 16: { - DataType = input.ReadInt32(); - break; - } - case 26: { - if (segment_ == null) { - Segment = new global::Onnx.TensorProto.Types.Segment(); - } - input.ReadMessage(Segment); - break; - } - case 34: - case 37: { - floatData_.AddEntriesFrom(ref input, _repeated_floatData_codec); - break; - } - case 42: - case 40: { - int32Data_.AddEntriesFrom(ref input, _repeated_int32Data_codec); - break; - } - case 50: { - stringData_.AddEntriesFrom(ref input, _repeated_stringData_codec); - break; - } - case 58: - case 56: { - int64Data_.AddEntriesFrom(ref input, _repeated_int64Data_codec); - break; - } - case 66: { - Name = input.ReadString(); - break; - } - case 74: { - RawData = input.ReadBytes(); - break; - } - case 82: - case 81: { - doubleData_.AddEntriesFrom(ref input, _repeated_doubleData_codec); - break; - } - case 90: - case 88: { - uint64Data_.AddEntriesFrom(ref input, _repeated_uint64Data_codec); - break; - } - case 98: { - DocString = input.ReadString(); - break; - } - case 106: { - externalData_.AddEntriesFrom(ref input, _repeated_externalData_codec); - break; - } - case 112: { - DataLocation = (global::Onnx.TensorProto.Types.DataLocation) input.ReadEnum(); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the TensorProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public enum DataType { - [pbr::OriginalName("UNDEFINED")] Undefined = 0, - /// - /// Basic types. - /// - [pbr::OriginalName("FLOAT")] Float = 1, - /// - /// uint8_t - /// - [pbr::OriginalName("UINT8")] Uint8 = 2, - /// - /// int8_t - /// - [pbr::OriginalName("INT8")] Int8 = 3, - /// - /// uint16_t - /// - [pbr::OriginalName("UINT16")] Uint16 = 4, - /// - /// int16_t - /// - [pbr::OriginalName("INT16")] Int16 = 5, - /// - /// int32_t - /// - [pbr::OriginalName("INT32")] Int32 = 6, - /// - /// int64_t - /// - [pbr::OriginalName("INT64")] Int64 = 7, - /// - /// string - /// - [pbr::OriginalName("STRING")] String = 8, - /// - /// bool - /// - [pbr::OriginalName("BOOL")] Bool = 9, - /// - /// IEEE754 half-precision floating-point format (16 bits wide). - /// This format has 1 sign bit, 5 exponent bits, and 10 mantissa bits. - /// - [pbr::OriginalName("FLOAT16")] Float16 = 10, - [pbr::OriginalName("DOUBLE")] Double = 11, - [pbr::OriginalName("UINT32")] Uint32 = 12, - [pbr::OriginalName("UINT64")] Uint64 = 13, - /// - /// complex with float32 real and imaginary components - /// - [pbr::OriginalName("COMPLEX64")] Complex64 = 14, - /// - /// complex with float64 real and imaginary components - /// - [pbr::OriginalName("COMPLEX128")] Complex128 = 15, - /// - /// Non-IEEE floating-point format based on IEEE754 single-precision - /// floating-point number truncated to 16 bits. - /// This format has 1 sign bit, 8 exponent bits, and 7 mantissa bits. - /// - [pbr::OriginalName("BFLOAT16")] Bfloat16 = 16, - } - - /// - /// Location of the data for this tensor. MUST be one of: - /// - DEFAULT - data stored inside the protobuf message. Data is stored in raw_data (if set) otherwise in type-specified field. - /// - EXTERNAL - data stored in an external location as described by external_data field. - /// - public enum DataLocation { - [pbr::OriginalName("DEFAULT")] Default = 0, - [pbr::OriginalName("EXTERNAL")] External = 1, - } - - /// - /// For very large tensors, we may want to store them in chunks, in which - /// case the following fields will specify the segment that is stored in - /// the current TensorProto. - /// - public sealed partial class Segment : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Segment()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TensorProto.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Segment() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Segment(Segment other) : this() { - begin_ = other.begin_; - end_ = other.end_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Segment Clone() { - return new Segment(this); - } - - /// Field number for the "begin" field. - public const int BeginFieldNumber = 1; - private long begin_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Begin { - get { return begin_; } - set { - begin_ = value; - } - } - - /// Field number for the "end" field. - public const int EndFieldNumber = 2; - private long end_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long End { - get { return end_; } - set { - end_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Segment); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Segment other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Begin != other.Begin) return false; - if (End != other.End) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Begin != 0L) hash ^= Begin.GetHashCode(); - if (End != 0L) hash ^= End.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Begin != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Begin); - } - if (End != 0L) { - output.WriteRawTag(16); - output.WriteInt64(End); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Begin != 0L) { - output.WriteRawTag(8); - output.WriteInt64(Begin); - } - if (End != 0L) { - output.WriteRawTag(16); - output.WriteInt64(End); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Begin != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Begin); - } - if (End != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(End); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Segment other) { - if (other == null) { - return; - } - if (other.Begin != 0L) { - Begin = other.Begin; - } - if (other.End != 0L) { - End = other.End; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - Begin = input.ReadInt64(); - break; - } - case 16: { - End = input.ReadInt64(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - Begin = input.ReadInt64(); - break; - } - case 16: { - End = input.ReadInt64(); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - /// - /// A serialized sparse-tensor value - /// - public sealed partial class SparseTensorProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SparseTensorProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[9]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensorProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensorProto(SparseTensorProto other) : this() { - values_ = other.values_ != null ? other.values_.Clone() : null; - indices_ = other.indices_ != null ? other.indices_.Clone() : null; - dims_ = other.dims_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensorProto Clone() { - return new SparseTensorProto(this); - } - - /// Field number for the "values" field. - public const int ValuesFieldNumber = 1; - private global::Onnx.TensorProto values_; - /// - /// The sequence of non-default values are encoded as a tensor of shape [NNZ]. - /// The default-value is zero for numeric tensors, and empty-string for string tensors. - /// values must have a non-empty name present which serves as a name for SparseTensorProto - /// when used in sparse_initializer list. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorProto Values { - get { return values_; } - set { - values_ = value; - } - } - - /// Field number for the "indices" field. - public const int IndicesFieldNumber = 2; - private global::Onnx.TensorProto indices_; - /// - /// The indices of the non-default values, which may be stored in one of two formats. - /// (a) Indices can be a tensor of shape [NNZ, rank] with the [i,j]-th value - /// corresponding to the j-th index of the i-th value (in the values tensor). - /// (b) Indices can be a tensor of shape [NNZ], in which case the i-th value - /// must be the linearized-index of the i-th value (in the values tensor). - /// The linearized-index can be converted into an index tuple (k_1,...,k_rank) - /// using the shape provided below. - /// The indices must appear in ascending order without duplication. - /// In the first format, the ordering is lexicographic-ordering: - /// e.g., index-value [1,4] must appear before [2,1] - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorProto Indices { - get { return indices_; } - set { - indices_ = value; - } - } - - /// Field number for the "dims" field. - public const int DimsFieldNumber = 3; - private static readonly pb::FieldCodec _repeated_dims_codec - = pb::FieldCodec.ForInt64(26); - private readonly pbc::RepeatedField dims_ = new pbc::RepeatedField(); - /// - /// The shape of the underlying dense-tensor: [dim_1, dim_2, ... dim_rank] - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Dims { - get { return dims_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SparseTensorProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SparseTensorProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(Values, other.Values)) return false; - if (!object.Equals(Indices, other.Indices)) return false; - if(!dims_.Equals(other.dims_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (values_ != null) hash ^= Values.GetHashCode(); - if (indices_ != null) hash ^= Indices.GetHashCode(); - hash ^= dims_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (values_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Values); - } - if (indices_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Indices); - } - dims_.WriteTo(output, _repeated_dims_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (values_ != null) { - output.WriteRawTag(10); - output.WriteMessage(Values); - } - if (indices_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Indices); - } - dims_.WriteTo(ref output, _repeated_dims_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (values_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Values); - } - if (indices_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Indices); - } - size += dims_.CalculateSize(_repeated_dims_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SparseTensorProto other) { - if (other == null) { - return; - } - if (other.values_ != null) { - if (values_ == null) { - Values = new global::Onnx.TensorProto(); - } - Values.MergeFrom(other.Values); - } - if (other.indices_ != null) { - if (indices_ == null) { - Indices = new global::Onnx.TensorProto(); - } - Indices.MergeFrom(other.Indices); - } - dims_.Add(other.dims_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (values_ == null) { - Values = new global::Onnx.TensorProto(); - } - input.ReadMessage(Values); - break; - } - case 18: { - if (indices_ == null) { - Indices = new global::Onnx.TensorProto(); - } - input.ReadMessage(Indices); - break; - } - case 26: - case 24: { - dims_.AddEntriesFrom(input, _repeated_dims_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (values_ == null) { - Values = new global::Onnx.TensorProto(); - } - input.ReadMessage(Values); - break; - } - case 18: { - if (indices_ == null) { - Indices = new global::Onnx.TensorProto(); - } - input.ReadMessage(Indices); - break; - } - case 26: - case 24: { - dims_.AddEntriesFrom(ref input, _repeated_dims_codec); - break; - } - } - } - } - #endif - - } - - /// - /// Defines a tensor shape. A dimension can be either an integer value - /// or a symbolic variable. A symbolic variable represents an unknown - /// dimension. - /// - public sealed partial class TensorShapeProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TensorShapeProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[10]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorShapeProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorShapeProto(TensorShapeProto other) : this() { - dim_ = other.dim_.Clone(); - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TensorShapeProto Clone() { - return new TensorShapeProto(this); - } - - /// Field number for the "dim" field. - public const int DimFieldNumber = 1; - private static readonly pb::FieldCodec _repeated_dim_codec - = pb::FieldCodec.ForMessage(10, global::Onnx.TensorShapeProto.Types.Dimension.Parser); - private readonly pbc::RepeatedField dim_ = new pbc::RepeatedField(); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public pbc::RepeatedField Dim { - get { return dim_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TensorShapeProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TensorShapeProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if(!dim_.Equals(other.dim_)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - hash ^= dim_.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - dim_.WriteTo(output, _repeated_dim_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - dim_.WriteTo(ref output, _repeated_dim_codec); - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - size += dim_.CalculateSize(_repeated_dim_codec); - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TensorShapeProto other) { - if (other == null) { - return; - } - dim_.Add(other.dim_); - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - dim_.AddEntriesFrom(input, _repeated_dim_codec); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - dim_.AddEntriesFrom(ref input, _repeated_dim_codec); - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the TensorShapeProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public sealed partial class Dimension : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Dimension()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TensorShapeProto.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Dimension() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Dimension(Dimension other) : this() { - denotation_ = other.denotation_; - switch (other.ValueCase) { - case ValueOneofCase.DimValue: - DimValue = other.DimValue; - break; - case ValueOneofCase.DimParam: - DimParam = other.DimParam; - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Dimension Clone() { - return new Dimension(this); - } - - /// Field number for the "dim_value" field. - public const int DimValueFieldNumber = 1; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long DimValue { - get { return valueCase_ == ValueOneofCase.DimValue ? (long) value_ : 0L; } - set { - value_ = value; - valueCase_ = ValueOneofCase.DimValue; - } - } - - /// Field number for the "dim_param" field. - public const int DimParamFieldNumber = 2; - /// - /// namespace Shape - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string DimParam { - get { return valueCase_ == ValueOneofCase.DimParam ? (string) value_ : ""; } - set { - value_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - valueCase_ = ValueOneofCase.DimParam; - } - } - - /// Field number for the "denotation" field. - public const int DenotationFieldNumber = 3; - private string denotation_ = ""; - /// - /// Standard denotation can optionally be used to denote tensor - /// dimensions with standard semantic descriptions to ensure - /// that operations are applied to the correct axis of a tensor. - /// Refer to https://github.com/onnx/onnx/blob/master/docs/DimensionDenotation.md#denotation-definition - /// for pre-defined dimension denotations. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Denotation { - get { return denotation_; } - set { - denotation_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - private object value_; - /// Enum of possible cases for the "value" oneof. - public enum ValueOneofCase { - None = 0, - DimValue = 1, - DimParam = 2, - } - private ValueOneofCase valueCase_ = ValueOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValueOneofCase ValueCase { - get { return valueCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearValue() { - valueCase_ = ValueOneofCase.None; - value_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Dimension); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Dimension other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (DimValue != other.DimValue) return false; - if (DimParam != other.DimParam) return false; - if (Denotation != other.Denotation) return false; - if (ValueCase != other.ValueCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (valueCase_ == ValueOneofCase.DimValue) hash ^= DimValue.GetHashCode(); - if (valueCase_ == ValueOneofCase.DimParam) hash ^= DimParam.GetHashCode(); - if (Denotation.Length != 0) hash ^= Denotation.GetHashCode(); - hash ^= (int) valueCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (valueCase_ == ValueOneofCase.DimValue) { - output.WriteRawTag(8); - output.WriteInt64(DimValue); - } - if (valueCase_ == ValueOneofCase.DimParam) { - output.WriteRawTag(18); - output.WriteString(DimParam); - } - if (Denotation.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Denotation); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (valueCase_ == ValueOneofCase.DimValue) { - output.WriteRawTag(8); - output.WriteInt64(DimValue); - } - if (valueCase_ == ValueOneofCase.DimParam) { - output.WriteRawTag(18); - output.WriteString(DimParam); - } - if (Denotation.Length != 0) { - output.WriteRawTag(26); - output.WriteString(Denotation); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (valueCase_ == ValueOneofCase.DimValue) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(DimValue); - } - if (valueCase_ == ValueOneofCase.DimParam) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(DimParam); - } - if (Denotation.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Denotation); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Dimension other) { - if (other == null) { - return; - } - if (other.Denotation.Length != 0) { - Denotation = other.Denotation; - } - switch (other.ValueCase) { - case ValueOneofCase.DimValue: - DimValue = other.DimValue; - break; - case ValueOneofCase.DimParam: - DimParam = other.DimParam; - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - DimValue = input.ReadInt64(); - break; - } - case 18: { - DimParam = input.ReadString(); - break; - } - case 26: { - Denotation = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - DimValue = input.ReadInt64(); - break; - } - case 18: { - DimParam = input.ReadString(); - break; - } - case 26: { - Denotation = input.ReadString(); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - /// - /// Types - /// - /// The standard ONNX data types. - /// - public sealed partial class TypeProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new TypeProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[11]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TypeProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TypeProto(TypeProto other) : this() { - denotation_ = other.denotation_; - switch (other.ValueCase) { - case ValueOneofCase.TensorType: - TensorType = other.TensorType.Clone(); - break; - case ValueOneofCase.SequenceType: - SequenceType = other.SequenceType.Clone(); - break; - case ValueOneofCase.MapType: - MapType = other.MapType.Clone(); - break; - case ValueOneofCase.SparseTensorType: - SparseTensorType = other.SparseTensorType.Clone(); - break; - case ValueOneofCase.OpaqueType: - OpaqueType = other.OpaqueType.Clone(); - break; - } - - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public TypeProto Clone() { - return new TypeProto(this); - } - - /// Field number for the "tensor_type" field. - public const int TensorTypeFieldNumber = 1; - /// - /// The type of a tensor. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto.Types.Tensor TensorType { - get { return valueCase_ == ValueOneofCase.TensorType ? (global::Onnx.TypeProto.Types.Tensor) value_ : null; } - set { - value_ = value; - valueCase_ = value == null ? ValueOneofCase.None : ValueOneofCase.TensorType; - } - } - - /// Field number for the "sequence_type" field. - public const int SequenceTypeFieldNumber = 4; - /// - /// The type of a sequence. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto.Types.Sequence SequenceType { - get { return valueCase_ == ValueOneofCase.SequenceType ? (global::Onnx.TypeProto.Types.Sequence) value_ : null; } - set { - value_ = value; - valueCase_ = value == null ? ValueOneofCase.None : ValueOneofCase.SequenceType; - } - } - - /// Field number for the "map_type" field. - public const int MapTypeFieldNumber = 5; - /// - /// The type of a map. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto.Types.Map MapType { - get { return valueCase_ == ValueOneofCase.MapType ? (global::Onnx.TypeProto.Types.Map) value_ : null; } - set { - value_ = value; - valueCase_ = value == null ? ValueOneofCase.None : ValueOneofCase.MapType; - } - } - - /// Field number for the "sparse_tensor_type" field. - public const int SparseTensorTypeFieldNumber = 8; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto.Types.SparseTensor SparseTensorType { - get { return valueCase_ == ValueOneofCase.SparseTensorType ? (global::Onnx.TypeProto.Types.SparseTensor) value_ : null; } - set { - value_ = value; - valueCase_ = value == null ? ValueOneofCase.None : ValueOneofCase.SparseTensorType; - } - } - - /// Field number for the "opaque_type" field. - public const int OpaqueTypeFieldNumber = 7; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto.Types.Opaque OpaqueType { - get { return valueCase_ == ValueOneofCase.OpaqueType ? (global::Onnx.TypeProto.Types.Opaque) value_ : null; } - set { - value_ = value; - valueCase_ = value == null ? ValueOneofCase.None : ValueOneofCase.OpaqueType; - } - } - - /// Field number for the "denotation" field. - public const int DenotationFieldNumber = 6; - private string denotation_ = ""; - /// - /// An optional denotation can be used to denote the whole - /// type with a standard semantic description as to what is - /// stored inside. Refer to https://github.com/onnx/onnx/blob/master/docs/TypeDenotation.md#type-denotation-definition - /// for pre-defined type denotations. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Denotation { - get { return denotation_; } - set { - denotation_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - private object value_; - /// Enum of possible cases for the "value" oneof. - public enum ValueOneofCase { - None = 0, - TensorType = 1, - SequenceType = 4, - MapType = 5, - SparseTensorType = 8, - OpaqueType = 7, - } - private ValueOneofCase valueCase_ = ValueOneofCase.None; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ValueOneofCase ValueCase { - get { return valueCase_; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void ClearValue() { - valueCase_ = ValueOneofCase.None; - value_ = null; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as TypeProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(TypeProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(TensorType, other.TensorType)) return false; - if (!object.Equals(SequenceType, other.SequenceType)) return false; - if (!object.Equals(MapType, other.MapType)) return false; - if (!object.Equals(SparseTensorType, other.SparseTensorType)) return false; - if (!object.Equals(OpaqueType, other.OpaqueType)) return false; - if (Denotation != other.Denotation) return false; - if (ValueCase != other.ValueCase) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (valueCase_ == ValueOneofCase.TensorType) hash ^= TensorType.GetHashCode(); - if (valueCase_ == ValueOneofCase.SequenceType) hash ^= SequenceType.GetHashCode(); - if (valueCase_ == ValueOneofCase.MapType) hash ^= MapType.GetHashCode(); - if (valueCase_ == ValueOneofCase.SparseTensorType) hash ^= SparseTensorType.GetHashCode(); - if (valueCase_ == ValueOneofCase.OpaqueType) hash ^= OpaqueType.GetHashCode(); - if (Denotation.Length != 0) hash ^= Denotation.GetHashCode(); - hash ^= (int) valueCase_; - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (valueCase_ == ValueOneofCase.TensorType) { - output.WriteRawTag(10); - output.WriteMessage(TensorType); - } - if (valueCase_ == ValueOneofCase.SequenceType) { - output.WriteRawTag(34); - output.WriteMessage(SequenceType); - } - if (valueCase_ == ValueOneofCase.MapType) { - output.WriteRawTag(42); - output.WriteMessage(MapType); - } - if (Denotation.Length != 0) { - output.WriteRawTag(50); - output.WriteString(Denotation); - } - if (valueCase_ == ValueOneofCase.OpaqueType) { - output.WriteRawTag(58); - output.WriteMessage(OpaqueType); - } - if (valueCase_ == ValueOneofCase.SparseTensorType) { - output.WriteRawTag(66); - output.WriteMessage(SparseTensorType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (valueCase_ == ValueOneofCase.TensorType) { - output.WriteRawTag(10); - output.WriteMessage(TensorType); - } - if (valueCase_ == ValueOneofCase.SequenceType) { - output.WriteRawTag(34); - output.WriteMessage(SequenceType); - } - if (valueCase_ == ValueOneofCase.MapType) { - output.WriteRawTag(42); - output.WriteMessage(MapType); - } - if (Denotation.Length != 0) { - output.WriteRawTag(50); - output.WriteString(Denotation); - } - if (valueCase_ == ValueOneofCase.OpaqueType) { - output.WriteRawTag(58); - output.WriteMessage(OpaqueType); - } - if (valueCase_ == ValueOneofCase.SparseTensorType) { - output.WriteRawTag(66); - output.WriteMessage(SparseTensorType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (valueCase_ == ValueOneofCase.TensorType) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(TensorType); - } - if (valueCase_ == ValueOneofCase.SequenceType) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SequenceType); - } - if (valueCase_ == ValueOneofCase.MapType) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(MapType); - } - if (valueCase_ == ValueOneofCase.SparseTensorType) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(SparseTensorType); - } - if (valueCase_ == ValueOneofCase.OpaqueType) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(OpaqueType); - } - if (Denotation.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Denotation); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(TypeProto other) { - if (other == null) { - return; - } - if (other.Denotation.Length != 0) { - Denotation = other.Denotation; - } - switch (other.ValueCase) { - case ValueOneofCase.TensorType: - if (TensorType == null) { - TensorType = new global::Onnx.TypeProto.Types.Tensor(); - } - TensorType.MergeFrom(other.TensorType); - break; - case ValueOneofCase.SequenceType: - if (SequenceType == null) { - SequenceType = new global::Onnx.TypeProto.Types.Sequence(); - } - SequenceType.MergeFrom(other.SequenceType); - break; - case ValueOneofCase.MapType: - if (MapType == null) { - MapType = new global::Onnx.TypeProto.Types.Map(); - } - MapType.MergeFrom(other.MapType); - break; - case ValueOneofCase.SparseTensorType: - if (SparseTensorType == null) { - SparseTensorType = new global::Onnx.TypeProto.Types.SparseTensor(); - } - SparseTensorType.MergeFrom(other.SparseTensorType); - break; - case ValueOneofCase.OpaqueType: - if (OpaqueType == null) { - OpaqueType = new global::Onnx.TypeProto.Types.Opaque(); - } - OpaqueType.MergeFrom(other.OpaqueType); - break; - } - - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - global::Onnx.TypeProto.Types.Tensor subBuilder = new global::Onnx.TypeProto.Types.Tensor(); - if (valueCase_ == ValueOneofCase.TensorType) { - subBuilder.MergeFrom(TensorType); - } - input.ReadMessage(subBuilder); - TensorType = subBuilder; - break; - } - case 34: { - global::Onnx.TypeProto.Types.Sequence subBuilder = new global::Onnx.TypeProto.Types.Sequence(); - if (valueCase_ == ValueOneofCase.SequenceType) { - subBuilder.MergeFrom(SequenceType); - } - input.ReadMessage(subBuilder); - SequenceType = subBuilder; - break; - } - case 42: { - global::Onnx.TypeProto.Types.Map subBuilder = new global::Onnx.TypeProto.Types.Map(); - if (valueCase_ == ValueOneofCase.MapType) { - subBuilder.MergeFrom(MapType); - } - input.ReadMessage(subBuilder); - MapType = subBuilder; - break; - } - case 50: { - Denotation = input.ReadString(); - break; - } - case 58: { - global::Onnx.TypeProto.Types.Opaque subBuilder = new global::Onnx.TypeProto.Types.Opaque(); - if (valueCase_ == ValueOneofCase.OpaqueType) { - subBuilder.MergeFrom(OpaqueType); - } - input.ReadMessage(subBuilder); - OpaqueType = subBuilder; - break; - } - case 66: { - global::Onnx.TypeProto.Types.SparseTensor subBuilder = new global::Onnx.TypeProto.Types.SparseTensor(); - if (valueCase_ == ValueOneofCase.SparseTensorType) { - subBuilder.MergeFrom(SparseTensorType); - } - input.ReadMessage(subBuilder); - SparseTensorType = subBuilder; - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - global::Onnx.TypeProto.Types.Tensor subBuilder = new global::Onnx.TypeProto.Types.Tensor(); - if (valueCase_ == ValueOneofCase.TensorType) { - subBuilder.MergeFrom(TensorType); - } - input.ReadMessage(subBuilder); - TensorType = subBuilder; - break; - } - case 34: { - global::Onnx.TypeProto.Types.Sequence subBuilder = new global::Onnx.TypeProto.Types.Sequence(); - if (valueCase_ == ValueOneofCase.SequenceType) { - subBuilder.MergeFrom(SequenceType); - } - input.ReadMessage(subBuilder); - SequenceType = subBuilder; - break; - } - case 42: { - global::Onnx.TypeProto.Types.Map subBuilder = new global::Onnx.TypeProto.Types.Map(); - if (valueCase_ == ValueOneofCase.MapType) { - subBuilder.MergeFrom(MapType); - } - input.ReadMessage(subBuilder); - MapType = subBuilder; - break; - } - case 50: { - Denotation = input.ReadString(); - break; - } - case 58: { - global::Onnx.TypeProto.Types.Opaque subBuilder = new global::Onnx.TypeProto.Types.Opaque(); - if (valueCase_ == ValueOneofCase.OpaqueType) { - subBuilder.MergeFrom(OpaqueType); - } - input.ReadMessage(subBuilder); - OpaqueType = subBuilder; - break; - } - case 66: { - global::Onnx.TypeProto.Types.SparseTensor subBuilder = new global::Onnx.TypeProto.Types.SparseTensor(); - if (valueCase_ == ValueOneofCase.SparseTensorType) { - subBuilder.MergeFrom(SparseTensorType); - } - input.ReadMessage(subBuilder); - SparseTensorType = subBuilder; - break; - } - } - } - } - #endif - - #region Nested types - /// Container for nested types declared in the TypeProto message type. - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static partial class Types { - public sealed partial class Tensor : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Tensor()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TypeProto.Descriptor.NestedTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Tensor() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Tensor(Tensor other) : this() { - elemType_ = other.elemType_; - shape_ = other.shape_ != null ? other.shape_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Tensor Clone() { - return new Tensor(this); - } - - /// Field number for the "elem_type" field. - public const int ElemTypeFieldNumber = 1; - private int elemType_; - /// - /// This field MUST NOT have the value of UNDEFINED - /// This field MUST have a valid TensorProto.DataType value - /// This field MUST be present for this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int ElemType { - get { return elemType_; } - set { - elemType_ = value; - } - } - - /// Field number for the "shape" field. - public const int ShapeFieldNumber = 2; - private global::Onnx.TensorShapeProto shape_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorShapeProto Shape { - get { return shape_; } - set { - shape_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Tensor); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Tensor other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (ElemType != other.ElemType) return false; - if (!object.Equals(Shape, other.Shape)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (ElemType != 0) hash ^= ElemType.GetHashCode(); - if (shape_ != null) hash ^= Shape.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (ElemType != 0) { - output.WriteRawTag(8); - output.WriteInt32(ElemType); - } - if (shape_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Shape); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (ElemType != 0) { - output.WriteRawTag(8); - output.WriteInt32(ElemType); - } - if (shape_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Shape); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (ElemType != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(ElemType); - } - if (shape_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Shape); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Tensor other) { - if (other == null) { - return; - } - if (other.ElemType != 0) { - ElemType = other.ElemType; - } - if (other.shape_ != null) { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - Shape.MergeFrom(other.Shape); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - ElemType = input.ReadInt32(); - break; - } - case 18: { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - input.ReadMessage(Shape); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - ElemType = input.ReadInt32(); - break; - } - case 18: { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - input.ReadMessage(Shape); - break; - } - } - } - } - #endif - - } - - /// - /// repeated T - /// - public sealed partial class Sequence : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Sequence()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TypeProto.Descriptor.NestedTypes[1]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Sequence() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Sequence(Sequence other) : this() { - elemType_ = other.elemType_ != null ? other.elemType_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Sequence Clone() { - return new Sequence(this); - } - - /// Field number for the "elem_type" field. - public const int ElemTypeFieldNumber = 1; - private global::Onnx.TypeProto elemType_; - /// - /// The type and optional shape of each element of the sequence. - /// This field MUST be present for this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto ElemType { - get { return elemType_; } - set { - elemType_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Sequence); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Sequence other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (!object.Equals(ElemType, other.ElemType)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (elemType_ != null) hash ^= ElemType.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (elemType_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ElemType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (elemType_ != null) { - output.WriteRawTag(10); - output.WriteMessage(ElemType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (elemType_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ElemType); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Sequence other) { - if (other == null) { - return; - } - if (other.elemType_ != null) { - if (elemType_ == null) { - ElemType = new global::Onnx.TypeProto(); - } - ElemType.MergeFrom(other.ElemType); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - if (elemType_ == null) { - ElemType = new global::Onnx.TypeProto(); - } - input.ReadMessage(ElemType); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - if (elemType_ == null) { - ElemType = new global::Onnx.TypeProto(); - } - input.ReadMessage(ElemType); - break; - } - } - } - } - #endif - - } - - /// - /// map<K,V> - /// - public sealed partial class Map : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Map()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TypeProto.Descriptor.NestedTypes[2]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Map() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Map(Map other) : this() { - keyType_ = other.keyType_; - valueType_ = other.valueType_ != null ? other.valueType_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Map Clone() { - return new Map(this); - } - - /// Field number for the "key_type" field. - public const int KeyTypeFieldNumber = 1; - private int keyType_; - /// - /// This field MUST have a valid TensorProto.DataType value - /// This field MUST be present for this version of the IR. - /// This field MUST refer to an integral type ([U]INT{8|16|32|64}) or STRING - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int KeyType { - get { return keyType_; } - set { - keyType_ = value; - } - } - - /// Field number for the "value_type" field. - public const int ValueTypeFieldNumber = 2; - private global::Onnx.TypeProto valueType_; - /// - /// This field MUST be present for this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TypeProto ValueType { - get { return valueType_; } - set { - valueType_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Map); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Map other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (KeyType != other.KeyType) return false; - if (!object.Equals(ValueType, other.ValueType)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (KeyType != 0) hash ^= KeyType.GetHashCode(); - if (valueType_ != null) hash ^= ValueType.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (KeyType != 0) { - output.WriteRawTag(8); - output.WriteInt32(KeyType); - } - if (valueType_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ValueType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (KeyType != 0) { - output.WriteRawTag(8); - output.WriteInt32(KeyType); - } - if (valueType_ != null) { - output.WriteRawTag(18); - output.WriteMessage(ValueType); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (KeyType != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(KeyType); - } - if (valueType_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(ValueType); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Map other) { - if (other == null) { - return; - } - if (other.KeyType != 0) { - KeyType = other.KeyType; - } - if (other.valueType_ != null) { - if (valueType_ == null) { - ValueType = new global::Onnx.TypeProto(); - } - ValueType.MergeFrom(other.ValueType); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - KeyType = input.ReadInt32(); - break; - } - case 18: { - if (valueType_ == null) { - ValueType = new global::Onnx.TypeProto(); - } - input.ReadMessage(ValueType); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - KeyType = input.ReadInt32(); - break; - } - case 18: { - if (valueType_ == null) { - ValueType = new global::Onnx.TypeProto(); - } - input.ReadMessage(ValueType); - break; - } - } - } - } - #endif - - } - - public sealed partial class SparseTensor : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new SparseTensor()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TypeProto.Descriptor.NestedTypes[3]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensor() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensor(SparseTensor other) : this() { - elemType_ = other.elemType_; - shape_ = other.shape_ != null ? other.shape_.Clone() : null; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public SparseTensor Clone() { - return new SparseTensor(this); - } - - /// Field number for the "elem_type" field. - public const int ElemTypeFieldNumber = 1; - private int elemType_; - /// - /// This field MUST NOT have the value of UNDEFINED - /// This field MUST have a valid TensorProto.DataType value - /// This field MUST be present for this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int ElemType { - get { return elemType_; } - set { - elemType_ = value; - } - } - - /// Field number for the "shape" field. - public const int ShapeFieldNumber = 2; - private global::Onnx.TensorShapeProto shape_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public global::Onnx.TensorShapeProto Shape { - get { return shape_; } - set { - shape_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as SparseTensor); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(SparseTensor other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (ElemType != other.ElemType) return false; - if (!object.Equals(Shape, other.Shape)) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (ElemType != 0) hash ^= ElemType.GetHashCode(); - if (shape_ != null) hash ^= Shape.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (ElemType != 0) { - output.WriteRawTag(8); - output.WriteInt32(ElemType); - } - if (shape_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Shape); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (ElemType != 0) { - output.WriteRawTag(8); - output.WriteInt32(ElemType); - } - if (shape_ != null) { - output.WriteRawTag(18); - output.WriteMessage(Shape); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (ElemType != 0) { - size += 1 + pb::CodedOutputStream.ComputeInt32Size(ElemType); - } - if (shape_ != null) { - size += 1 + pb::CodedOutputStream.ComputeMessageSize(Shape); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(SparseTensor other) { - if (other == null) { - return; - } - if (other.ElemType != 0) { - ElemType = other.ElemType; - } - if (other.shape_ != null) { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - Shape.MergeFrom(other.Shape); - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 8: { - ElemType = input.ReadInt32(); - break; - } - case 18: { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - input.ReadMessage(Shape); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 8: { - ElemType = input.ReadInt32(); - break; - } - case 18: { - if (shape_ == null) { - Shape = new global::Onnx.TensorShapeProto(); - } - input.ReadMessage(Shape); - break; - } - } - } - } - #endif - - } - - public sealed partial class Opaque : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Opaque()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.TypeProto.Descriptor.NestedTypes[4]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Opaque() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Opaque(Opaque other) : this() { - domain_ = other.domain_; - name_ = other.name_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public Opaque Clone() { - return new Opaque(this); - } - - /// Field number for the "domain" field. - public const int DomainFieldNumber = 1; - private string domain_ = ""; - /// - /// When missing, the domain is the same as the model's. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Domain { - get { return domain_; } - set { - domain_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "name" field. - public const int NameFieldNumber = 2; - private string name_ = ""; - /// - /// The name is optional but significant when provided. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Name { - get { return name_; } - set { - name_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as Opaque); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(Opaque other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Domain != other.Domain) return false; - if (Name != other.Name) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Domain.Length != 0) hash ^= Domain.GetHashCode(); - if (Name.Length != 0) hash ^= Name.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Domain.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Domain); - } - if (Name.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Name); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Domain.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Domain); - } - if (Name.Length != 0) { - output.WriteRawTag(18); - output.WriteString(Name); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Domain.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Domain); - } - if (Name.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Name); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(Opaque other) { - if (other == null) { - return; - } - if (other.Domain.Length != 0) { - Domain = other.Domain; - } - if (other.Name.Length != 0) { - Name = other.Name; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Domain = input.ReadString(); - break; - } - case 18: { - Name = input.ReadString(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Domain = input.ReadString(); - break; - } - case 18: { - Name = input.ReadString(); - break; - } - } - } - } - #endif - - } - - } - #endregion - - } - - /// - /// Operator Sets - /// - /// OperatorSets are uniquely identified by a (domain, opset_version) pair. - /// - public sealed partial class OperatorSetIdProto : pb::IMessage - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - , pb::IBufferMessage - #endif - { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new OperatorSetIdProto()); - private pb::UnknownFieldSet _unknownFields; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Onnx.OnnxMlReflection.Descriptor.MessageTypes[12]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OperatorSetIdProto() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OperatorSetIdProto(OperatorSetIdProto other) : this() { - domain_ = other.domain_; - version_ = other.version_; - _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public OperatorSetIdProto Clone() { - return new OperatorSetIdProto(this); - } - - /// Field number for the "domain" field. - public const int DomainFieldNumber = 1; - private string domain_ = ""; - /// - /// The domain of the operator set being identified. - /// The empty string ("") or absence of this field implies the operator - /// set that is defined as part of the ONNX specification. - /// This field MUST be present in this version of the IR when referring to any other operator set. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Domain { - get { return domain_; } - set { - domain_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - /// Field number for the "version" field. - public const int VersionFieldNumber = 2; - private long version_; - /// - /// The version of the operator set being identified. - /// This field MUST be present in this version of the IR. - /// - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public long Version { - get { return version_; } - set { - version_ = value; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as OperatorSetIdProto); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(OperatorSetIdProto other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Domain != other.Domain) return false; - if (Version != other.Version) return false; - return Equals(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Domain.Length != 0) hash ^= Domain.GetHashCode(); - if (Version != 0L) hash ^= Version.GetHashCode(); - if (_unknownFields != null) { - hash ^= _unknownFields.GetHashCode(); - } - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - output.WriteRawMessage(this); - #else - if (Domain.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Domain); - } - if (Version != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Version); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(output); - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { - if (Domain.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Domain); - } - if (Version != 0L) { - output.WriteRawTag(16); - output.WriteInt64(Version); - } - if (_unknownFields != null) { - _unknownFields.WriteTo(ref output); - } - } - #endif - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Domain.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Domain); - } - if (Version != 0L) { - size += 1 + pb::CodedOutputStream.ComputeInt64Size(Version); - } - if (_unknownFields != null) { - size += _unknownFields.CalculateSize(); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(OperatorSetIdProto other) { - if (other == null) { - return; - } - if (other.Domain.Length != 0) { - Domain = other.Domain; - } - if (other.Version != 0L) { - Version = other.Version; - } - _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - input.ReadRawMessage(this); - #else - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); - break; - case 10: { - Domain = input.ReadString(); - break; - } - case 16: { - Version = input.ReadInt64(); - break; - } - } - } - #endif - } - - #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); - break; - case 10: { - Domain = input.ReadString(); - break; - } - case 16: { - Version = input.ReadInt64(); - break; - } - } - } - } - #endif - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/include/onnxruntime/core/providers/dml/dml_provider_factory.h b/include/onnxruntime/core/providers/dml/dml_provider_factory.h index 071e7f0251..fd320ee345 100644 --- a/include/onnxruntime/core/providers/dml/dml_provider_factory.h +++ b/include/onnxruntime/core/providers/dml/dml_provider_factory.h @@ -28,7 +28,9 @@ extern "C" { * IDXGIFactory::EnumAdapters. A device_id of 0 always corresponds to the default adapter, which is typically the * primary display GPU installed on the system. A negative device_id is invalid. */ -ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_DML, _In_ OrtSessionOptions* options, int device_id); +// declared in include/onnxruntime/core/session/onnxruntime_c_api.h for convenience and so we can provide a graceful +// error message if not enabled. +// ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_DML, _In_ OrtSessionOptions* options, int device_id); /** * Creates a DirectML Execution Provider using the given DirectML device, and which executes work on the supplied D3D12 diff --git a/include/onnxruntime/core/providers/migraphx/migraphx_provider_factory.h b/include/onnxruntime/core/providers/migraphx/migraphx_provider_factory.h index 8f8219fde0..b631c3a156 100644 --- a/include/onnxruntime/core/providers/migraphx/migraphx_provider_factory.h +++ b/include/onnxruntime/core/providers/migraphx/migraphx_provider_factory.h @@ -6,7 +6,9 @@ extern "C" { #endif -ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_MIGraphX, _In_ OrtSessionOptions* options, int device_id); +// declared in include/onnxruntime/core/session/onnxruntime_c_api.h for convenience and so we can provide a graceful +// error message if not enabled. +// ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_MIGraphX, _In_ OrtSessionOptions* options, int device_id); #ifdef __cplusplus } diff --git a/include/onnxruntime/core/providers/nnapi/nnapi_provider_factory.h b/include/onnxruntime/core/providers/nnapi/nnapi_provider_factory.h index 57a1ba2aad..807f90746d 100644 --- a/include/onnxruntime/core/providers/nnapi/nnapi_provider_factory.h +++ b/include/onnxruntime/core/providers/nnapi/nnapi_provider_factory.h @@ -44,8 +44,10 @@ enum NNAPIFlags { extern "C" { #endif -ORT_EXPORT ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Nnapi, - _In_ OrtSessionOptions* options, uint32_t nnapi_flags); +// declared in include/onnxruntime/core/session/onnxruntime_c_api.h for convenience and so we can provide a graceful +// error message if not enabled. +// ORT_EXPORT ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Nnapi, +// _In_ OrtSessionOptions* options, uint32_t nnapi_flags); #ifdef __cplusplus } diff --git a/include/onnxruntime/core/providers/nuphar/nuphar_provider_factory.h b/include/onnxruntime/core/providers/nuphar/nuphar_provider_factory.h index ec574f74c7..e879dcacc6 100644 --- a/include/onnxruntime/core/providers/nuphar/nuphar_provider_factory.h +++ b/include/onnxruntime/core/providers/nuphar/nuphar_provider_factory.h @@ -10,7 +10,10 @@ extern "C" { * \param device_id nuphar device id, starts from zero. * \param settings_str Nuphar settings string. */ -ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Nuphar, _In_ OrtSessionOptions* options, int allow_unaligned_buffers, _In_ const char* settings_str); +// declared in include/onnxruntime/core/session/onnxruntime_c_api.h for convenience and so we can provide a graceful +// error message if not enabled. +// ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Nuphar, _In_ OrtSessionOptions* options, +// int allow_unaligned_buffers, _In_ const char* settings_str); #ifdef __cplusplus } diff --git a/include/onnxruntime/core/providers/rocm/rocm_provider_factory.h b/include/onnxruntime/core/providers/rocm/rocm_provider_factory.h index cf8a1c8a75..76dc658fec 100644 --- a/include/onnxruntime/core/providers/rocm/rocm_provider_factory.h +++ b/include/onnxruntime/core/providers/rocm/rocm_provider_factory.h @@ -10,7 +10,9 @@ extern "C" { /** * \param device_id hip device id, starts from zero. */ -ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_ROCM, _In_ OrtSessionOptions* options, int device_id, size_t gpu_mem_limit); +// declared in include/onnxruntime/core/session/onnxruntime_c_api.h for convenience and so we can provide a graceful +// error message if not enabled. +//ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_ROCM, _In_ OrtSessionOptions* options, int device_id, size_t gpu_mem_limit); #ifdef __cplusplus } diff --git a/include/onnxruntime/core/session/onnxruntime_c_api.h b/include/onnxruntime/core/session/onnxruntime_c_api.h index dda996234e..73e36383f1 100644 --- a/include/onnxruntime/core/session/onnxruntime_c_api.h +++ b/include/onnxruntime/core/session/onnxruntime_c_api.h @@ -1798,6 +1798,23 @@ struct OrtCustomOp { */ ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessionOptions* options, int device_id); +// EPs that provider_bridge_ort.cc handles. Function implementation is there. +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Dnnl, _In_ OrtSessionOptions* options, int use_arena); +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_OpenVINO, _In_ OrtSessionOptions* options, + _In_ const char* device_type); +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Tensorrt, _In_ OrtSessionOptions* options, int device_id); + +// EPs conditionally included in the build that are exposed in the C# bindings. +// Function implementation is in the EP code if enabled, or in onnxruntime/core/session/provider_stubs.cc if not. +// If not enabled the function will return an error message saying so. +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_DML, _In_ OrtSessionOptions* options, int device_id); +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_MIGraphX, _In_ OrtSessionOptions* options, int device_id); +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_ROCM, + _In_ OrtSessionOptions* options, int device_id, size_t gpu_mem_limit); +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Nnapi, _In_ OrtSessionOptions* options, uint32_t nnapi_flags); +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Nuphar, + _In_ OrtSessionOptions* options, int allow_unaligned_buffers, _In_ const char* settings); + #ifdef __cplusplus } #endif diff --git a/onnxruntime/core/providers/rocm/rocm_provider_factory.cc b/onnxruntime/core/providers/rocm/rocm_provider_factory.cc index 63fc7ea6d8..5ecbc21e49 100644 --- a/onnxruntime/core/providers/rocm/rocm_provider_factory.cc +++ b/onnxruntime/core/providers/rocm/rocm_provider_factory.cc @@ -38,10 +38,11 @@ std::shared_ptr CreateExecutionProviderFactory_ROCM(c } // namespace onnxruntime -ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProvider_ROCM, _In_ OrtSessionOptions* options, int device_id) { +ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProvider_ROCM, _In_ OrtSessionOptions* options, + int device_id, size_t gpu_mem_limit) { ROCMExecutionProviderInfo info{}; info.device_id = gsl::narrow(device_id); - + info.gpu_mem_limit = gpu_mem_limit; options->provider_factories.push_back(onnxruntime::CreateExecutionProviderFactory_ROCM(info)); return nullptr; @@ -59,4 +60,3 @@ ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_ROCM, return nullptr; } - diff --git a/onnxruntime/core/session/onnxruntime_c_api.cc b/onnxruntime/core/session/onnxruntime_c_api.cc index 7fffb25682..8118a49d88 100644 --- a/onnxruntime/core/session/onnxruntime_c_api.cc +++ b/onnxruntime/core/session/onnxruntime_c_api.cc @@ -1934,42 +1934,6 @@ ORT_API_STATUS_IMPL(OrtApis::SessionGetProfilingStartTimeNs, _In_ const OrtSessi // End support for non-tensor types -#ifndef USE_ROCM -ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_ROCM, - _In_ OrtSessionOptions* options, _In_ const OrtROCMProviderOptions* rocm_options) { - ORT_UNUSED_PARAMETER(options); - ORT_UNUSED_PARAMETER(rocm_options); - return CreateStatus(ORT_FAIL, "ROCM execution provider is not enabled."); -} -#endif - -#if defined(ORT_MINIMAL_BUILD) -ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_OpenVINO, - _In_ OrtSessionOptions* options, _In_ const OrtOpenVINOProviderOptions* provider_options) { - ORT_UNUSED_PARAMETER(options); - ORT_UNUSED_PARAMETER(provider_options); - return CreateStatus(ORT_FAIL, "OpenVINO execution provider is not enabled."); -} -#endif - -#if defined(ORT_MINIMAL_BUILD) -ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptions* provider_options) { - ORT_UNUSED_PARAMETER(options); - ORT_UNUSED_PARAMETER(provider_options); - return CreateStatus(ORT_FAIL, "CUDA execution provider is not enabled."); -} - -ORT_API_STATUS_IMPL(OrtApis::GetCurrentGpuDeviceId, _In_ int* device_id) { - ORT_UNUSED_PARAMETER(device_id); - return CreateStatus(ORT_FAIL, "CUDA execution provider is not enabled."); -} - -ORT_API_STATUS_IMPL(OrtApis::SetCurrentGpuDeviceId, _In_ int device_id) { - ORT_UNUSED_PARAMETER(device_id); - return CreateStatus(ORT_FAIL, "CUDA execution provider is not enabled."); -} -#endif - ORT_API_STATUS_IMPL(OrtApis::CreateArenaCfg, _In_ size_t max_mem, int arena_extend_strategy, int initial_chunk_size_bytes, int max_dead_bytes_per_chunk, _Outptr_ OrtArenaCfg** out) { API_IMPL_BEGIN @@ -2077,51 +2041,6 @@ ORT_API_STATUS_IMPL(OrtApis::CreateSessionFromArrayWithPrepackedWeightsContainer API_IMPL_END } -#if defined(ORT_MINIMAL_BUILD) -ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_TensorRT, - _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptions* tensorrt_options) { - ORT_UNUSED_PARAMETER(options); - ORT_UNUSED_PARAMETER(tensorrt_options); - return CreateStatus(ORT_FAIL, "TensorRT execution provider is not enabled."); -} - -ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_TensorRT_V2, - _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options) { - ORT_UNUSED_PARAMETER(options); - ORT_UNUSED_PARAMETER(tensorrt_options); - return CreateStatus(ORT_FAIL, "TensorRT execution provider is not enabled."); -} - -ORT_API_STATUS_IMPL(OrtApis::CreateTensorRTProviderOptions, _Outptr_ OrtTensorRTProviderOptionsV2** out) { - ORT_UNUSED_PARAMETER(out); - return CreateStatus(ORT_FAIL, "TensorRT execution provider is not enabled in this build."); -} - -ORT_API_STATUS_IMPL(OrtApis::UpdateTensorRTProviderOptions, - _Inout_ OrtTensorRTProviderOptionsV2* tensorrt_options, - _In_reads_(num_keys) const char* const* provider_options_keys, - _In_reads_(num_keys) const char* const* provider_options_values, - size_t num_keys) { - ORT_UNUSED_PARAMETER(tensorrt_options); - ORT_UNUSED_PARAMETER(provider_options_keys); - ORT_UNUSED_PARAMETER(provider_options_values); - ORT_UNUSED_PARAMETER(num_keys); - return CreateStatus(ORT_FAIL, "TensorRT execution provider is not enabled in this build."); -} - -ORT_API_STATUS_IMPL(OrtApis::GetTensorRTProviderOptionsAsString, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options, _Inout_ OrtAllocator* allocator, - _Outptr_ char** ptr) { - ORT_UNUSED_PARAMETER(tensorrt_options); - ORT_UNUSED_PARAMETER(allocator); - ORT_UNUSED_PARAMETER(ptr); - return CreateStatus(ORT_FAIL, "TensorRT execution provider is not enabled in this build."); -} - -ORT_API(void, OrtApis::ReleaseTensorRTProviderOptions, _Frees_ptr_opt_ OrtTensorRTProviderOptionsV2* ptr) { - ORT_UNUSED_PARAMETER(ptr); -} -#endif - static constexpr OrtApiBase ort_api_base = { &OrtApis::GetApi, &OrtApis::GetVersionString, @@ -2148,22 +2067,22 @@ but isn't visible in public headers. So for example, if we wanted to just add some new members to the ort_api_1_to_2, we'd take the following steps: - In include\onnxruntime\core\session\onnxruntime_c_api.h we'd just add the members to the end of the structure + In include\onnxruntime\core\session\onnxruntime_c_api.h we'd just add the members to the end of the structure - In this file, we'd correspondingly add the member values to the end of the ort_api_1_to_2 structure, and also rename - it to ort_api_1_to_3. + In this file, we'd correspondingly add the member values to the end of the ort_api_1_to_2 structure, and also rename + it to ort_api_1_to_3. - Then in GetApi we'd make it return ort_api_1_to_3 for versions 1 through 3. + Then in GetApi we'd make it return ort_api_1_to_3 for versions 1 through 3. Second example, if we wanted to add and remove some members, we'd do this: - In include\onnxruntime\core\session\onnxruntime_c_api.h we'd make a copy of the OrtApi structure and name the - old one OrtApi1to2. In the new OrtApi we'd add or remove any members that we desire. + In include\onnxruntime\core\session\onnxruntime_c_api.h we'd make a copy of the OrtApi structure and name the + old one OrtApi1to2. In the new OrtApi we'd add or remove any members that we desire. - In this file, we'd create a new copy of ort_api_1_to_2 called ort_api_3 and make the corresponding changes that were - made to the new OrtApi. + In this file, we'd create a new copy of ort_api_1_to_2 called ort_api_3 and make the corresponding changes that were + made to the new OrtApi. - In GetApi we now make it return ort_api_3 for version 3. + In GetApi we now make it return ort_api_3 for version 3. */ static constexpr OrtApi ort_api_1_to_9 = { diff --git a/onnxruntime/core/session/provider_bridge_ort.cc b/onnxruntime/core/session/provider_bridge_ort.cc index 745d49f71f..befaf7ed63 100644 --- a/onnxruntime/core/session/provider_bridge_ort.cc +++ b/onnxruntime/core/session/provider_bridge_ort.cc @@ -213,13 +213,12 @@ struct ProviderHostImpl : ProviderHost { const AllocatorPtr& dst_allocator, Tensor& dst) override { return sparse_utils::SparseCooToDenseTensor(data_manager, src, cpu_allocator, dst_allocator, dst); } -#endif // ORT_MINIMAL_BUILD +#endif // ORT_MINIMAL_BUILD Status sparse_utils__DenseTensorToSparseCoo(const DataTransferManager& data_manager, const Tensor& src, const AllocatorPtr& cpu_allocator, const AllocatorPtr& dst_allocator, bool linear_indexs, SparseTensor& dst) override { return sparse_utils::DenseTensorToSparseCoo(data_manager, src, cpu_allocator, dst_allocator, linear_indexs, dst); } - // IAllocator (direct) bool IAllocator__CalcMemSizeForArrayWithAlignment(size_t nmemb, size_t size, size_t alignment, size_t* out) override { return IAllocator::CalcMemSizeForArrayWithAlignment(nmemb, size, alignment, out); } @@ -1117,7 +1116,8 @@ ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_OpenVINO, _In API_IMPL_END } -ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProvider_OpenVINO, _In_ OrtSessionOptions* options, _In_ const char* device_type) { +ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProvider_OpenVINO, _In_ OrtSessionOptions* options, + _In_ const char* device_type) { OrtOpenVINOProviderOptions provider_options{}; provider_options.device_type = device_type; return OrtApis::SessionOptionsAppendExecutionProvider_OpenVINO(options, &provider_options); diff --git a/onnxruntime/core/session/provider_stubs.cc b/onnxruntime/core/session/provider_stubs.cc new file mode 100644 index 0000000000..ed9d28bf11 --- /dev/null +++ b/onnxruntime/core/session/provider_stubs.cc @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#include + +#include "core/common/common.h" +#include "core/session/onnxruntime_c_api.h" +#include "core/session/ort_apis.h" + +static OrtStatus* CreateNotEnabledStatus(const std::string& ep) { + return OrtApis::CreateStatus(ORT_FAIL, (ep + " execution provider is not enabled in this build. ").c_str()); +} + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef USE_DML +ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProvider_DML, _In_ OrtSessionOptions* options, int device_id) { + ORT_UNUSED_PARAMETER(options); + ORT_UNUSED_PARAMETER(device_id); + return CreateNotEnabledStatus("DML"); +} +#endif + +#ifndef USE_MIGRAPHX +ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProvider_MIGraphX, + _In_ OrtSessionOptions* options, int device_id) { + ORT_UNUSED_PARAMETER(options); + ORT_UNUSED_PARAMETER(device_id); + return CreateNotEnabledStatus("MIGraphX"); +} +#endif + +#ifndef USE_ROCM +ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProvider_ROCM, + _In_ OrtSessionOptions* options, int device_id, size_t gpu_mem_limit) { + ORT_UNUSED_PARAMETER(options); + ORT_UNUSED_PARAMETER(device_id); + ORT_UNUSED_PARAMETER(gpu_mem_limit); + return CreateNotEnabledStatus("ROCM"); +} +#endif + +#ifndef USE_NNAPI +ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProvider_Nnapi, + _In_ OrtSessionOptions* options, uint32_t nnapi_flags) { + ORT_UNUSED_PARAMETER(options); + ORT_UNUSED_PARAMETER(nnapi_flags); + return CreateNotEnabledStatus("NNAPI"); +} +#endif + +#ifndef USE_NUPHAR +ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProvider_Nuphar, + _In_ OrtSessionOptions* options, int allow_unaligned_buffers, _In_ const char* settings) { + ORT_UNUSED_PARAMETER(options); + ORT_UNUSED_PARAMETER(allow_unaligned_buffers); + ORT_UNUSED_PARAMETER(settings); + return CreateNotEnabledStatus("Nuphar"); +} +#endif + +/* see provider_bridge_ort.cc for these: +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessionOptions* options, int device_id); +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Dnnl, _In_ OrtSessionOptions* options, int use_arena); +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_OpenVINO, _In_ OrtSessionOptions* options, + _In_ const char* device_type); +ORT_API_STATUS(OrtSessionOptionsAppendExecutionProvider_Tensorrt, _In_ OrtSessionOptions* options, int device_id); +*/ + +#ifdef __cplusplus +} +#endif + +/* +OrtApis::SessionOptionsAppendExecutionProvider_ stubs for EPs not included in this build. + +2 cases: + +1) EP is included in ORT via build settings. Need to include stub if EP not enabled. +2) EP is built as separate library and uses the provider bridge. Need to include in a minimal build + as the provider bridge is excluded in that case. + +TODO: When the NNAPI or CoreML EPs are setup to use the provider bridge the source code for that will be included + in a minimal build and these stubs should move to provider_bridge_ort.cc. +*/ + +// EPs in the first case +#ifndef USE_ROCM +ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_ROCM, + _In_ OrtSessionOptions* options, _In_ const OrtROCMProviderOptions* rocm_options) { + ORT_UNUSED_PARAMETER(options); + ORT_UNUSED_PARAMETER(rocm_options); + return CreateNotEnabledStatus("ROCM"); +} +#endif + +// EPs in the second case +#if defined(ORT_MINIMAL_BUILD) +ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_CUDA, + _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptions* provider_options) { + ORT_UNUSED_PARAMETER(options); + ORT_UNUSED_PARAMETER(provider_options); + return CreateNotEnabledStatus("CUDA"); +} + +ORT_API_STATUS_IMPL(OrtApis::GetCurrentGpuDeviceId, _In_ int* device_id) { + ORT_UNUSED_PARAMETER(device_id); + return CreateNotEnabledStatus("CUDA"); +} + +ORT_API_STATUS_IMPL(OrtApis::SetCurrentGpuDeviceId, _In_ int device_id) { + ORT_UNUSED_PARAMETER(device_id); + return CreateNotEnabledStatus("CUDA"); +} + +ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_OpenVINO, + _In_ OrtSessionOptions* options, _In_ const OrtOpenVINOProviderOptions* provider_options) { + ORT_UNUSED_PARAMETER(options); + ORT_UNUSED_PARAMETER(provider_options); + return CreateNotEnabledStatus("OpenVINO"); +} + +ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_TensorRT, + _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptions* tensorrt_options) { + ORT_UNUSED_PARAMETER(options); + ORT_UNUSED_PARAMETER(tensorrt_options); + return CreateNotEnabledStatus("TensorRT"); +} + +ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_TensorRT_V2, + _In_ OrtSessionOptions* options, _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options) { + ORT_UNUSED_PARAMETER(options); + ORT_UNUSED_PARAMETER(tensorrt_options); + return CreateNotEnabledStatus("TensorRT"); +} + +ORT_API_STATUS_IMPL(OrtApis::CreateTensorRTProviderOptions, _Outptr_ OrtTensorRTProviderOptionsV2** out) { + ORT_UNUSED_PARAMETER(out); + return CreateNotEnabledStatus("TensorRT"); +} + +ORT_API_STATUS_IMPL(OrtApis::UpdateTensorRTProviderOptions, + _Inout_ OrtTensorRTProviderOptionsV2* tensorrt_options, + _In_reads_(num_keys) const char* const* provider_options_keys, + _In_reads_(num_keys) const char* const* provider_options_values, + size_t num_keys) { + ORT_UNUSED_PARAMETER(tensorrt_options); + ORT_UNUSED_PARAMETER(provider_options_keys); + ORT_UNUSED_PARAMETER(provider_options_values); + ORT_UNUSED_PARAMETER(num_keys); + return CreateNotEnabledStatus("TensorRT"); +} + +ORT_API_STATUS_IMPL(OrtApis::GetTensorRTProviderOptionsAsString, + _In_ const OrtTensorRTProviderOptionsV2* tensorrt_options, + _Inout_ OrtAllocator* allocator, + _Outptr_ char** ptr) { + ORT_UNUSED_PARAMETER(tensorrt_options); + ORT_UNUSED_PARAMETER(allocator); + ORT_UNUSED_PARAMETER(ptr); + return CreateNotEnabledStatus("TensorRT"); +} + +ORT_API(void, OrtApis::ReleaseTensorRTProviderOptions, _Frees_ptr_opt_ OrtTensorRTProviderOptionsV2* ptr) { + ORT_UNUSED_PARAMETER(ptr); +} + +#endif diff --git a/onnxruntime/core/session/symbols.txt b/onnxruntime/core/session/symbols.txt new file mode 100644 index 0000000000..8acfafacf5 --- /dev/null +++ b/onnxruntime/core/session/symbols.txt @@ -0,0 +1,15 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +# +# we provide stubs for these functions for EPs that are enabled via C# so that we can return a graceful error message +# if they are not enabled in the onnxruntime library being used. the C# bindings don't know what will be available +# until runtime so must include the ability to call these functions in all builds. +OrtSessionOptionsAppendExecutionProvider_CUDA +OrtSessionOptionsAppendExecutionProvider_DML +OrtSessionOptionsAppendExecutionProvider_Dnnl +OrtSessionOptionsAppendExecutionProvider_MIGraphX +OrtSessionOptionsAppendExecutionProvider_Nnapi +OrtSessionOptionsAppendExecutionProvider_Nuphar +OrtSessionOptionsAppendExecutionProvider_OpenVINO +OrtSessionOptionsAppendExecutionProvider_ROCM +OrtSessionOptionsAppendExecutionProvider_Tensorrt diff --git a/tools/ci_build/gen_def.py b/tools/ci_build/gen_def.py index 7e7e6651a7..9b17e5f106 100755 --- a/tools/ci_build/gen_def.py +++ b/tools/ci_build/gen_def.py @@ -14,6 +14,21 @@ def parse_arguments(): return parser.parse_args() +def read_symbols(filename: str, allow_dups: bool = False): + with open(filename, 'r') as file: + for line in file: + line = line.strip() + if len(line) == 0 or line.startswith('#'): + continue + + if line in symbols: + if not allow_dups: + print("dup symbol: %s", line) + exit(-1) + else: + symbols.add(line) + + args = parse_arguments() print("Generating symbol file for %s" % str(args.config)) with open(args.version_file, 'r') as f: @@ -25,12 +40,13 @@ symbols = set() for c in args.config: file_name = os.path.join(args.src_root, 'core', 'providers', c, 'symbols.txt') with open(file_name, 'r') as file: - for line in file: - line = line.strip() - if line in symbols: - print("dup symbol: %s", line) - exit(-1) - symbols.add(line) + read_symbols(file_name) + +# add stubs from session to provide graceful error message if EP isn't included in the build. +# this will have dups for EPs that are enabled in the build which is fine as we #ifdef out the stubs +# in the ORT C API implementation if that is the case +read_symbols(os.path.join(args.src_root, 'core', 'session', 'symbols.txt'), allow_dups=True) + symbols = sorted(symbols) symbol_index = 1 @@ -59,13 +75,13 @@ with open(args.output, 'w') as file: file.write("}; \n") with open(args.output_source, 'w') as file: - file.write("#include \n") + file.write('#include "core/session/onnxruntime_c_api.h"\n') for c in args.config: # WinML adapter should not be exported in platforms other than Windows. # Exporting OrtGetWinMLAdapter is exported without issues using .def file when compiling for Windows # so it isn't necessary to include it in generated_source.c if c != "winml" and c != "cuda": - file.write("#include \n" % (c, c)) + file.write('#include "core/providers/%s/%s_provider_factory.h"\n' % (c, c)) file.write("void* GetFunctionEntryByName(const char* name){\n") for symbol in symbols: if symbol != "OrtGetWinMLAdapter":