From ec7ce5ff5a628e30a91c76e4d6a86872a4f59eda Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Fri, 3 Jul 2026 10:30:12 +0200 Subject: [PATCH 01/18] Upgrade ONNX runtime, gen ai and add bert model. Signed-off-by: Ana-Maria Mihalceanu --- cr-examples/onnx/README.md | 31 +- cr-examples/onnx/opgen/pom.xml | 8 +- cr-examples/onnx/opgen/setup.sh | 45 +- .../java/oracle/code/onnx/opgen/OpGen.java | 4 +- .../oracle/code/onnx/opgen/OperatorGen.java | 4 +- .../oracle/code/onnx/protogen/ProtoGen.java | 4 +- cr-examples/onnx/opgen/symbols | 300 +- cr-examples/onnx/opgen/symbolsai | 200 + cr-examples/onnx/pom.xml | 6 +- .../code/onnx/ExplicitOnnxOperators.java | 25 +- .../java/oracle/code/onnx/OnnxOperators.java | 156 +- .../oracle/code/onnx/OnnxProtoBuilder.java | 109 +- .../onnx/foreign/CreateEpApiFactoriesFn.java | 75 + .../onnx/foreign/EpSelectionDelegate.java | 12 +- .../foreign/OgaSetLogCallback$callback.java | 70 + .../code/onnx/foreign/OrtAllocator.java | 166 +- .../java/oracle/code/onnx/foreign/OrtApi.java | 11075 ++++-- .../oracle/code/onnx/foreign/OrtApiBase.java | 20 +- .../onnx/foreign/OrtCUDAProviderOptions.java | 22 +- .../code/onnx/foreign/OrtCompileApi.java | 245 +- .../onnx/foreign/OrtCustomCreateThreadFn.java | 8 +- .../onnx/foreign/OrtCustomHandleType.java | 2 +- .../onnx/foreign/OrtCustomJoinThreadFn.java | 8 +- .../oracle/code/onnx/foreign/OrtCustomOp.java | 253 +- .../onnx/foreign/OrtDataTransferImpl.java | 439 + .../onnx/foreign/OrtEnvCreationOptions.java | 403 + .../java/oracle/code/onnx/foreign/OrtEp.java | 2300 ++ .../oracle/code/onnx/foreign/OrtEpApi.java | 7619 ++++ .../code/onnx/foreign/OrtEpFactory.java | 2098 ++ .../code/onnx/foreign/OrtEpProfilerImpl.java | 642 + .../foreign/OrtExternalMemoryDescriptor.java | 311 + .../onnx/foreign/OrtExternalMemoryHandle.java | 321 + .../OrtExternalResourceImporterImpl.java | 1162 + .../OrtExternalSemaphoreDescriptor.java | 219 + .../foreign/OrtExternalSemaphoreHandle.java | 321 + .../foreign/OrtExternalTensorDescriptor.java | 311 + .../code/onnx/foreign/OrtGenApi$shared.java | 63 + .../oracle/code/onnx/foreign/OrtGenApi.java | 6410 ++-- .../OrtGetInitializerLocationFunc.java | 8 +- .../foreign/OrtGraphicsInteropConfig.java | 265 + .../code/onnx/foreign/OrtInteropApi.java | 1423 + .../onnx/foreign/OrtKernelCreateFunc.java | 72 + .../code/onnx/foreign/OrtKernelImpl.java | 590 + .../code/onnx/foreign/OrtLoggingFunction.java | 8 +- .../onnx/foreign/OrtLoopKernelHelper.java | 336 + .../foreign/OrtMIGraphXProviderOptions.java | 26 +- .../code/onnx/foreign/OrtModelEditorApi.java | 200 +- .../code/onnx/foreign/OrtNodeComputeInfo.java | 438 + .../onnx/foreign/OrtNodeFusionOptions.java | 174 + .../foreign/OrtOpenVINOProviderOptions.java | 16 +- .../onnx/foreign/OrtROCMProviderOptions.java | 24 +- .../code/onnx/foreign/OrtResourceCount.java | 426 + .../onnx/foreign/OrtScanKernelHelper.java | 336 + .../onnx/foreign/OrtSyncNotificationImpl.java | 536 + .../code/onnx/foreign/OrtSyncStreamImpl.java | 638 + .../foreign/OrtTensorRTProviderOptions.java | 36 +- .../foreign/OrtThreadPoolCallbacksConfig.java | 358 + .../foreign/OrtThreadPoolWorkAbandonFn.java | 70 + .../foreign/OrtThreadPoolWorkEnqueueFn.java | 70 + .../foreign/OrtThreadPoolWorkStartFn.java | 70 + .../onnx/foreign/OrtThreadPoolWorkStopFn.java | 70 + .../code/onnx/foreign/OrtThreadWorkerFn.java | 8 +- .../code/onnx/foreign/OrtWriteBufferFunc.java | 8 +- .../onnx/foreign/RegisterCustomOpsFn.java | 8 +- .../onnx/foreign/ReleaseEpApiFactoryFn.java | 70 + .../code/onnx/foreign/RunAsyncCallbackFn.java | 8 +- .../coreml_provider_factory_h$shared.java | 63 + .../foreign/coreml_provider_factory_h.java | 1786 +- .../foreign/onnxruntime_c_api_h$shared.java | 63 + .../onnx/foreign/onnxruntime_c_api_h.java | 474 +- .../onnx/genai/OnnxGenRuntimeSession.java | 8 +- .../code/onnx/genai/TensorDataStream.java | 17 +- .../oracle/code/onnx/ir/ExplicitOnnxOps.java | 310 + .../main/java/oracle/code/onnx/ir/OnnxOp.java | 4 +- .../java/oracle/code/onnx/ir/OnnxOps.java | 789 +- .../java/oracle/code/onnx/ir/OnnxType.java | 52 +- .../oracle/code/onnx/proto/OnnxBuilder.java | 12 +- .../oracle/code/onnx/proto/OnnxConstants.java | 17 +- .../oracle/code/onnx/proto/OnnxModel.java | 12 +- .../bert/AllMiniLML6V2EmbeddingModel.java | 196 + .../oracle/code/onnx/bert/BertTokenizer.java | 134 + .../oracle/code/onnx/bert/EmbeddingDemo.java | 28 + .../java/oracle/code/onnx/llm/LlamaDemo.java | 18 +- .../resources/oracle/code/onnx/bert/vocab.txt | 30522 ++++++++++++++++ 84 files changed, 69411 insertions(+), 6853 deletions(-) create mode 100644 cr-examples/onnx/opgen/symbolsai create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/CreateEpApiFactoriesFn.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OgaSetLogCallback$callback.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtDataTransferImpl.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtEnvCreationOptions.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtEp.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtEpApi.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtEpFactory.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtEpProfilerImpl.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtExternalMemoryDescriptor.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtExternalMemoryHandle.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtExternalResourceImporterImpl.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtExternalSemaphoreDescriptor.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtExternalSemaphoreHandle.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtExternalTensorDescriptor.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtGenApi$shared.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtGraphicsInteropConfig.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtInteropApi.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtKernelCreateFunc.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtKernelImpl.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtLoopKernelHelper.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtNodeComputeInfo.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtNodeFusionOptions.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtResourceCount.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtScanKernelHelper.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtSyncNotificationImpl.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtSyncStreamImpl.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtThreadPoolCallbacksConfig.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtThreadPoolWorkAbandonFn.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtThreadPoolWorkEnqueueFn.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtThreadPoolWorkStartFn.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/OrtThreadPoolWorkStopFn.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/ReleaseEpApiFactoryFn.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/coreml_provider_factory_h$shared.java create mode 100644 cr-examples/onnx/src/main/java/oracle/code/onnx/foreign/onnxruntime_c_api_h$shared.java create mode 100644 cr-examples/onnx/src/test/java/oracle/code/onnx/bert/AllMiniLML6V2EmbeddingModel.java create mode 100644 cr-examples/onnx/src/test/java/oracle/code/onnx/bert/BertTokenizer.java create mode 100644 cr-examples/onnx/src/test/java/oracle/code/onnx/bert/EmbeddingDemo.java create mode 100644 cr-examples/onnx/src/test/resources/oracle/code/onnx/bert/vocab.txt diff --git a/cr-examples/onnx/README.md b/cr-examples/onnx/README.md index 540a800e798..c862c66284b 100644 --- a/cr-examples/onnx/README.md +++ b/cr-examples/onnx/README.md @@ -8,7 +8,7 @@ JAVA_HOME= mvn process-test-classes exec:java -Dexec.mainClass=oracle.code.onnx.mnist.MNISTDemo ``` -### ONNX Runtime with CoreML running facial emotion recognition from Java source. +### ONNX Runtime with CoreML running facial emotion recognition from Java source Download the `.data` file from [emotion-ferplus-8.onnx.data](https://github.com/ammbra/fer-model-weights/raw/refs/heads/main/emotion-ferplus-8.onnx.data) and place it under `cr-examples/onnx/src/test/resources/oracle/code/onnx/fer` folder. @@ -18,29 +18,38 @@ JAVA_HOME= mvn process-test-classes exec:java -Dexec.mainClass=oracle.code.onnx.fer.FERCoreMLDemo ``` -#### How to (Re)Generate the CoreML Java Bindings +### ONNX Runtime running an embedding model from Java source -The following instructions are for Mac users only as the CoreML Execution Provider (EP) requires iOS devices with iOS 13 or higher, or Mac computers with macOS 10.15 or higher. -Build and install custom ONNX Runtime with CoreML enabled: +[all-MiniLM-L6-v2](https://huggingface.co/onnx-community/all-MiniLM-L6-v2-ONNX) is a popular, lightweight, sentence embedding model. +This model converts sentences into 384 dimensional vectors, an aspect very useful for semantic search and information retrieval. + +Download `model.onnx_data` and `vocab.txt` data files from [all-MiniLM-L6-v2](https://huggingface.co/onnx-community/all-MiniLM-L6-v2-ONNX) and put them into `cr-examples/onnx/src/test/resources/oracle/code/onnx/bert` folder. + +To run the EmbeddingDemo, execute: ``` -git clone --recursive https://github.com/microsoft/onnxruntime.git -cd onnxruntime -./build.sh --config Release --build_shared_lib --use_coreml --parallel -# get the path to where current built library is available -pwd +JAVA_HOME= +mvn process-test-classes exec:java -Dexec.mainClass=oracle.code.onnx.bert.EmbeddingDemo ``` +#### How to (Re)Generate the Java Bindings + +The following instructions are for Mac users only as the CoreML Execution Provider (EP) requires iOS devices with iOS 13 or higher, or Mac computers with macOS 10.15 or higher. +Download ONNX Runtime from a published release. + Inside `cr-examples/onnx/opgen` project you will find the `setup.sh` script that takes as argument the path to your cloned `onnxruntime` and uses `jextract` to regenerate the binaries. Prior to running it make sure that `jextract` is in your system `$PATH` : ```shell jextract --version ``` -Provide the path to your cloned `onnxruntime` and the script will regenerate the CoreML Java bindings inside the `oracle.code.onnx.foreign`: + +Provide the path to your cloned `onnxruntime` and the script will regenerate the Java bindings inside the `oracle.code.onnx.foreign`: ``` -sh setup.sh path/to/cloned/onnxruntime +export ONNX_INCLUDE_DIR=/path/to/onnx/include/onnxruntime/include +export ONNX_GEN_AI_INCLUDE_DIR=/path/to/onnx/include/onnxruntime-genai/include +sh setup.sh ``` ### ONNX GenAI running large language model from Java source. diff --git a/cr-examples/onnx/opgen/pom.xml b/cr-examples/onnx/opgen/pom.xml index bda2cbdb729..0aae7da7fdc 100644 --- a/cr-examples/onnx/opgen/pom.xml +++ b/cr-examples/onnx/opgen/pom.xml @@ -1,6 +1,6 @@ Conv --> H --> Gemm --> Y /// | ^ ^ @@ -1554,21 +1554,21 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---------------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// By definition, the tensor "y" is a function of independent variables in "xs" /// and "zs". Since we only compute the gradient of "y" w.r.t. the differentiable /// variables in "xs", this Gradient only outputs dY/dW and dY/dZ. Note that "H" /// cannot appear in "xs" and "zs". The reason is that "H" can be determined by /// tensors "W" and "X" and therefore "H" is not an independent variable. - /// + /// /// All outputs are optional. If needed, for example, user can assign an empty /// string to the 1st output name of that Gradient to skip the generation of dY/dW. /// Note that the concept of optional outputs can also be found in ONNX's RNN, GRU, /// and LSTM. - /// + /// /// Gradient operator can compute derivative against intermediate tensors. For /// example, the gradient of Y with respect to H can be done via - /// + /// /// ``` /// W --> Conv --> H --> Gemm --> Y /// ^ | ^ @@ -1584,20 +1584,20 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---------------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// It is possible to represent high-order differentiation using Gradient operators. /// For example, given the following linear model: - /// + /// /// ``` /// W --> Gemm --> Y --> Loss --> O /// ^ ^ /// | | /// X L /// ``` - /// + /// /// To compute the 2nd order derivative of O with respect to W (denoted by /// d^2O/dW^2), one can do - /// + /// /// ``` /// W --> Gemm --> Y --> Loss --> O /// | ^ ^ @@ -1615,20 +1615,20 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---> d^2O/dW^2 (2nd output of Gradient) /// ``` - /// + /// /// The tensors named in attributes "xs", "zs", and "y" define the differentiated /// computation graph, and the inputs to Gradient node define the values at /// which the gradient is computed. We can feed different tensors to the identified /// graph. For example, one can compute the gradient of Y with respect to H at /// a specific value of H, H_1, by providing that value as an input to the Gradient /// node. - /// + /// /// ``` /// W --> Conv --> H --> Gemm --> Y /// ^ ^ /// | | /// X Z - /// + /// /// Z_1 (2nd input of Gradient) /// | /// v @@ -1636,7 +1636,7 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// When the inputs of Gradient are the tensors named in "xs" and "zs", the /// computation can be optimized. More specifically, intermediate variables in /// forward pass can be reused if the gradient is computed via reverse-mode @@ -1645,43 +1645,43 @@ public static List> Gradient(List> Inputs, String Object result = OnnxInterpreter.interpret(OnnxOps.Gradient.class, List.of(Inputs), List.of(y, zs, xs)); return (List>) result; } - - /// + + /// /// Returns the tensor resulted from performing the `greater` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Greater(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Greater.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `greater_equal` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor GreaterOrEqual(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.GreaterOrEqual.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Given an input `X` and a flow-field `grid`, computes the output `Y` using `X` values and pixel locations from the `grid`. /// For spatial input `X` with shape (N, C, H, W), the `grid` will have shape (N, H_out, W_out, 2), /// the output `Y` will have shape (N, C, H_out, W_out). For volumetric input `X` with shape (N, C, D, H, W), /// the `grid` will have shape (N, D_out, H_out, W_out, 3), the output `Y` will have shape (N, C, D_out, H_out, W_out). /// More generally, for an input `X` of rank r+2 with shape (N, C, d1, d2, ..., dr), /// the `grid` will have shape (N, D1_out, D2_out, ..., Dr_out, r), the output `Y` will have shape (N, C, D1_out, D2_out, ..., Dr_out). - /// + /// /// The tensor `X` contains values at centers of square pixels (voxels, etc) locations such as (n, c, d1_in, d2_in, ..., dr_in). /// The (n, d1_out, d2_out, ..., dr_out, :) values from the tensor `grid` are the normalized positions for interpolating the values /// at the (n, c, d1_out, d2_out, ..., dr_out) locations from the output tensor `Y` using a specified interpolation method (the mode) /// and a padding mode (for `grid` positions falling outside the 2-dimensional image). - /// + /// /// For example, the values in `grid[n, h_out, w_out, :]` are size-2 vectors specifying normalized positions in the 2-dimensional space of `X`. /// They are used to interpolate output values of `Y[n, c, h_out, w_out]`. - /// + /// /// The GridSample operator is often used in doing grid generator and sampler in the /// [Spatial Transformer Networks](https://arxiv.org/abs/1506.02025). /// See also in [torch.nn.functional.grid_sample](https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html). @@ -1689,11 +1689,11 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti Object result = OnnxInterpreter.interpret(OnnxOps.GridSample.class, List.of(X, grid), List.of(mode, align_corners, padding_mode)); return (Tensor) result; } - - /// + + /// /// A GroupNormalization function. Carries out group normalization as described in /// the paper https://arxiv.org/abs/1803.08494 - /// + /// /// This operator transforms input according to /// ``` /// y = scale * (x - mean) / sqrt(variance + epsilon) + bias, @@ -1702,7 +1702,7 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti /// `scale` and `bias` should be specified for each channel. The number of /// groups `num_groups` should be divisible by the number of channels so that there are /// an equal number of channels per group. - /// + /// /// The overall computation has two stages: the first stage normalizes the elements to /// have zero mean and unit variance for each instance in each group, and the second /// stage scales and shifts the results of the first stage. The floating-point precision @@ -1710,7 +1710,7 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti /// if `stash_type` is 1, the operator casts all input variables to 32-bit float, /// performs the computation, and finally casts the normalized results back to the /// original type of `X`. The second stage does not depend on `stash_type`. - /// + /// /// When the number of groups is the same as the number of channels, this operator is /// equivalent to InstanceNormalization. When there is only one group, this operator /// is equivalent to LayerNormalization. @@ -1718,22 +1718,22 @@ public static Tensor GroupNormalization(Tensor X, Tensor scale, Ten Object result = OnnxInterpreter.interpret(OnnxOps.GroupNormalization.class, List.of(X, scale, bias), List.of(epsilon, stash_type, num_groups)); return (Tensor) result; } - - /// + + /// /// Generates a Hamming window as described in the paper https://ieeexplore.ieee.org/document/1455106. public static Tensor HammingWindow(Tensor size, Optional periodic, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.HammingWindow.class, List.of(size), List.of(periodic, output_datatype)); return (Tensor) result; } - - /// + + /// /// Generates a Hann window as described in the paper https://ieeexplore.ieee.org/document/1455106. public static Tensor HannWindow(Tensor size, Optional periodic, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.HannWindow.class, List.of(size), List.of(periodic, output_datatype)); return (Tensor) result; } - - /// + + /// /// HardSigmoid takes one input data (Tensor) and produces one output data /// (Tensor) where the HardSigmoid function, y = max(0, min(1, alpha * x + beta)), /// is applied to the tensor elementwise. @@ -1741,8 +1741,8 @@ public static Tensor HardSigmoid(Tensor X, Optional alpha, Opti Object result = OnnxInterpreter.interpret(OnnxOps.HardSigmoid.class, List.of(X), List.of(alpha, beta)); return (Tensor) result; } - - /// + + /// /// HardSwish takes one input data (Tensor) and produces one output data (Tensor) where /// the HardSwish function, y = x * max(0, min(1, alpha * x + beta)) = x * HardSigmoid(x), /// where alpha = 1/6 and beta = 0.5, is applied to the tensor elementwise. @@ -1750,12 +1750,12 @@ public static Tensor HardSwish(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.HardSwish.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the hardmax values for the given input: - /// + /// /// Hardmax(element in input, axis) = 1 if the element is the first maximum value along the specified axis, 0 otherwise - /// + /// /// The "axis" attribute indicates the dimension along which Hardmax /// will be performed. The output tensor has the same shape /// and contains the Hardmax values of the corresponding input. @@ -1763,13 +1763,13 @@ public static Tensor Hardmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Hardmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - + /// Identity operator public static V Identity(V input) { Object result = OnnxInterpreter.interpret(OnnxOps.Identity.class, List.of(input), List.of()); return (V) result; } - + /// Loads and decodes and image from a file. If it can't decode for any reason (e.g. corrupted encoded /// stream, invalid format, it will return an empty matrix). /// The following image formats are supported: @@ -1797,8 +1797,8 @@ public static Tensor ImageDecoder(Tensor encoded_stream, Optional) result; } - - /// + + /// /// Replaces inputs that equal one value with another, leaving all other elements alone.
/// This operator is typically used to replace missing values in situations where they have a canonical /// representation, such as -1, 0, NaN, or some extreme value.
@@ -1811,53 +1811,53 @@ public static Tensor Imputer(Tensor X, Optional replaced_value_i Object result = OnnxInterpreter.interpret(OnnxOps.Imputer.class, List.of(X), List.of(replaced_value_int64, replaced_value_float, imputed_value_int64s, imputed_value_floats)); return (Tensor) result; } - - /// + + /// /// Carries out instance normalization as described in the paper /// https://arxiv.org/abs/1607.08022. - /// + /// /// y = scale * (x - mean) / sqrt(variance + epsilon) + B, /// where mean and variance are computed per instance per channel. public static Tensor InstanceNormalization(Tensor input, Tensor scale, Tensor B, Optional epsilon) { Object result = OnnxInterpreter.interpret(OnnxOps.InstanceNormalization.class, List.of(input, scale, B), List.of(epsilon)); return (Tensor) result; } - + /// Map infinity to true and other values to false. public static Tensor IsInf(Tensor X, Optional detect_negative, Optional detect_positive) { Object result = OnnxInterpreter.interpret(OnnxOps.IsInf.class, List.of(X), List.of(detect_negative, detect_positive)); return (Tensor) result; } - + /// Returns which elements of the input are NaN. public static Tensor IsNaN(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.IsNaN.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Local Response Normalization proposed in the [AlexNet paper](https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf). /// It normalizes over local input regions. /// The local region is defined across the channels. For an element `X[n, c, d1, ..., dk]` in a tensor /// of shape `(N x C x D1 x D2, ..., Dk)`, its region is /// `{X[n, i, d1, ..., dk] | max(0, c - floor((size - 1) / 2)) <= i <= min(C - 1, c + ceil((size - 1) / 2))}`. - /// + /// /// `square_sum[n, c, d1, ..., dk] = sum(X[n, i, d1, ..., dk] ^ 2)`, /// where `max(0, c - floor((size - 1) / 2)) <= i <= min(C - 1, c + ceil((size - 1) / 2))`. - /// + /// /// `Y[n, c, d1, ..., dk] = X[n, c, d1, ..., dk] / (bias + alpha / size * square_sum[n, c, d1, ..., dk] ) ^ beta` public static Tensor LRN(Tensor X, long size, Optional alpha, Optional bias, Optional beta) { Object result = OnnxInterpreter.interpret(OnnxOps.LRN.class, List.of(X), List.of(size, alpha, bias, beta)); return (Tensor) result; } - + public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } - /// + /// /// Computes an one-layer LSTM. This operator is usually supported via some /// custom implementation such as CuDNN. - /// + /// /// Notations: - /// + /// /// * `X` - input tensor /// * `i` - input gate /// * `o` - output gate @@ -1876,15 +1876,15 @@ public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } /// * `PB[iof]` - P peephole weight vector for backward input, output, and forget gates /// * `H` - Hidden state /// * `num_directions` - 2 if direction == bidirectional else 1 - /// + /// /// Activation functions: - /// + /// /// * Relu(x) - max(0, x) /// * Tanh(x) - (1 - e^{-2x})/(1 + e^{-2x}) /// * Sigmoid(x) - 1/(1 + e^{-x}) - /// + /// /// NOTE: Below are optional - /// + /// /// * Affine(x) - alpha*x + beta /// * LeakyRelu(x) - x if x >= 0 else alpha * x /// * ThresholdedRelu(x) - x if x >= alpha else 0 @@ -1893,9 +1893,9 @@ public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } /// * Elu(x) - x if x >= 0 else alpha*(e^x - 1) /// * Softsign(x) - x/(1 + |x|) /// * Softplus(x) - log(1 + e^x) - /// + /// /// Equations (Default: f=Sigmoid, g=Tanh, h=Tanh): - /// + /// /// * it = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Pi (.) Ct-1 + Wbi + Rbi) /// * ft = f(Xt*(Wf^T) + Ht-1*(Rf^T) + Pf (.) Ct-1 + Wbf + Rbf) /// * ct = g(Xt*(Wc^T) + Ht-1*(Rc^T) + Wbc + Rbc) @@ -1908,8 +1908,8 @@ public static LSTMResult LSTM(Tensor X, Tensor W, Tensor R, Opti Object[] resultArray = (Object[]) result; return new LSTMResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// Maps each element in the input tensor to another value.
/// The mapping is determined by the two parallel attributes, 'keys_*' and /// 'values_*' attribute. The i-th value in the specified 'keys_*' attribute @@ -1933,9 +1933,9 @@ public static Tensor LabelEncoder(Tensor X, Optional Object result = OnnxInterpreter.interpret(OnnxOps.LabelEncoder.class, List.of(X), List.of(values_strings, keys_int64s, keys_tensor, keys_strings, default_float, keys_floats, default_tensor, default_int64, values_tensor, values_int64s, default_string, values_floats)); return (Tensor) result; } - + public record LayerNormalizationResult(Tensor Y, Tensor Mean, Tensor InvStdDev) { } - /// + /// /// This is layer normalization defined in ONNX as function. /// The overall computation can be split into two stages. /// The first stage is standardization, which makes the @@ -1982,8 +1982,8 @@ public static LayerNormalizationResult LayerNormalization(Tensor Object[] resultArray = (Object[]) result; return new LayerNormalizationResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// LeakyRelu takes input data (Tensor) and an argument alpha, and produces one /// output data (Tensor) where the function `f(x) = alpha * x for x < 0`, /// `f(x) = x for x >= 0`, is applied to the data tensor elementwise. @@ -1991,50 +1991,50 @@ public static Tensor LeakyRelu(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.LeakyRelu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `less` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Less(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Less.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `less_equal` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor LessOrEqual(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.LessOrEqual.class, List.of(A, B), List.of()); return (Tensor) result; } - + public record LinearAttentionResult(Tensor output, Tensor present_state) { } - /// + /// /// Unified linear attention operator for autoregressive decoding (T=1) and prefill (T>1). - /// + /// /// The query, key, value, and (where applicable) decay/beta inputs use 3D packed format /// [B, T, H*D], where heads are flattened into the last dimension; q_num_heads and /// kv_num_heads are always required and are used to unpack to 4D internally for computation. /// The optional past_state and present_state are 4D with shape (B, H_kv, d_k, d_v). - /// + /// /// Group-query attention (GQA) is supported: q_num_heads must be a positive multiple of /// kv_num_heads. When q_num_heads == kv_num_heads this reduces to multi-headed linear /// attention; when q_num_heads > kv_num_heads each KV head (and its recurrent state) is /// shared by `q_num_heads / kv_num_heads` query heads (multi-query attention is the /// special case kv_num_heads == 1). - /// + /// /// The update_rule attribute selects the recurrence type: /// - "linear": S_t = S_{t-1} + k_t ⊗ v_t; o_t = scale * q_t^T S_t /// - "gated": S_t = exp(g_t) * S_{t-1} + k_t ⊗ v_t; o_t = scale * q_t^T S_t /// - "delta": S_t = S_{t-1} + β_t * k_t ⊗ (v_t - S_{t-1}^T k_t); o_t = scale * q_t^T S_t /// - "gated_delta": S_t = exp(g_t) * S_{t-1} + β_t * k_t ⊗ (v_t - exp(g_t) * S_{t-1}^T k_t); o_t = scale * q_t^T S_t - /// + /// /// where g_t is the decay (in log-space), β_t is the update rate, and ⊗ denotes outer product. - /// + /// /// Semantics: Equivalent to running the recurrent update sequentially for each token, /// but may be implemented using chunk-parallel algorithms for GPU efficiency. public static LinearAttentionResult LinearAttention(Tensor query, Tensor key, Tensor value, Optional> past_state, Optional> decay, Optional> beta, Optional chunk_size, Optional update_rule, Optional scale, long q_num_heads, long kv_num_heads) { @@ -2042,17 +2042,17 @@ public static LinearAttentionResult LinearAttention(Tensor query Object[] resultArray = (Object[]) result; return new LinearAttentionResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - + public record LinearClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// Linear classifier public static LinearClassifierResult LinearClassifier(Tensor X, Optional classlabels_ints, Optional post_transform, float[] coefficients, Optional multi_class, Optional intercepts, Optional classlabels_strings) { Object result = OnnxInterpreter.interpret(OnnxOps.LinearClassifier.class, List.of(X), List.of(classlabels_ints, post_transform, coefficients, multi_class, intercepts, classlabels_strings)); Object[] resultArray = (Object[]) result; return new LinearClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Generalized linear regression evaluation.
/// If targets is set to 1 (default) then univariate regression is performed.
/// If targets is set to M then M sets of coefficients must be passed in as a sequence @@ -2063,19 +2063,19 @@ public static Tensor LinearRegressor(Tensor X, Optional po Object result = OnnxInterpreter.interpret(OnnxOps.LinearRegressor.class, List.of(X), List.of(post_transform, coefficients, targets, intercepts)); return (Tensor) result; } - - /// + + /// /// Calculates the natural log of the given input tensor, element-wise. public static Tensor Log(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Log.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the log of softmax values for the given input: - /// + /// /// LogSoftmax(input, axis) = Log(Softmax(input, axis=axis)) - /// + /// /// The "axis" attribute indicates the dimension along which LogSoftmax /// will be performed. The output tensor has the same shape /// and contains the LogSoftmax values of the corresponding input. @@ -2083,8 +2083,8 @@ public static Tensor LogSoftmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.LogSoftmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Given a matrix, apply Lp-normalization along the provided axis. /// The output is computed as: `output = input / Lp_norm(input, axis)`. /// When the Lp norm is zero (i.e., all elements along the axis are zero), @@ -2093,8 +2093,8 @@ public static Tensor LpNormalization(Tensor input, Optional p, O Object result = OnnxInterpreter.interpret(OnnxOps.LpNormalization.class, List.of(input), List.of(p, axis)); return (Tensor) result; } - - /// + + /// /// LpPool consumes an input tensor X and applies Lp pooling across /// the tensor according to kernel sizes, stride sizes, and pad lengths. /// Lp pooling consisting of computing the Lp norm on all values of a subset @@ -2108,7 +2108,7 @@ public static Tensor LpNormalization(Tensor input, Optional p, O /// output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - {kernelSpatialShape}) / strides_spatial_shape[i] + 1) /// ``` /// if ceil_mode is enabled `pad_shape[i]` is the sum of pads along axis `i`. - /// + /// /// `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following: /// ``` /// VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - {kernelSpatialShape} + 1) / strides_spatial_shape[i]) @@ -2122,23 +2122,23 @@ public static Tensor LpPool(Tensor X, Optional p, Optional) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). public static Tensor MatMul(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.MatMul.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). /// The production MUST never overflow. The accumulation may overflow if and only if in 32 bits. public static Tensor MatMulInteger(Tensor A, Tensor B, Optional> a_zero_point, Optional> b_zero_point) { Object result = OnnxInterpreter.interpret(OnnxOps.MatMulInteger.class, List.of(A, B, a_zero_point, b_zero_point), List.of()); return (Tensor) result; } - - /// + + /// /// Element-wise max of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2146,9 +2146,9 @@ public static Tensor Max(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Max.class, List.of(data_0), List.of()); return (Tensor) result; } - + public record MaxPoolResult(Tensor Y, Tensor Indices) { } - /// + /// /// MaxPool consumes an input tensor X and applies max pooling across /// the tensor according to kernel sizes, stride sizes, and pad lengths. /// max pooling consisting of computing the max on all values of a @@ -2164,7 +2164,7 @@ public record MaxPoolResult(Tensor Y, Tensor Indices) { } /// output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1) /// ``` /// if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`. Sliding windows that would start in the right padded region are ignored. - /// + /// /// `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled: /// ``` /// VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i]) @@ -2179,15 +2179,15 @@ public record MaxPoolResult(Tensor Y, Tensor Indices) { } /// ``` /// pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i] /// ``` - /// The output of each pooling window is maximum number of elements exclude pad. - /// + /// The output of each pooling window is maximum number of elements exclude pad. + /// public static MaxPoolResult MaxPool(Tensor X, Optional pads, Optional dilations, Optional auto_pad, Optional ceil_mode, Optional storage_order, Optional strides, long[] kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.MaxPool.class, List.of(X), List.of(pads, dilations, auto_pad, ceil_mode, storage_order, strides, kernel_shape)); Object[] resultArray = (Object[]) result; return new MaxPoolResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// ROI max pool consumes an input tensor X and region of interests (RoIs) to /// apply max pooling across each RoI, to produce output 4-D tensor of shape /// (num_rois, channels, pooled_shape[0], pooled_shape[1]). @@ -2195,23 +2195,23 @@ public static Tensor MaxRoiPool(Tensor X, Tensor rois, Optional) result; } - - /// + + /// /// MaxUnpool essentially computes the partial inverse of the MaxPool op. /// The input information to this op is typically the output information from a MaxPool op. The first /// input tensor X is the tensor that needs to be unpooled, which is typically the pooled tensor (first output) /// from MaxPool. The second input tensor, I, contains the indices to the (locally maximal) elements corresponding /// to the elements in the first input tensor X. Input tensor I is typically the second output of the MaxPool op. /// The third (optional) input is a tensor that specifies the output size of the unpooling operation. - /// + /// /// MaxUnpool is intended to do 'partial' inverse of the MaxPool op. 'Partial' because all the non-maximal /// values from the original input to MaxPool are set to zero in the output of the MaxUnpool op. Pooling /// the result of an unpooling operation should give back the original input to the unpooling op. - /// + /// /// MaxUnpool can produce the same output size for several input sizes, which makes unpooling op ambiguous. /// The third input argument, output_size, is meant to disambiguate the op and produce output tensor of /// known/predictable size. - /// + /// /// In addition to the inputs, MaxUnpool takes three attributes, namely kernel_shape, strides, and pads, /// which define the exact unpooling op. The attributes typically have the same values as the corresponding /// pooling op that the unpooling op is trying to invert. @@ -2219,8 +2219,8 @@ public static Tensor MaxUnpool(Tensor X, Tensor I, Optional) result; } - - /// + + /// /// Element-wise mean of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2228,30 +2228,30 @@ public static Tensor Mean(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Mean.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// A MeanVarianceNormalization Function: Perform mean variance normalization /// on the input tensor X using formula: `(X-EX)/sqrt(E(X-EX)^2)` public static Tensor MeanVarianceNormalization(Tensor X, Optional axes) { Object result = OnnxInterpreter.interpret(OnnxOps.MeanVarianceNormalization.class, List.of(X), List.of(axes)); return (Tensor) result; } - - /// + + /// /// Generate a MelWeightMatrix that can be used to re-weight a Tensor containing a linearly sampled frequency spectra (from DFT or STFT) into num_mel_bins frequency information based on the [lower_edge_hertz, upper_edge_hertz] range on the mel scale. /// This function defines the mel scale in terms of a frequency in hertz according to the following formula: - /// + /// /// mel(f) = 2595 * log10(1 + f/700) - /// + /// /// In the returned matrix, all the triangles (filterbanks) have a peak value of 1.0. - /// + /// /// The returned MelWeightMatrix can be used to right-multiply a spectrogram S of shape [frames, num_spectrogram_bins] of linear scale spectrum values (e.g. STFT magnitudes) to generate a "mel spectrogram" M of shape [frames, num_mel_bins]. public static Tensor MelWeightMatrix(Tensor num_mel_bins, Tensor dft_length, Tensor sample_rate, Tensor lower_edge_hertz, Tensor upper_edge_hertz, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.MelWeightMatrix.class, List.of(num_mel_bins, dft_length, sample_rate, lower_edge_hertz, upper_edge_hertz), List.of(output_datatype)); return (Tensor) result; } - - /// + + /// /// Element-wise min of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2259,12 +2259,12 @@ public static Tensor Min(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Min.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// Mish: A Self Regularized Non-Monotonic Neural Activation Function. - /// + /// /// Perform the linear unit element-wise on the input tensor X using formula: - /// + /// /// ``` /// mish(x) = x * tanh(softplus(x)) = x * tanh(ln(1 + e^{x})) /// ``` @@ -2272,14 +2272,14 @@ public static Tensor Mish(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Mish.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Performs an element-wise binary modulo operation. /// The semantics and supported data types depend on the value of the `fmod` attribute which must be `0` (default), or `1`. - /// + /// /// If the `fmod` attribute is set to `0`, `T` is constrained to integer data types and the semantics follow that of the Python `%`-operator. /// The sign of the result is that of the divisor. - /// + /// /// If `fmod` is set to `1`, the behavior of this operator follows that of the `fmod` function in C and `T` is constrained to floating point data types. /// The result of this operator is the remainder of the division operation `x / y` where `x` and `y` are respective elements of `A` and `B`. The result is exactly the value `x - n * y`, where `n` is `x / y` with its fractional part truncated. /// The returned value has the same sign as `x` (except if `x` is `-0`) and is less or equal to `|y|` in magnitude. @@ -2289,20 +2289,20 @@ public static Tensor Mish(Tensor X) { /// - If `y` is `±0` and `x` is not `NaN`, `NaN` should be returned. /// - If `y` is `±∞` and `x` is finite, `x` is returned. /// - If either argument is `NaN`, `NaN` is returned. - /// + /// /// This operator supports **multidirectional (i.e., NumPy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Mod(Tensor A, Tensor B, Optional fmod) { Object result = OnnxInterpreter.interpret(OnnxOps.Mod.class, List.of(A, B), List.of(fmod)); return (Tensor) result; } - - /// + + /// /// Compute one iteration of stochastic gradient update with momentum. /// This operator can conduct the optimization of multiple tensor variables. - /// + /// /// Let's define the behavior of this operator. As you can imagine, SG with momentum requires /// several parameters: - /// + /// /// - The learning-rate "R". /// - The update count "T". That is, the number of conducted training iterations. It should /// be zero in the first training iteration. @@ -2311,48 +2311,48 @@ public static Tensor Mod(Tensor A, Tensor B, Optional fmod) { /// - The scaling coefficient of current gradient "beta". /// - An attribute to choose either standard momentum or Nesterov's momentum "mode" should /// be used. - /// + /// /// For the sake of simplicity, assume that there is only one tensor (called "X") to be optimized. /// Other necessary inputs are "X"'s gradient (called "G") and "X"'s momentum (called "V"). This /// Momentum operator maps all these inputs to the new value of "X" (called "X_new") and its new /// momentum (called "V_new"). - /// + /// /// This operator supports two different momentum algorithms. Set the attribute "mode" to /// "nesterov" if Nesterov's momentum is desired. Otherwise, set the attribute "model" to /// "standard" to use standard momentum. Computation details are described subsequently. - /// + /// /// Let "+", "-", "*", and "/" are all element-wise operations with numpy-style broadcasting. - /// + /// /// Pseudo code for SG with standard momentum: - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||^2, where ||X|| is the sum of squared /// // values of all elements in X. /// G_regularized = norm_coefficient * X + G - /// + /// /// // In the first training iteration, beta should always be 1. /// beta_adjusted = T > 0 ? beta : 1 - /// + /// /// // Compute the current momentum based on previous momentum and the current gradient. /// V_new = alpha * V + beta_adjusted * G_regularized - /// + /// /// // Update X. /// X_new = X - R * V_new - /// + /// /// Pseudo code for SG with Nesterov's momentum: - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||^2, where ||X|| is the sum of squared /// // values of all elements in X. /// G_regularized = norm_coefficient * X + G; - /// + /// /// // In the first training iteration, beta should always be 1. /// beta_adjusted = T > 0 ? beta : 1 - /// + /// /// // Compute the current momentum based on previous momentum and the current gradient. /// V_new = alpha * V + beta_adjusted * G_regularized; - /// + /// /// // Compute final update direction and then update X. /// X_new = X - R * (G_regularized + alpha * V_new) - /// + /// /// If one assign this operators to optimize multiple inputs, for example, "X_1" and "X_2". The same /// pseudo code would be extended to handle all tensors jointly. More specifically, we can view "X" as a /// concatenation of "X_1" and "X_2" (of course, their gradient and accumulate gradient should @@ -2361,27 +2361,27 @@ public static List> Momentum(Tensor R, Tensor T, L Object result = OnnxInterpreter.interpret(OnnxOps.Momentum.class, List.of(R, T, inputs), List.of(mode, norm_coefficient, alpha, beta)); return (List>) result; } - - /// + + /// /// Performs element-wise binary multiplication (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Mul(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Mul.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Generate a tensor of samples from a multinomial distribution according to the probabilities /// of each of the possible outcomes. public static Tensor Multinomial(Tensor input, Optional seed, Optional sample_size, Optional dtype) { Object result = OnnxInterpreter.interpret(OnnxOps.Multinomial.class, List.of(input), List.of(seed, sample_size, dtype)); return (Tensor) result; } - - /// + + /// /// Neg takes one input data (Tensor) and produces one output data /// (Tensor) where each element flipped sign, y = -x, is applied to /// the tensor elementwise. @@ -2389,70 +2389,70 @@ public static Tensor Neg(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Neg.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// A NegativeLogLikelihoodLoss operator computes (weighted) negative log likelihood loss. /// Its "input" tensor has the shape of (N, C, d1, d2, ..., dk) where k >= 0. /// The "input" tensor contains log-probabilities for input[n, :, d_1, d_2,..., d_k] being in a class of [0, C). /// The operator's "target" input tensor has the shape of (N, d1, d2, ..., dk). It encodes class labels (one of C classes) /// or it may contain a special value (indicated by an attribute ignore_index) for N x d1 x d2 x ... x dk samples. /// The loss value for input[n, :, d_1, d_2,...d_k] being classified as class c = target[n][d_1][d_2]...[d_k] is computed as: - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = -input[n][c][d_1][d_2]...[d_k]. /// ``` - /// + /// /// When an optional "weight" is provided, the sample loss is calculated as: - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = -input[n][c][d_1][d_2]...[d_k] * weight[c]. /// ``` - /// + /// /// loss is zero for the case when target-value equals ignore_index. - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = 0, when target[n][d_1][d_2]...[d_k] = ignore_index /// ``` - /// + /// /// If "reduction" attribute is set to "none", the operator's output will be the above loss with shape (N, d1, d2, ..., dk). /// If "reduction" attribute is set to "mean" (the default attribute value), the output loss is (weight) averaged: - /// + /// /// ``` /// mean(loss), if "weight" is not provided, /// ``` - /// + /// /// or if weight is provided, - /// + /// /// ``` /// sum(loss) / sum(weight[target[n][d_1][d_2]...[d_k]]]), for all samples. /// ``` - /// + /// /// If "reduction" attribute is set to "sum", the output is a scalar: `sum(loss)`. - /// + /// /// See also https://pytorch.org/docs/stable/nn.html#torch.nn.NLLLoss. - /// + /// /// Example 1: - /// + /// /// ``` /// // negative log likelihood loss, "none" reduction /// N, C, d1 = 2, 3, 2 /// input = [[[1.0, 2.0], [2.0, 2.0], [3.0, 2.0]], /// [[0.0, 1.0], [2.0, 2.0], [1.0, 2]]] /// target = [[2, 1], [0, 2]] - /// + /// /// loss = np.zeros((N, d1)) /// for n in range(N): /// for d_1 in range(d1): /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] - /// + /// /// // print(loss) /// // [[-3. -2.] /// // [-0. -2.]] /// ``` - /// + /// /// Example 2: - /// + /// /// ``` /// // weighted negative log likelihood loss, sum reduction /// N, C, d1 = 2, 3, 2 @@ -2465,14 +2465,14 @@ public static Tensor Neg(Tensor X) { /// for d_1 in range(d1): /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] * weight[c] - /// + /// /// loss = np.sum(loss) /// // print(loss) /// // -1.1 /// ``` - /// + /// /// Example 3: - /// + /// /// ``` /// // weighted negative log likelihood loss, mean reduction /// N, C, d1 = 2, 3, 2 @@ -2487,7 +2487,7 @@ public static Tensor Neg(Tensor X) { /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] * weight[c] /// weight_total = weight_total + weight[c] - /// + /// /// loss = np.sum(loss) / weight_total /// // print(loss) /// // -1.57 @@ -2496,8 +2496,8 @@ public static Tensor NegativeLogLikelihoodLoss(Tensor input, Ten Object result = OnnxInterpreter.interpret(OnnxOps.NegativeLogLikelihoodLoss.class, List.of(input, target, weight), List.of(ignore_index, reduction)); return (Tensor) result; } - - /// + + /// /// Filter out boxes that have high intersection-over-union (IOU) overlap with previously selected boxes. /// Bounding boxes with score less than score_threshold are removed. Bounding box format is indicated by attribute center_point_box. /// Boxes are suppressed if their IOU with a previously selected box is strictly greater than iou_threshold (i.e., boxes with IOU exactly equal to the threshold are kept). @@ -2510,8 +2510,8 @@ public static Tensor NonMaxSuppression(Tensor boxes, Tensor Object result = OnnxInterpreter.interpret(OnnxOps.NonMaxSuppression.class, List.of(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold), List.of(center_point_box)); return (Tensor) result; } - - /// + + /// /// Returns the indices of the elements that are non-zero /// (in row-major order - by dimension). /// NonZero behaves similar to numpy.nonzero: @@ -2521,8 +2521,8 @@ public static Tensor NonZero(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.NonZero.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Normalize the input. There are three normalization modes, which have the corresponding formulas, /// defined using element-wise infix operators '/' and '^' and tensor-wide functions 'max' and 'sum':
///
@@ -2537,15 +2537,15 @@ public static Tensor Normalizer(Tensor X, Optional norm) { Object result = OnnxInterpreter.interpret(OnnxOps.Normalizer.class, List.of(X), List.of(norm)); return (Tensor) result; } - - /// + + /// /// Returns the negation of the input tensor element-wise. public static Tensor Not(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Not.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Produces a one-hot tensor based on inputs. /// The locations represented by the index values in the 'indices' input tensor will have 'on_value' /// and the other locations will have 'off_value' in the output tensor, where 'on_value' and 'off_value' @@ -2558,18 +2558,18 @@ public static Tensor Not(Tensor X) { /// as the type of the 'values' input. Any entries in the 'indices' input tensor with values outside /// the range [-depth, depth-1] will result in one-hot representation with all 'off_value' values in the /// output tensor. - /// + /// /// when axis = 0: /// output[input[i, j, k], i, j, k] = 1 for all i, j, k and 0 otherwise. - /// + /// /// when axis = -1: /// output[i, j, k, input[i, j, k]] = 1 for all i, j, k and 0 otherwise. public static Tensor OneHot(Tensor indices, Tensor depth, Tensor values, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.OneHot.class, List.of(indices, depth, values), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Replace each input element with an array of ones and zeros, where a single /// one is placed at the index of the category that was passed in. The total category count /// will determine the size of the extra dimension of the output array Y.
@@ -2582,16 +2582,16 @@ public static Tensor OneHotEncoder(Tensor X, Optional ca Object result = OnnxInterpreter.interpret(OnnxOps.OneHotEncoder.class, List.of(X), List.of(cats_strings, cats_int64s, zeros)); return (Tensor) result; } - - /// + + /// /// Constructs an optional-type value containing either an empty optional of a certain type specified by the attribute, /// or a non-empty value containing the input element. public static Optional Optional(Optional input, Optional type) { Object result = OnnxInterpreter.interpret(OnnxOps.Optional.class, List.of(input), List.of(type)); return (Optional) result; } - - /// + + /// /// If the input is a tensor or sequence type, it returns the input. /// If the input is an optional type, it outputs the element in the input. /// It is an error if the input is an empty optional-type (i.e. does not have an element) and the behavior is undefined in this case. @@ -2599,8 +2599,8 @@ public static V OptionalGetElement(O input) { Object result = OnnxInterpreter.interpret(OnnxOps.OptionalGetElement.class, List.of(input), List.of()); return (V) result; } - - /// + + /// /// Returns true if (1) the input is an optional-type and contains an element, /// or, (2) the input is a tensor or sequence type. /// If the input is not provided or is an empty optional-type, this op returns false. @@ -2608,18 +2608,18 @@ public static Tensor OptionalHasElement(Optional input) { Object result = OnnxInterpreter.interpret(OnnxOps.OptionalHasElement.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `or` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Or(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Or.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// PRelu takes input data (Tensor) and slope tensor as input, and produces one /// output data (Tensor) where the function `f(x) = slope * x for x < 0`, /// `f(x) = x for x >= 0`., is applied to the data tensor elementwise. @@ -2628,99 +2628,99 @@ public static Tensor PRelu(Tensor X, Tensor slope) { Object result = OnnxInterpreter.interpret(OnnxOps.PRelu.class, List.of(X, slope), List.of()); return (Tensor) result; } - - /// + + /// /// Given a tensor containing the data to be padded (`data`), a tensor containing the number of start and end pad values for axis (`pads`), (optionally) a `mode`, and (optionally) `constant_value`, /// a padded tensor (`output`) is generated. - /// + /// /// The four supported `modes` are (similar to corresponding modes supported by `numpy.pad`): - /// + /// /// 1) `constant`(default) - pads with a given constant value as specified by `constant_value` (which defaults to 0, empty string, or False) - /// + /// /// 2) `reflect` - pads with the reflection of the vector mirrored on the first and last values of the vector along each axis - /// + /// /// 3) `edge` - pads with the edge values of array - /// + /// /// 4) `wrap` - wrap-around padding as if the data tensor forms a torus - /// - /// + /// + /// /// Example 1 (`constant` mode): - /// + /// /// Insert 0 pads to the beginning of the second dimension. - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'constant' - /// + /// /// constant_value = 0.0 - /// + /// /// output = [ /// [0.0, 0.0, 1.0, 1.2], /// [0.0, 0.0, 2.3, 3.4], /// [0.0, 0.0, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 2 (`reflect` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'reflect' - /// + /// /// output = [ /// [1.0, 1.2, 1.0, 1.2], /// [2.3, 3.4, 2.3, 3.4], /// [4.5, 5.7, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 3 (`edge` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'edge' - /// + /// /// output = [ /// [1.0, 1.0, 1.0, 1.2], /// [2.3, 2.3, 2.3, 3.4], /// [4.5, 4.5, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 4 (`wrap` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [2, 1, 1, 1] - /// + /// /// mode = 'wrap' - /// + /// /// output = [ /// [3.4, 2.3, 3.4, 2.3], /// [5.7, 4.5, 5.7, 4.5], @@ -2734,8 +2734,8 @@ public static Tensor Pad(Tensor data, Tensor pads, Optiona Object result = OnnxInterpreter.interpret(OnnxOps.Pad.class, List.of(data, pads, constant_value, axes), List.of(mode)); return (Tensor) result; } - - /// + + /// /// Pow takes input data (Tensor) and exponent Tensor, and /// produces one output data (Tensor) where the function `f(x) = x^exponent`, /// is applied to the data tensor elementwise. @@ -2744,8 +2744,8 @@ public static Tensor Pow(Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.Pow.class, List.of(X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// The convolution operator consumes a quantized input tensor, its scale and zero point, /// a quantized filter, its scale and zero point, and output's scale and zero point, /// and computes the quantized output. Each scale and zero-point pair must have same shape. @@ -2757,8 +2757,8 @@ public static Tensor QLinearConv(Tensor x, Tensor x_ Object result = OnnxInterpreter.interpret(OnnxOps.QLinearConv.class, List.of(x, x_scale, x_zero_point, w, w_scale, w_zero_point, y_scale, y_zero_point, B), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); return (Tensor) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). /// It consumes two quantized input tensors, their scales and zero points, scale and zero point of output, /// and computes the quantized output. The quantization formula is y = saturate((x / y_scale) + y_zero_point). @@ -2774,12 +2774,12 @@ public static Tensor QLinearMatMul(Tensor a, Tensor Object result = OnnxInterpreter.interpret(OnnxOps.QLinearMatMul.class, List.of(a, a_scale, a_zero_point, b, b_scale, b_zero_point, y_scale, y_zero_point), List.of()); return (Tensor) result; } - - /// + + /// /// The linear quantization operator consumes a high-precision tensor, a scale, and a zero point to compute the /// low-precision/quantized tensor. The scale factor and zero point must have the same shape, determining the quantization /// granularity. The quantization formula is `y = saturate((x / y_scale) + y_zero_point)`. - /// + /// /// Saturation is done according to: /// - uint16: [0, 65535] /// - int16: [-32768, 32767] @@ -2789,14 +2789,14 @@ public static Tensor QLinearMatMul(Tensor a, Tensor /// - int4: [-8, 7] /// - uint2: [0, 3] /// - int2: [-2, 1] - /// + /// /// For `(x / y_scale)`, it rounds to the nearest even. Refer to https://en.wikipedia.org/wiki/Rounding for details. - /// + /// /// `y_zero_point` and `y` must have the same type. `y_zero_point` is usually not used for quantization to float8 and 4bit types, but the quantization /// formula remains the same for consistency, and the type of the attribute `y_zero_point` still determines the quantization type. /// `x` and `y_scale` are allowed to have different types. The type of `y_scale` determines the precision of the division operation between `x` and /// `y_scale`, unless the `precision` attribute is specified. - /// + /// /// There are three supported quantization granularities, determined by the shape of `y_scale`. /// In all cases, `y_zero_point` must have the same shape as `y_scale`. /// - Per-tensor (per-layer) quantization: `y_scale` is a scalar. @@ -2809,8 +2809,8 @@ public static Tensor QuantizeLinear(Tensor x, Tensor y_ Object result = OnnxInterpreter.interpret(OnnxOps.QuantizeLinear.class, List.of(x, y_scale, y_zero_point), List.of(output_dtype, saturate, precision, axis, block_size)); return (Tensor) result; } - - /// + + /// /// This is RMS normalization defined in ONNX as function as described in the paper https://arxiv.org/pdf/1910.07467. /// The overall computation can be split into two stages. The root mean squared norm is taken over the last D dimensions, /// where D is the dimension of normalized_shape. For example, if normalized_shape is (3, 5) (a 2-dimensional shape), @@ -2843,14 +2843,14 @@ public static Tensor RMSNormalization(Tensor X, Tensor scale, Op Object result = OnnxInterpreter.interpret(OnnxOps.RMSNormalization.class, List.of(X, scale), List.of(epsilon, stash_type, axis)); return (Tensor) result; } - + public record RNNResult(Tensor Y, Tensor Y_h) { } - /// + /// /// Computes an one-layer simple RNN. This operator is usually supported /// via some custom implementation such as CuDNN. - /// + /// /// Notations: - /// + /// /// * `X` - input tensor /// * `i` - input gate /// * `t` - time step (t-1 means previous time step) @@ -2864,15 +2864,15 @@ public record RNNResult(Tensor Y, Tensor Y_h) { } /// * `RBbi` - RR bias vectors for backward input gate /// * `H` - Hidden state /// * `num_directions` - 2 if direction == bidirectional else 1 - /// + /// /// Activation functions: - /// + /// /// * Relu(x) - max(0, x) /// * Tanh(x) - (1 - e^{-2x})/(1 + e^{-2x}) /// * Sigmoid(x) - 1/(1 + e^{-x}) - /// + /// /// NOTE: Below are optional - /// + /// /// * Affine(x) - alpha*x + beta /// * LeakyRelu(x) - x if x >= 0 else alpha * x /// * ThresholdedRelu(x) - x if x >= alpha else 0 @@ -2881,9 +2881,9 @@ public record RNNResult(Tensor Y, Tensor Y_h) { } /// * Elu(x) - x if x >= 0 else alpha*(e^x - 1) /// * Softsign(x) - x/(1 + |x|) /// * Softplus(x) - log(1 + e^x) - /// + /// /// Equations (Default: f=Tanh): - /// + /// /// * Ht = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Wbi + Rbi) /// This operator has **optional** inputs/outputs. See [the doc](IR.md) for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted. public static RNNResult RNN(Tensor X, Tensor W, Tensor R, Optional> B, Optional> sequence_lens, Optional> initial_h, Optional layout, Optional activation_alpha, Optional hidden_size, Optional activation_beta, Optional activations, Optional clip, Optional direction) { @@ -2891,12 +2891,12 @@ public static RNNResult RNN(Tensor X, Tensor W, Tensor R, Option Object[] resultArray = (Object[]) result; return new RNNResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Generate a tensor with random values drawn from a normal distribution. The shape /// of the tensor is specified by the `shape` argument and the parameter of the normal distribution /// specified by `mean` and `scale`. - /// + /// /// The data type is specified by the 'dtype' argument. The 'dtype' argument must /// be one of the data types specified in the 'DataType' enum field in the /// TensorProto message. @@ -2904,12 +2904,12 @@ public static Tensor RandomNormal(long[] shape, Optional seed, Opt Object result = OnnxInterpreter.interpret(OnnxOps.RandomNormal.class, List.of(), List.of(shape, seed, mean, scale, dtype)); return (Tensor) result; } - - /// + + /// /// Generate a tensor with random values drawn from a normal distribution. /// The shape of the output tensor is copied from the shape of the input tensor, /// and the parameters of the normal distribution are specified by `mean` and `scale`. - /// + /// /// The data type is specified by the 'dtype' argument, or copied from the input tensor if not provided. /// The 'dtype' argument must be one of the data types specified in the 'DataType' enum field in the /// TensorProto message, and be valid as an output type. @@ -2917,11 +2917,11 @@ public static Tensor RandomNormalLike(Tensor input, Optional) result; } - - /// + + /// /// Generate a tensor with random values drawn from a uniform distribution. The shape /// of the tensor is specified by the `shape` argument and the range by `low` and `high`. - /// + /// /// The data type is specified by the 'dtype' argument. The 'dtype' argument must /// be one of the data types specified in the 'DataType' enum field in the /// TensorProto message. @@ -2929,12 +2929,12 @@ public static Tensor RandomUniform(Optional high, long[] shape, Op Object result = OnnxInterpreter.interpret(OnnxOps.RandomUniform.class, List.of(), List.of(high, shape, seed, low, dtype)); return (Tensor) result; } - - /// + + /// /// Generate a tensor with random values drawn from a uniform distribution. /// The shape of the output tensor is copied from the shape of the input tensor, /// and the parameters of the uniform distribution are specified by `low` and `high`. - /// + /// /// The data type is specified by the 'dtype' argument, or copied from the input tensor if not provided. /// The 'dtype' argument must be one of the data types specified in the 'DataType' enum field in the /// TensorProto message and be valid as an output type. @@ -2942,11 +2942,11 @@ public static Tensor RandomUniformLike(Tensor input, Optional) result; } - - /// + + /// /// Generate a tensor containing a sequence of numbers that begin at `start` and extends by increments of `delta` /// up to `limit` (exclusive). - /// + /// /// The number of elements in the output of range is computed as below: /// ``` /// number_of_elements = max( ceil( (limit - start) / delta ) , 0 ) @@ -2967,7 +2967,7 @@ public static Tensor RandomUniformLike(Tensor input, Optional Tensor Range(Tensor start, Tensor limit, Tensor de Object result = OnnxInterpreter.interpret(OnnxOps.Range.class, List.of(start, limit, delta), List.of(stash_type)); return (Tensor) result; } - - /// + + /// /// Reciprocal takes one input data (Tensor) and produces one output data /// (Tensor) where the reciprocal is, y = 1/x, is applied to /// the tensor elementwise. @@ -2986,158 +2986,158 @@ public static Tensor Reciprocal(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Reciprocal.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Computes the L1 norm of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceL1(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceL1.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the L2 norm of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceL2(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceL2.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the log sum of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or undefined otherwise. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceLogSum(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceLogSum.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the log sum exponent of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or undefined otherwise. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceLogSumExp(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceLogSumExp.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the max of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or the minimum value of the data type otherwise. - /// - /// + /// + /// /// If the input data type is Boolean, the comparison should consider `False < True`. - /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMax(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMax.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the mean of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields undefined. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMean(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMean.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the min of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields plus infinity (if supported by the datatype) or the maximum value of the data type otherwise. - /// - /// + /// + /// /// If the input data type is Boolean, the comparison should consider `False < True`. - /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMin(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMin.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the product of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 1. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceProd(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceProd.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the sum of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceSum(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceSum.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the sum square of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceSumSquare(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceSumSquare.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - + /// RegexFullMatch performs a full regex match on each element of the input tensor. If an element fully matches the regex pattern specified as an attribute, the corresponding element in the output is True and it is False otherwise. [RE2](https://github.com/google/re2/wiki/Syntax) regex syntax is used. public static Tensor RegexFullMatch(Tensor X, Optional pattern) { Object result = OnnxInterpreter.interpret(OnnxOps.RegexFullMatch.class, List.of(X), List.of(pattern)); return (Tensor) result; } - - /// + + /// /// Relu takes one input data (Tensor) and produces one output data /// (Tensor) where the rectified linear function, y = max(0, x), is applied to /// the tensor elementwise. @@ -3145,8 +3145,8 @@ public static Tensor Relu(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Relu.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Reshape the input tensor similar to numpy.reshape. /// First input is the data tensor, second input is a shape tensor which specifies the output shape. It outputs the reshaped tensor. /// At most one dimension of the new shape can be -1. In this case, the value is @@ -3156,7 +3156,7 @@ public static Tensor Relu(Tensor X) { /// dimension will be set explicitly to zero (i.e. not taken from input tensor). /// Shape (second input) could be an empty shape, which means converting to a scalar. /// The input tensor's shape and the output tensor's shape are required to have the same number of elements. - /// + /// /// If the attribute 'allowzero' is set, it is invalid for the specified shape to /// contain both a zero value and -1, as the value of the dimension corresponding /// to -1 cannot be determined uniquely. @@ -3164,8 +3164,8 @@ public static Tensor Reshape(Tensor data, Tensor shape, Optional Object result = OnnxInterpreter.interpret(OnnxOps.Reshape.class, List.of(data, shape), List.of(allowzero)); return (Tensor) result; } - - /// + + /// /// Resize the input tensor. In general, it calculates every value in the output tensor as a weighted average of neighborhood (a.k.a. sampling locations) in the input tensor. /// Each dimension value of the output tensor is: /// ``` @@ -3176,14 +3176,14 @@ public static Tensor Resize(Tensor X, Optional> roi, Object result = OnnxInterpreter.interpret(OnnxOps.Resize.class, List.of(X, roi, scales, sizes), List.of(mode, extrapolation_value, nearest_mode, antialias, cubic_coeff_a, axes, coordinate_transformation_mode, keep_aspect_ratio_policy, exclude_outside)); return (Tensor) result; } - - /// + + /// /// Reverse batch of sequences having different lengths specified by `sequence_lens`. - /// + /// /// For each slice i iterating on batch axis, the operator reverses the first sequence_lens[i] elements on time axis, /// and copies elements whose index's beyond sequence_lens[i] to the output. So the output slice i contains reversed /// sequences on the first sequence_lens[i] elements, then have original values copied for the other elements. - /// + /// /// Example 1: /// input = [[0.0, 4.0, 8.0, 12.0], /// [1.0, 5.0, 9.0, 13.0], @@ -3192,12 +3192,12 @@ public static Tensor Resize(Tensor X, Optional> roi, /// sequence_lens = [4, 3, 2, 1] /// time_axis = 0 /// batch_axis = 1 - /// + /// /// output = [[3.0, 6.0, 9.0, 12.0], /// [2.0, 5.0, 8.0, 13.0], /// [1.0, 4.0, 10.0, 14.0], /// [0.0, 7.0, 11.0, 15.0]] - /// + /// /// Example 2: /// input = [[0.0, 1.0, 2.0, 3.0 ], /// [4.0, 5.0, 6.0, 7.0 ], @@ -3206,7 +3206,7 @@ public static Tensor Resize(Tensor X, Optional> roi, /// sequence_lens = [1, 2, 3, 4] /// time_axis = 1 /// batch_axis = 0 - /// + /// /// output = [[0.0, 1.0, 2.0, 3.0 ], /// [5.0, 4.0, 6.0, 7.0 ], /// [10.0, 9.0, 8.0, 11.0], @@ -3215,14 +3215,14 @@ public static Tensor ReverseSequence(Tensor input, Tensor sequen Object result = OnnxInterpreter.interpret(OnnxOps.ReverseSequence.class, List.of(input, sequence_lens), List.of(time_axis, batch_axis)); return (Tensor) result; } - - /// + + /// /// Region of Interest (RoI) align operation described in the /// [Mask R-CNN paper](https://arxiv.org/abs/1703.06870). /// RoiAlign consumes an input tensor X and region of interests (rois) /// to apply pooling across each RoI; it produces a 4-D tensor of shape /// (num_rois, C, output_height, output_width). - /// + /// /// RoiAlign is proposed to avoid the misalignment by removing /// quantizations while converting from original image into feature /// map and from feature map into RoI feature; in each ROI bin, @@ -3232,21 +3232,21 @@ public static Tensor RoiAlign(Tensor X, Tensor rois, Tensor) result; } - - /// + + /// /// RotaryEmbedding is the implementation of rotary positional embeddings (RoPE) based on the paper https://arxiv.org/pdf/2104.09864. /// The key advantage of RoPE is that it allows the model to understand both the absolute position of a token and the relative distances /// between tokens. This is achieved through a rotational mechanism where the extent of rotation is computed based on the token's absolute position (position_ids). - /// + /// /// The rotational mechanism is defined by sine and cosine functions that are used to represent the rotation angles. /// For each token in the sequence, its positional embedding is computed by rotating its embedding vector. This is done by splitting the /// embedding vector either into two halves or interleaving every alternate token and applying the rotation matrix to each half of the embedding vector. /// The rotation matrix is parameterized by the token's position in the sequence. The rotated halves of the embedding vector are concatenated /// to form the final positional embedding for each token. The rotated positional embeddings are used in the self-attention mechanism. /// The rotation ensures that the model captures both absolute and relative positional information. - /// + /// /// Rotary embeddings are defined using the following algorithm: - /// + /// /// ```python /// def rotary_embedding( /// input: np.ndarray, @@ -3271,7 +3271,7 @@ public static Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RotaryEmbedding(Tensor X, Tensor cos_cache, Te Object result = OnnxInterpreter.interpret(OnnxOps.RotaryEmbedding.class, List.of(X, cos_cache, sin_cache, position_ids), List.of(num_heads, rotary_embedding_dim, interleaved)); return (Tensor) result; } - - /// + + /// /// Round takes one input Tensor and rounds the values, element-wise, meaning /// it finds the nearest integer for each value. /// In case of halves, the rule is to round them to the nearest even integer. /// If input x is integral, +0, -0, NaN, or infinite, x itself is returned. /// The output tensor has the same shape and type as the input. - /// + /// /// Examples: /// ``` /// round([0.9]) = [1.0] @@ -3358,61 +3358,61 @@ public static Tensor Round(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Round.class, List.of(X), List.of()); return (Tensor) result; } - + /// Computes the Short-time Fourier Transform of the signal. public static Tensor STFT(Tensor signal, Tensor frame_step, Optional> window, Optional> frame_length, Optional onesided) { Object result = OnnxInterpreter.interpret(OnnxOps.STFT.class, List.of(signal, frame_step, window, frame_length), List.of(onesided)); return (Tensor) result; } - + public record SVMClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// Support Vector Machine classifier public static SVMClassifierResult SVMClassifier(Tensor X, Optional prob_b, Optional kernel_params, Optional kernel_type, Optional classlabels_ints, Optional post_transform, Optional rho, Optional coefficients, Optional support_vectors, Optional vectors_per_class, Optional prob_a, Optional classlabels_strings) { Object result = OnnxInterpreter.interpret(OnnxOps.SVMClassifier.class, List.of(X), List.of(prob_b, kernel_params, kernel_type, classlabels_ints, post_transform, rho, coefficients, support_vectors, vectors_per_class, prob_a, classlabels_strings)); Object[] resultArray = (Object[]) result; return new SVMClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Support Vector Machine regression prediction and one-class SVM anomaly detection. public static Tensor SVMRegressor(Tensor X, Optional kernel_type, Optional kernel_params, Optional n_supports, Optional rho, Optional post_transform, Optional coefficients, Optional support_vectors, Optional one_class) { Object result = OnnxInterpreter.interpret(OnnxOps.SVMRegressor.class, List.of(X), List.of(kernel_type, kernel_params, n_supports, rho, post_transform, coefficients, support_vectors, one_class)); return (Tensor) result; } - - /// + + /// /// Rescale input data, for example to standardize features by removing the mean and scaling to unit variance. public static Tensor Scaler(Tensor X, Optional offset, Optional scale) { Object result = OnnxInterpreter.interpret(OnnxOps.Scaler.class, List.of(X), List.of(offset, scale)); return (Tensor) result; } - - /// + + /// /// This operator is deprecated. Please use ScatterElements, which provides the same functionality. - /// + /// /// Scatter takes three inputs `data`, `updates`, and `indices` of the same /// rank r >= 1 and an optional attribute axis that identifies an axis of `data` /// (by default, the outer-most axis, that is axis 0). The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value /// to values specified by `updates` at specific index positions specified by /// `indices`. Its output shape is the same as the shape of `data`. - /// + /// /// For each entry in `updates`, the target index in `data` is obtained by combining /// the corresponding entry in `indices` with the index of the entry itself: the /// index-value for dimension = axis is obtained from the value of the corresponding /// entry in `indices` and the index-value for dimension != axis is obtained from the /// index of the entry itself. - /// + /// /// For instance, in a 2-D tensor case, the update corresponding to the [i][j] entry /// is performed as below: /// ``` /// output[indices[i][j]][j] = updates[i][j] if axis = 0, /// output[i][indices[i][j]] = updates[i][j] if axis = 1, /// ``` - /// + /// /// This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation. - /// + /// /// Example 1: /// ``` /// data = [ @@ -3446,21 +3446,21 @@ public static Tensor Scatter(Tensor data, Tensor indices, Object result = OnnxInterpreter.interpret(OnnxOps.Scatter.class, List.of(data, indices, updates), List.of(axis)); return (Tensor) result; } - - /// + + /// /// ScatterElements takes three inputs `data`, `updates`, and `indices` of the same /// rank r >= 1 and an optional attribute axis that identifies an axis of `data` /// (by default, the outer-most axis, that is axis 0). The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value /// to values specified by `updates` at specific index positions specified by /// `indices`. Its output shape is the same as the shape of `data`. - /// + /// /// For each entry in `updates`, the target index in `data` is obtained by combining /// the corresponding entry in `indices` with the index of the entry itself: the /// index-value for dimension = axis is obtained from the value of the corresponding /// entry in `indices` and the index-value for dimension != axis is obtained from the /// index of the entry itself. - /// + /// /// `reduction` allows specification of an optional reduction operation, which is applied to all values in `updates` /// tensor into `output` at the specified `indices`. /// In cases where `reduction` is set to "none", indices should not have duplicate entries: that is, if idx1 != idx2, @@ -3476,11 +3476,11 @@ public static Tensor Scatter(Tensor data, Tensor indices, /// output[i][indices[i][j]] = f(output[i][indices[i][j]], updates[i][j]) if axis = 1, /// ``` /// where the `f` is `+`, `*`, `max` or `min` as specified. - /// + /// /// This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation. - /// + /// /// (Opset 18 change): Adds max/min to the set of allowed reduction ops. - /// + /// /// Example 1: /// ``` /// data = [ @@ -3514,21 +3514,21 @@ public static Tensor ScatterElements(Tensor data, Tensor i Object result = OnnxInterpreter.interpret(OnnxOps.ScatterElements.class, List.of(data, indices, updates), List.of(reduction, axis)); return (Tensor) result; } - - /// + + /// /// ScatterND takes three inputs `data` tensor of rank r >= 1, `indices` tensor of rank q >= 1, /// and `updates` tensor of rank q + r - indices.shape[-1] - 1. The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value to values /// specified by `updates` at specific index positions specified by `indices`. Its output shape /// is the same as the shape of `data`. - /// + /// /// `indices` is an integer tensor. Let k denote indices.shape[-1], the last dimension in the shape of `indices`. /// `indices` is treated as a (q-1)-dimensional tensor of k-tuples, where each k-tuple is a partial-index into `data`. /// Hence, k can be a value at most the rank of `data`. When k equals rank(data), each update entry specifies an /// update to a single element of the tensor. When k is less than rank(data) each update entry specifies an /// update to a slice of the tensor. Index values are allowed to be negative, as per the usual /// convention for counting backwards from the end, but are expected in the valid range. - /// + /// /// `updates` is treated as a (q-1)-dimensional tensor of replacement-slice-values. Thus, the /// first (q-1) dimensions of updates.shape must match the first (q-1) dimensions of indices.shape. /// The remaining dimensions of `updates` correspond to the dimensions of the @@ -3536,39 +3536,39 @@ public static Tensor ScatterElements(Tensor data, Tensor i /// corresponding to the trailing (r-k) dimensions of `data`. Thus, the shape of `updates` /// must equal indices.shape[0:q-1] ++ data.shape[k:r-1], where ++ denotes the concatenation /// of shapes. - /// + /// /// The `output` is calculated via the following equation: - /// + /// /// ``` /// output = np.copy(data) /// update_indices = indices.shape[:-1] /// for idx in np.ndindex(update_indices): /// output[tuple(indices[idx])] = updates[idx] /// ``` - /// + /// /// The order of iteration in the above loop is not specified. /// In particular, indices should not have duplicate entries: that is, if idx1 != idx2, then indices[idx1] != indices[idx2]. /// This ensures that the output value does not depend on the iteration order. - /// + /// /// `reduction` allows specification of an optional reduction operation, which is applied to all values in `updates` /// tensor into `output` at the specified `indices`. /// In cases where `reduction` is set to "none", indices should not have duplicate entries: that is, if idx1 != idx2, /// then indices[idx1] != indices[idx2]. This ensures that the output value does not depend on the iteration order. /// When `reduction` is set to some reduction function `f`, `output` is calculated as follows: - /// + /// /// ``` /// output = np.copy(data) /// update_indices = indices.shape[:-1] /// for idx in np.ndindex(update_indices): /// output[tuple(indices[idx])] = f(output[tuple(indices[idx])], updates[idx]) /// ``` - /// + /// /// where the `f` is `+`, `*`, `max` or `min` as specified. - /// + /// /// This operator is the inverse of GatherND. - /// + /// /// (Opset 18 change): Adds max/min to the set of allowed reduction ops. - /// + /// /// Example 1: /// ``` /// data = [1, 2, 3, 4, 5, 6, 7, 8] @@ -3576,7 +3576,7 @@ public static Tensor ScatterElements(Tensor data, Tensor i /// updates = [9, 10, 11, 12] /// output = [1, 11, 3, 10, 9, 6, 7, 12] /// ``` - /// + /// /// Example 2: /// ``` /// data = [[[1, 2, 3, 4], [5, 6, 7, 8], [8, 7, 6, 5], [4, 3, 2, 1]], @@ -3595,8 +3595,8 @@ public static Tensor ScatterND(Tensor data, Tensor indices, Tens Object result = OnnxInterpreter.interpret(OnnxOps.ScatterND.class, List.of(data, indices, updates), List.of(reduction)); return (Tensor) result; } - - /// + + /// /// Selu takes one input data (Tensor) and produces one output data /// (Tensor) where the scaled exponential linear unit function, /// `y = gamma * (alpha * e^x - alpha) for x <= 0`, `y = gamma * x for x > 0`, @@ -3605,8 +3605,8 @@ public static Tensor Selu(Tensor X, Optional alpha, Optional) result; } - - /// + + /// /// Outputs a tensor copy from the tensor at 'position' in 'input_sequence'. /// Accepted range for 'position' is in `[-n, n - 1]`, where `n` is the number of tensors in 'input_sequence'. /// Negative value means counting positions from the back. @@ -3614,23 +3614,23 @@ public static Tensor SequenceAt(List> input_sequence, Ten Object result = OnnxInterpreter.interpret(OnnxOps.SequenceAt.class, List.of(input_sequence, position), List.of()); return (Tensor) result; } - - /// + + /// /// Construct a tensor sequence containing 'inputs' tensors. /// All tensors in 'inputs' must have the same data type. public static List> SequenceConstruct(List> inputs) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceConstruct.class, List.of(inputs), List.of()); return (List>) result; } - - /// + + /// /// Construct an empty tensor sequence, with given data type. public static List> SequenceEmpty(Optional dtype) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceEmpty.class, List.of(), List.of(dtype)); return (List>) result; } - - /// + + /// /// Outputs a tensor sequence that removes the tensor at 'position' from 'input_sequence'. /// Accepted range for 'position' is in `[-n, n - 1]`, where `n` is the number of tensors in 'input_sequence'. /// Negative value means counting positions from the back. @@ -3639,8 +3639,8 @@ public static List> SequenceErase(List> input_sequenc Object result = OnnxInterpreter.interpret(OnnxOps.SequenceErase.class, List.of(input_sequence, position), List.of()); return (List>) result; } - - /// + + /// /// Outputs a tensor sequence that inserts 'tensor' into 'input_sequence' at 'position'. /// 'tensor' must have the same data type as 'input_sequence'. /// Accepted range for 'position' is in `[-n, n]`, where `n` is the number of tensors in 'input_sequence'. @@ -3650,15 +3650,15 @@ public static List> SequenceInsert(List> input_seq Object result = OnnxInterpreter.interpret(OnnxOps.SequenceInsert.class, List.of(input_sequence, tensor, position), List.of()); return (List>) result; } - - /// + + /// /// Produces a scalar(tensor of empty shape) containing the number of tensors in 'input_sequence'. public static Tensor SequenceLength(List> input_sequence) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceLength.class, List.of(input_sequence), List.of()); return (Tensor) result; } - - /// + + /// /// Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor. /// Optional attributes start and end can be used to compute a slice of the input tensor's shape. /// If start axis is omitted, the slice starts from axis 0. @@ -3670,27 +3670,27 @@ public static Tensor SequenceLength(List> input_sequence) { /// negative axis). Thus, specifying any end value > r is equivalent to specifying an end /// value of r, and specifying any start value < -r is equivalent to specifying a start /// value of 0. If start > end, the result will be an empty shape. - /// + /// /// Examples: - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// No attributes specified. /// Output: [2, 3, 4] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// start: -1 /// Output: [4] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// end: -1 /// Output: [2, 3] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// start: 1 @@ -3701,8 +3701,8 @@ public static Tensor Shape(Tensor data, Optional start, Optio Object result = OnnxInterpreter.interpret(OnnxOps.Shape.class, List.of(data), List.of(start, end)); return (Tensor) result; } - - /// + + /// /// Shrink takes one input data (Tensor) and produces one Tensor output, /// having same datatype and shape with input. It has two attributes, lambd and /// bias. The formula of this operator is: If x < -lambd, y = x + bias; @@ -3711,8 +3711,8 @@ public static Tensor Shrink(Tensor input, Optional lambd, Optio Object result = OnnxInterpreter.interpret(OnnxOps.Shrink.class, List.of(input), List.of(lambd, bias)); return (Tensor) result; } - - /// + + /// /// Sigmoid takes one input data (Tensor) and produces one output data /// (Tensor) where the sigmoid function, y = 1 / (1 + exp(-x)), is applied to the /// tensor elementwise. @@ -3720,72 +3720,72 @@ public static Tensor Sigmoid(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Sigmoid.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Calculate the sign of the given input tensor element-wise. /// If input > 0, output 1. if input < 0, output -1. if input == 0, output 0. public static Tensor Sign(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sign.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the sine of the given input tensor, element-wise. public static Tensor Sin(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sin.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic sine of the given input tensor element-wise. public static Tensor Sinh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sinh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Takes a tensor as input and outputs a int64 scalar that equals to the total number of elements of the input tensor. public static Tensor Size(Tensor data) { Object result = OnnxInterpreter.interpret(OnnxOps.Size.class, List.of(data), List.of()); return (Tensor) result; } - - /// + + /// /// Produces a slice of the input tensor along multiple axes. Similar to numpy: /// https://numpy.org/doc/stable/user/basics.indexing.html?highlight=slice#slicing-and-striding - /// + /// /// Slice uses the `starts`, `ends`, `axes` and `steps` inputs to select a sub-tensor /// of its input `data` tensor. - /// + /// /// An effective `starts[i]`, `ends[i]`, and `steps[i]` must be computed for each `i` /// in `[0, ... r-1]` where `r = rank(input)` as follows: - /// + /// /// If `axes` are omitted, they are set to `[0, ..., r-1]`. /// If `steps` are omitted, they are set to `[1, ..., 1]` of length `len(starts)` - /// + /// /// The effective values are initialized as `start[i] = 0`, `ends[i] = dims[i]` where /// `dims` are the dimensions of `input` and `steps[i] = 1`. - /// + /// /// All negative elements of `axes` are made non-negative by adding `r` to them, where /// `r =rank(input)`. - /// + /// /// All negative values in `starts[i]` and `ends[i]` have `dims[axes[i]]` added to them, /// where `dims` are the dimensions of `input`. Then `start[axes[i]]` is the adjusted /// `starts[i]` is clamped into the range `[0, dims[axes[i]]]` for positive stepping /// and `[0, dims[axes[i]]-1]` for negative stepping. - /// + /// /// The clamping for the adjusted `ends[i]` depends on the sign of `steps[i]` and must /// accommodate copying 0 through `dims[axes[i]]` elements, so for positive stepping /// `ends[axes[i]]` is clamped to `[0, dims[axes[i]]]`, while for negative stepping it /// is clamped to `[-1, dims[axes[i]]-1]`. - /// + /// /// Finally, `steps[axes[i]] = steps[i]`. - /// + /// /// For slicing to the end of a dimension with unknown size, it is recommended to pass /// in `INT_MAX` when slicing forward and 'INT_MIN' when slicing backward. - /// + /// /// Example 1: - /// + /// /// ``` /// data = [ /// [1, 2, 3, 4], @@ -3799,9 +3799,9 @@ public static Tensor Size(Tensor data) { /// [5, 7], /// ] /// ``` - /// + /// /// Example 2: - /// + /// /// ``` /// data = [ /// [1, 2, 3, 4], @@ -3817,12 +3817,12 @@ public static Tensor Slice(Tensor data, Tensor starts, Ten Object result = OnnxInterpreter.interpret(OnnxOps.Slice.class, List.of(data, starts, ends, axes, steps), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the normalized exponential values for the given input: - /// - /// Softmax(input, axis) = Exp(input) / ReduceSum(Exp(input), axis=axis, keepdims=1) - /// + /// + /// Softmax(input, axis) = Exp(input) / ReduceSum(Exp(input), axis=axis, keepdims=1) + /// /// The "axis" attribute indicates the dimension along which Softmax /// will be performed. The output tensor has the same shape /// and contains the Softmax values of the corresponding input. @@ -3830,7 +3830,7 @@ public static Tensor Softmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Softmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - + public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_prob) { } /// Loss function that measures the softmax cross entropy /// between 'scores' and 'labels'. @@ -3839,12 +3839,12 @@ public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_p /// If the input is N-D tensor with shape (N, C, D1, D2, ..., Dk), /// the loss tensor L may have (N, D1, D2, ..., Dk) as its shape and L[i,][j_1][j_2]...[j_k] denotes a scalar element in L. /// After L is available, this operator can optionally do a reduction operator. - /// + /// /// * shape(scores): (N, C) where C is the number of classes, or (N, C, D1, D2,..., Dk), /// with K >= 1 in case of K-dimensional loss. /// * shape(labels): (N) where each value is 0 <= labels[i] <= C-1, or (N, D1, D2,..., Dk), /// with K >= 1 in case of K-dimensional loss. - /// + /// /// The loss for one sample, l_i, can calculated as follows: /// ``` /// l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk], where i is the index of classes. @@ -3853,21 +3853,21 @@ public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_p /// ``` /// l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk] * weights[c], if 'weights' is provided. /// ``` - /// + /// /// loss is zero for the case when label-value equals ignore_index. /// ``` /// l[i][d1][d2]...[dk] = 0, when labels[n][d1][d2]...[dk] = ignore_index /// ``` - /// + /// /// where: /// ``` /// p = Softmax(scores) /// y = Log(p) /// c = labels[i][d1][d2]...[dk] /// ``` - /// + /// /// Finally, L is optionally reduced: - /// + /// /// * If reduction = 'none', the output is L with shape (N, D1, D2, ..., Dk). /// * If reduction = 'sum', the output is scalar: Sum(L). /// * If reduction = 'mean', the output is scalar: ReduceMean(L), or if weight is provided: `ReduceSum(L) / ReduceSum(W)`, @@ -3877,8 +3877,8 @@ public static SoftmaxCrossEntropyLossResult SoftmaxCrossEntropyLoss Object[] resultArray = (Object[]) result; return new SoftmaxCrossEntropyLossResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Softplus takes one input data (Tensor) and produces one output data /// (Tensor) where the softplus function, y = ln(exp(x) + 1), is applied to /// the tensor elementwise. @@ -3886,14 +3886,14 @@ public static Tensor Softplus(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Softplus.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the softsign (x/(1+|x|)) of the given input tensor element-wise. public static Tensor Softsign(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Softsign.class, List.of(input), List.of()); return (Tensor) result; } - + /// SpaceToDepth rearranges blocks of spatial data into depth. More specifically, /// this op outputs a copy of the input tensor where values from the height and width dimensions /// are moved to the depth dimension. @@ -3901,7 +3901,7 @@ public static Tensor SpaceToDepth(Tensor input, long blocksize) { Object result = OnnxInterpreter.interpret(OnnxOps.SpaceToDepth.class, List.of(input), List.of(blocksize)); return (Tensor) result; } - + /// Split a tensor into a list of tensors, along the specified 'axis'. /// Either input 'split' or the attribute 'num_outputs' should be specified, but not both. /// If the attribute 'num_outputs' is specified, then the tensor is split into equal sized parts. @@ -3911,8 +3911,8 @@ public static List> Split(Tensor input, Optional> Object result = OnnxInterpreter.interpret(OnnxOps.Split.class, List.of(input, split), List.of(num_outputs, axis)); return (List>) result; } - - /// + + /// /// Split a tensor into a sequence of tensors, along the specified 'axis'. /// Lengths of the parts can be specified using the optional argument 'split'. /// If the argument `split' is not specified, a default scalar value of 1 @@ -3929,8 +3929,8 @@ public static List> SplitToSequence(Tensor input, Optiona Object result = OnnxInterpreter.interpret(OnnxOps.SplitToSequence.class, List.of(input, split), List.of(keepdims, axis)); return (List>) result; } - - /// + + /// /// Square root takes one input data (Tensor) and produces one output data /// (Tensor) where the square root is, y = x^0.5, is applied to /// the tensor elementwise. If x is negative, then it will return NaN. @@ -3938,8 +3938,8 @@ public static Tensor Sqrt(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Sqrt.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Remove single-dimensional entries from the shape of a tensor. /// Takes an input `axes` with a list of axes to squeeze. /// If `axes` is not provided, all the single dimensions will be removed from @@ -3948,14 +3948,14 @@ public static Tensor Squeeze(Tensor data, Optional> axes) Object result = OnnxInterpreter.interpret(OnnxOps.Squeeze.class, List.of(data, axes), List.of()); return (Tensor) result; } - + /// StringConcat concatenates string tensors elementwise (with NumPy-style broadcasting support) public static Tensor StringConcat(Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.StringConcat.class, List.of(X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// StringNormalization performs string operations for basic cleaning. /// This operator has only one input (denoted by X) and only one output /// (denoted by Y). This operator first examines the elements in the X, @@ -3969,31 +3969,31 @@ public static Tensor StringNormalizer(Tensor X, Optional i Object result = OnnxInterpreter.interpret(OnnxOps.StringNormalizer.class, List.of(X), List.of(is_case_sensitive, locale, stopwords, case_change_action)); return (Tensor) result; } - + public record StringSplitResult(Tensor Y, Tensor Z) { } /// StringSplit splits a string tensor's elements into substrings based on a delimiter attribute and a maxsplit attribute. - /// + /// /// The first output of this operator is a tensor of strings representing the substrings from splitting each input string on the `delimiter` substring. This tensor has one additional rank compared to the input tensor in order to store the substrings for each input element (where the input tensor is not empty). Note that, in order to ensure the same number of elements are present in the final dimension, this tensor will pad empty strings as illustrated in the examples below. Consecutive delimiters are not grouped together and are deemed to delimit empty strings, except if the `delimiter` is unspecified or is the empty string (""). In the case where the `delimiter` is unspecified or the empty string, consecutive whitespace characters are regarded as a single separator and leading or trailing whitespace is removed in the output. - /// + /// /// The second output tensor represents the number of substrings generated. `maxsplit` can be used to limit the number of splits performed - after the `maxsplit`th split if the string is not fully split, the trailing suffix of input string after the final split point is also added. For elements where fewer splits are possible than specified in `maxsplit`, it has no effect. public static StringSplitResult StringSplit(Tensor X, Optional delimiter, Optional maxsplit) { Object result = OnnxInterpreter.interpret(OnnxOps.StringSplit.class, List.of(X), List.of(delimiter, maxsplit)); Object[] resultArray = (Object[]) result; return new StringSplitResult((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Performs element-wise binary subtraction (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Sub(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Sub.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Element-wise sum of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -4001,42 +4001,42 @@ public static Tensor Sum(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Sum.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// Swish function takes one input data (Tensor) and produces one output data (Tensor) of the same shape, /// where $Swish(x) = x * sigmoid(alpha * x)$. public static Tensor Swish(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.Swish.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Calculates the tangent of the given input tensor, element-wise. public static Tensor Tan(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Tan.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic tangent of the given input tensor element-wise. public static Tensor Tanh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Tanh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// TensorScatter is a generic tensor update operation, motivated by the requirements for KV cache updates for Attention /// ops commonly found in LLMs. It is a functional operation that models an in-place update to a KV cache buffer. - /// + /// /// The past and present cache tensors have the same shape (batch_size, D1, D2, ..., max_sequence_length, ..., Dn), with /// the sequence dimension (indicated by the `axis` attribute) being max_sequence_length, so the sizes of these tensors do /// not need to grow between iterations. The `update` tensor's shape only differs from the cache tensors in the sequence /// dimension: (batch_size, D1, D2, ..., sequence_length, ..., Dn), where sequence_length <= max_sequence_length. - /// + /// /// The optional `write_indices` input indicates the write index for each sample in the batch, assumed to be zero /// if not provided. When the `mode` attribute is set to "circular", the write index is modulo max_sequence_length. /// The operation can be described using the following pseudocode: - /// + /// /// ``` /// for prefix_idx in np.ndindex(past_cache.shape[:axis]): /// batch_idx = prefix_idx[0] @@ -4047,7 +4047,7 @@ public static Tensor Tanh(Tensor input) { /// update_idx = (*prefix_idx, sequence_idx) /// present_cache[cache_idx] = update[update_idx] /// ``` - /// + /// /// During the prefill phase of attention, only the first two inputs are needed. During the decode phase, `write_indices` /// is also needed so that the incoming key or value update can be appended after the last valid token for each sample /// in the batch. @@ -4055,14 +4055,14 @@ public static Tensor TensorScatter(Tensor past_cache, Tensor update Object result = OnnxInterpreter.interpret(OnnxOps.TensorScatter.class, List.of(past_cache, update, write_indices), List.of(mode, axis)); return (Tensor) result; } - - /// + + /// /// This transform extracts n-grams from the input sequence and save them as a vector. Input can /// be either a 1-D or 2-D tensor. For 1-D input, output is the n-gram representation of that input. /// For 2-D input, the output is also a 2-D tensor whose i-th row is the n-gram representation of the i-th input row. /// More specifically, if input shape is [C], the corresponding output shape would be [max(ngram_indexes) + 1]. /// If input shape is [N, C], this operator produces a [N, max(ngram_indexes) + 1]-tensor. - /// + /// /// In contrast to standard n-gram extraction, here, the indexes of extracting an n-gram from the original /// sequence are not necessarily consecutive numbers. The discontinuity between indexes are controlled by the number of skips. /// If the number of skips is 2, we should skip two tokens when scanning through the original sequence. @@ -4070,26 +4070,26 @@ public static Tensor TensorScatter(Tensor past_cache, Tensor update /// The associated 2-grams are [94, 12] and [17, 28] respectively indexed by [0, 3] and [1, 4]. /// If the number of skips becomes 0, the 2-grams generated are [94, 17], [17, 36], [36, 12], [12, 28] /// indexed by [0, 1], [1, 2], [2, 3], [3, 4], respectively. - /// + /// /// The output vector (denoted by Y) stores the count of each n-gram; /// Y[ngram_indexes[i]] indicates the times that the i-th n-gram is found. The attribute ngram_indexes is used to determine the mapping /// between index i and the corresponding n-gram's output coordinate. If pool_int64s is [94, 17, 17, 36], ngram_indexes is [1, 0], /// ngram_counts=[0, 0], then the Y[0] (first element in Y) and Y[1] (second element in Y) are the counts of [17, 36] and [94, 17], /// respectively. An n-gram which cannot be found in pool_strings/pool_int64s should be ignored and has no effect on the output. /// Note that we may consider all skips up to S when generating the n-grams. - /// + /// /// The examples used above are true if mode is "TF". If mode is "IDF", all the counts larger than 1 would be truncated to 1 and /// the i-th element in weights would be used to scale (by multiplication) the count of the i-th n-gram in pool. If mode is "TFIDF", /// this operator first computes the counts of all n-grams and then scale them by the associated values in the weights attribute. - /// + /// /// Only one of pool_strings and pool_int64s can be set. If pool_int64s is set, the input should be an integer tensor. /// If pool_strings is set, the input must be a string tensor. public static Tensor TfIdfVectorizer(Tensor X, long[] ngram_counts, long min_gram_length, Optional pool_strings, String mode, long max_gram_length, long max_skip_count, Optional pool_int64s, Optional weights, long[] ngram_indexes) { Object result = OnnxInterpreter.interpret(OnnxOps.TfIdfVectorizer.class, List.of(X), List.of(ngram_counts, min_gram_length, pool_strings, mode, max_gram_length, max_skip_count, pool_int64s, weights, ngram_indexes)); return (Tensor) result; } - - /// + + /// /// ThresholdedRelu takes one input data (Tensor) and produces one output data /// (Tensor) where the rectified linear function, y = x for x > alpha, y = 0 otherwise, /// is applied to the tensor elementwise. @@ -4097,7 +4097,7 @@ public static Tensor ThresholdedRelu(Tensor X, Optional alpha) Object result = OnnxInterpreter.interpret(OnnxOps.ThresholdedRelu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - + /// Constructs a tensor by tiling a given tensor. /// This is the same as function `tile` in Numpy, but no broadcast. /// For example A = [[1, 2], [3, 4]], B = [1, 2], tile(A, B) = [[1, 2, 1, 2], [3, 4, 3, 4]] @@ -4105,22 +4105,22 @@ public static Tensor Tile(Tensor input, Tensor repeats) { Object result = OnnxInterpreter.interpret(OnnxOps.Tile.class, List.of(input, repeats), List.of()); return (Tensor) result; } - + public record TopKResult(Tensor Values, Tensor Indices) { } - /// + /// /// Retrieve the top-K largest or smallest elements along a specified axis. Given an input tensor of /// shape [a_0, a_1, ..., a_{n-1}] and integer argument k, return two outputs: - /// + /// /// * Value tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}] /// which contains the values of the top k elements along the specified axis /// * Index tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}] which /// contains the indices of the top k elements (original indices from the input /// tensor). - /// + /// /// * If "largest" is 1 (the default value) then the k largest elements are returned. /// * If "sorted" is 1 (the default value) then the resulting k elements will be sorted. /// * If "sorted" is 0, order of returned 'Values' and 'Indices' are undefined. - /// + /// /// Given two equivalent values, this operator uses the indices along the axis as /// a tiebreaker. That is, the element with the lower index will appear first. public static TopKResult TopK(Tensor X, Tensor K, Optional largest, Optional sorted, Optional axis) { @@ -4128,8 +4128,8 @@ public static TopKResult TopK(Tensor X, Tensor K, Optional Object[] resultArray = (Object[]) result; return new TopKResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Returns a transpose of the input tensor. (Similar to `numpy.transpose`). /// The optional attribute `perm` must be a permutation of the dimensions of /// the input tensor. Axis `i` of the output tensor corresponds to the axis @@ -4144,17 +4144,17 @@ public static Tensor Transpose(Tensor data, Optional perm) { Object result = OnnxInterpreter.interpret(OnnxOps.Transpose.class, List.of(data), List.of(perm)); return (Tensor) result; } - - /// + + /// /// Tree Ensemble operator. Returns the regressed values for each input in a batch. /// Inputs have dimensions `[N, F]` where `N` is the input batch size and `F` is the number of input features. /// Outputs have dimensions `[N, num_targets]` where `N` is the batch size and `num_targets` is the number of targets, which is a configurable attribute. - /// + /// /// The encoding of this attribute is split along interior nodes and the leaves of the trees. Notably, attributes with the prefix `nodes_*` are associated with interior nodes, and attributes with the prefix `leaf_*` are associated with leaves. /// The attributes `nodes_*` must all have the same length and encode a sequence of tuples, as defined by taking all the `nodes_*` fields at a given position. - /// + /// /// All fields prefixed with `leaf_*` represent tree leaves, and similarly define tuples of leaves and must have identical length. - /// + /// /// This operator can be used to implement both the previous `TreeEnsembleRegressor` and `TreeEnsembleClassifier` nodes. /// The `TreeEnsembleRegressor` node maps directly to this node and requires changing how the nodes are represented. /// The `TreeEnsembleClassifier` node can be implemented by adding a `ArgMax` node after this node to determine the top class. @@ -4163,9 +4163,9 @@ public static Tensor TreeEnsemble(Tensor X, Optional aggregate_f Object result = OnnxInterpreter.interpret(OnnxOps.TreeEnsemble.class, List.of(X), List.of(aggregate_function, nodes_hitrates, nodes_featureids, nodes_falseleafs, post_transform, nodes_trueleafs, nodes_modes, nodes_falsenodeids, nodes_truenodeids, leaf_weights, leaf_targetids, tree_roots, n_targets, nodes_missing_value_tracks_true, membership_values, nodes_splits)); return (Tensor) result; } - + public record TreeEnsembleClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// This operator is DEPRECATED. Please use TreeEnsemble with provides similar functionality. /// In order to determine the top class, the ArgMax node can be applied to the output of TreeEnsemble. /// To encode class labels, use a LabelEncoder operator. @@ -4185,8 +4185,8 @@ public static TreeEnsembleClassifierResult TreeEnsembleClassifier(T Object[] resultArray = (Object[]) result; return new TreeEnsembleClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// This operator is DEPRECATED. Please use TreeEnsemble instead which provides the same /// functionality.
/// Tree Ensemble regressor. Returns the regressed values for each input in N.
@@ -4205,8 +4205,8 @@ public static Tensor TreeEnsembleRegressor(Tensor X, Optional) result; } - - /// + + /// /// Given a 2-D matrix or batches of 2-D matrices, returns the upper or lower triangular part of the tensor(s). /// The attribute "upper" determines whether the upper or lower part is retained. If set to true, /// the upper triangular matrix is retained. Lower triangular matrix is retained otherwise. @@ -4223,22 +4223,22 @@ public static Tensor Trilu(Tensor input, Optional> k, Opt Object result = OnnxInterpreter.interpret(OnnxOps.Trilu.class, List.of(input, k), List.of(upper)); return (Tensor) result; } - + public record UniqueResult(Tensor Y, Tensor indices, Tensor inverse_indices, Tensor counts) { } - /// + /// /// Find the unique elements of a tensor. When an optional attribute 'axis' is provided, unique subtensors sliced along the 'axis' are returned. /// Otherwise the input tensor is flattened and unique values of the flattened tensor are returned. - /// + /// /// This operator returns the unique values or sliced unique subtensors of the input tensor and three optional outputs. /// The first output tensor 'Y' contains all unique values or subtensors of the input. /// The second optional output tensor 'indices' contains indices of 'Y' elements' first occurrence in 'X'. /// The third optional output tensor 'inverse_indices' contains, for elements of 'X', its corresponding indices in 'Y'. /// The fourth optional output tensor 'counts' contains the count of each element of 'Y' in the input. - /// + /// /// Outputs are either sorted in ascending order or optionally in the order of the first occurrence of the values in the input. - /// + /// /// https://docs.scipy.org/doc/numpy/reference/generated/numpy.unique.html - /// + /// /// Example 1: /// ``` /// input_X = [2, 1, 1, 3, 4, 3] @@ -4249,7 +4249,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 1, 1, 2, 3, 2] /// output_counts = [1, 2, 2, 1] /// ``` - /// + /// /// Example 2: /// ``` /// input_X = [[1, 3], [2, 3]] @@ -4260,7 +4260,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 2, 1, 2] /// output_counts = [1, 1, 2] /// ``` - /// + /// /// Example 3: /// ``` /// input_X = [[1, 0, 0], [1, 0, 0], [2, 3, 4]] @@ -4271,7 +4271,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 0, 1] /// output_counts = [2, 1] /// ``` - /// + /// /// Example 4: /// ``` /// input_x = [[[1., 1.], [0., 1.], [2., 1.], [0., 1.]], @@ -4279,7 +4279,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// attribute_sorted = 1 /// attribute_axis = 1 /// ``` - /// + /// /// intermediate data are presented below for better understanding: /// there are 4 subtensors sliced along axis 1 of input_x (shape = (2, 4, 2)): /// ``` @@ -4288,37 +4288,37 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// [[2, 1], [2, 1]], /// [[0, 1], [0, 1]]. /// ``` - /// + /// /// there are 3 unique subtensors: /// ``` /// [[1, 1], [1, 1]], /// [[0, 1], [0, 1]], /// [[2, 1], [2, 1]]. /// ``` - /// + /// /// sorted unique subtensors: /// ``` /// B: [[0, 1], [0, 1]], /// [[1, 1], [1, 1]], /// [[2, 1], [2, 1]]. /// ``` - /// + /// /// output_Y is constructed from B: /// ``` /// [[[0. 1.], [1. 1.], [2. 1.]], /// [[0. 1.], [1. 1.], [2. 1.]]] /// ``` - /// + /// /// output_indices is to map from B to A: /// ``` /// [1, 0, 2] /// ``` - /// + /// /// output_inverse_indices is to map from A to B: /// ``` /// [1, 0, 2, 0] /// ``` - /// + /// /// output_counts: /// ``` /// [2, 1, 1] @@ -4328,14 +4328,14 @@ public static UniqueResult Unique(Tensor X, Optional sorted, Opt Object[] resultArray = (Object[]) result; return new UniqueResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2], (Tensor)resultArray[3]); } - - /// + + /// /// Insert single-dimensional entries to the shape of an input tensor (`data`). /// Takes one required input `axes` - which contains a list of dimension indices and this operator will insert a dimension of value `1` into the corresponding index of the output tensor (`expanded`). - /// + /// /// For example, given an input tensor (`data`) of shape [3, 4, 5], then /// Unsqueeze(data, axes=[0, 4]) outputs a tensor (`expanded`) containing same data as `data` but with shape [1, 3, 4, 5, 1]. - /// + /// /// The input `axes` should not contain any duplicate entries. It is an error if it contains duplicates. /// The rank of the output tensor (`output_rank`) is the rank of the input tensor (`data`) plus the number of values in `axes`. /// Each value in `axes` should be within the (inclusive) range [-output_rank , output_rank - 1]. @@ -4344,8 +4344,8 @@ public static Tensor Unsqueeze(Tensor data, Tensor axes) { Object result = OnnxInterpreter.interpret(OnnxOps.Unsqueeze.class, List.of(data, axes), List.of()); return (Tensor) result; } - - /// + + /// /// Upsample the input tensor. /// Each dimension value of the output tensor is: /// output_dimension = floor(input_dimension * scale). @@ -4353,30 +4353,30 @@ public static Tensor Upsample(Tensor X, Tensor scales, Optional Object result = OnnxInterpreter.interpret(OnnxOps.Upsample.class, List.of(X, scales), List.of(mode)); return (Tensor) result; } - - /// + + /// /// Return elements, either from X or Y, depending on condition. /// Where behaves like /// [numpy.where](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html) /// with three parameters. - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Where(Tensor condition, Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.Where.class, List.of(condition, X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `xor` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Xor(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Xor.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Creates a map from the input and the attributes.
/// The values are provided by the input tensor, while the keys are specified by the attributes. /// Must provide keys in either classlabels_strings or classlabels_int64s (but not both).
@@ -4385,5 +4385,5 @@ public static List> ZipMap(Tensor X, Optional c Object result = OnnxInterpreter.interpret(OnnxOps.ZipMap.class, List.of(X), List.of(classlabels_int64s, classlabels_strings)); return (List>) result; } - + } diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxProtoBuilder.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxProtoBuilder.java index 290258f57fc..8d5890d710c 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxProtoBuilder.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxProtoBuilder.java @@ -38,7 +38,6 @@ import jdk.incubator.code.dialect.java.JavaOp; import jdk.incubator.code.dialect.java.JavaType; import jdk.incubator.code.extern.OpWriter; -import oracle.code.onnx.compiler.OnnxTransformer.OnnxValueInfo; import oracle.code.onnx.ir.OnnxOp; import oracle.code.onnx.ir.OnnxOps; import oracle.code.onnx.ir.OnnxType; @@ -118,23 +117,15 @@ void mapTupleElements(Value tuple, List elements) { } } + public static byte[] buildModel(String domain, CoreOp.ModuleOp module, List initializers) { + return buildModel(domain, module, initializers, Map.of(), _ -> null); + } + public record ExternalTensorDataInfo(String location, long offset, long length) { } - public static byte[] buildModel(String domain, CoreOp.ModuleOp module, List initializers, Map valueInfo, Function tensorDataExternalizer) { - var explicitValueNames = new HashMap(); - valueInfo.forEach((value, info) -> { - if (info.name() != null) { - explicitValueNames.put(value, info.name()); - } - }); + public static byte[] buildModel(String domain, CoreOp.ModuleOp module, List initializers, Map explicitValueNames, Function tensorDataExternalizer) { var indexer = new Indexer(module, explicitValueNames); - var valueShapes = new HashMap(); - valueInfo.forEach((value, info) -> { - if (info.shape() != null) { - valueShapes.put(info.name() != null ? info.name() : indexer.nameOf(value), info.shape()); - } - }); var functions = new ArrayList<>(module.functionTable().sequencedValues()); var imports = new ArrayList(); @@ -154,15 +145,14 @@ public static byte[] buildModel(String domain, CoreOp.ModuleOp module, List function(domain, imports, f.funcName(), - expandTuples(indexer, f.parameters()), - expandTuples(indexer, f.body().entryBlock().terminatingOp().operands()), - nodes(domain, indexer, f.body().entryBlock().ops(), valueShapes, Map.of()))).toList()); - return model; + expandTuples(indexer, f.parameters()), + expandTuples(indexer, f.body().entryBlock().terminatingOp().operands()), + nodes(domain, indexer, f.body().entryBlock().ops()))).toList()); } // @@@ unchecked constraints: @@ -188,7 +178,7 @@ static byte[] buildModel(GraphProto graph, List imports, List m.opsetImport(new OperatorSetIdProto().domain(d).version(1))) - .forEach(functions, ModelProto::functions) + .forEach(functions, (m, f) -> m.functions(f)) .graph(graph) .getBytes(); } @@ -216,87 +206,59 @@ static void expandTuples(Indexer indexer, List names, List tensorInfos(Indexer indexer, List values, Map valueShapes) { + static List tensorInfos(Indexer indexer, List values) { var infos = new ArrayList(); - tensorInfos(indexer, infos, values, valueShapes); + tensorInfos(indexer, infos, values); return infos; } - static void tensorInfos(Indexer indexer, List infos, List values, Map valueShapes) { - for (var v : values) { + private static void tensorInfos(Indexer indexer, ArrayList infos, List values) { + for (var v: values) { if (v instanceof Op.Result or && or.op() instanceof CoreOp.TupleOp op) { - tensorInfos(indexer, infos, op.operands(), valueShapes); - } else if (v instanceof Op.Result or && or.op() instanceof CoreOp.TupleLoadOp op) { - infos.add(tensorInfo(indexer.nameOf(op.operands().getFirst(), op.index()), v.type(), valueShapes)); + tensorInfos(indexer, infos, op.operands()); + } else if (v instanceof Op.Result or && or.op() instanceof CoreOp.TupleLoadOp top) { + infos.add(tensorInfo(indexer.nameOf(top.operands().getFirst(), top.index()), v.type())); } else if (v.type() instanceof TupleType tt) { var ct = tt.componentTypes(); for (int i = 0; i < ct.size(); i++) { - infos.add(tensorInfo(indexer.nameOf(v, i), ct.get(i), valueShapes)); + infos.add(tensorInfo(indexer.nameOf(v, i), ct.get(i))); } } else { - infos.add(tensorInfo(indexer.nameOf(v), v.type(), valueShapes)); + infos.add(tensorInfo(indexer.nameOf(v), v.type())); } } } - static GraphProto graph(String domain, String graphName, Indexer indexer, Block block, List initializers, int scalarArgs) { - return graph(domain, graphName, indexer, block, initializers, scalarArgs, _ -> null, Map.of(), Map.of()); + static GraphProto graph(String domain, String graphName, Indexer indexer, Block block, List initializers, int scalarArgs) { + return graph(domain, graphName, indexer, block, initializers, scalarArgs, _ -> null); } - static GraphProto graph(String domain, String graphName, Indexer indexer, Block block, List initializers, int scalarArgs, Function tensorDataExternalizer, Map valueShapes, Map valueInfo) { - valueShapes = new HashMap<>(valueShapes); + static GraphProto graph(String domain, String graphName, Indexer indexer, Block block, List initializers, int scalarArgs, Function tensorDataExternalizer) { var params = block.parameters(); params.forEach(indexer::nameOf); int firstInitializer = params.size() - initializers.size(); var args = params.subList(0, firstInitializer); - List graphInitializers = IntStream.range(0, initializers.size()).boxed().mapMulti((i, tps) -> { - Object val = initializers.get(i); - if (val instanceof Record) { - var rcs = val.getClass().getRecordComponents(); - for (int rci = 0; rci < rcs.length; rci++) - try { - tps.accept(tensorProto(indexer.nameOf(params.get(i + firstInitializer), rci), (Tensor) (rcs[rci].getAccessor().invoke(val)), tensorDataExternalizer)); - } catch (ReflectiveOperationException e) { - throw new IllegalArgumentException(e); - } - } else if (val instanceof Tensor[] tarr) { - for (int tai = 0; tai < tarr.length; tai++) { - tps.accept(tensorProto(indexer.nameOf(params.get(i + firstInitializer), tai), tarr[tai], tensorDataExternalizer)); - } - } else { - tps.accept(tensorProto(indexer.nameOf(params.get(i + firstInitializer)), (Tensor) val, tensorDataExternalizer)); - } - }).toList(); - List graphInputs = tensorInfos(indexer, args, scalarArgs, valueShapes); - List graphNodes = nodes(domain, indexer, block.ops(), valueShapes, valueInfo); - List graphOutputs = tensorInfos(indexer, block.terminatingOp().operands(), valueShapes); - var boundaryNames = new HashSet(); - boundaryNames.addAll(expandTuples(indexer, args)); - boundaryNames.addAll(expandTuples(indexer, block.terminatingOp().operands())); - var blockValues = blockValues(block); - var graphValueInfoNames = new HashSet(); - List graphValueInfos = valueInfo.entrySet().stream() - .filter(entry -> entry.getValue().shape() != null) - .filter(entry -> blockValues.contains(entry.getKey())) - .mapMulti((entry, infos) -> { - String name = entry.getValue().name() != null ? entry.getValue().name() : indexer.nameOf(entry.getKey()); - if (!boundaryNames.contains(name) && graphValueInfoNames.add(name)) { - infos.accept(tensorInfo(name, OnnxType.INT64.id(), shapeOf(entry.getValue().shape()))); + return graphWithOutputs(graphName, + IntStream.range(0, initializers.size()).boxed().mapMulti((i, tps) -> { + Object val = initializers.get(i); + if (val instanceof Record) { + var rcs = val.getClass().getRecordComponents(); + for (int rci = 0; rci < rcs.length; rci++) try { + tps.accept(tensorProto(indexer.nameOf(params.get(i + firstInitializer), rci), (Tensor)(rcs[rci].getAccessor().invoke(val)), tensorDataExternalizer)); + } catch (ReflectiveOperationException e) { + throw new IllegalArgumentException(e); + } + } else if (val instanceof Tensor[] tarr) { + for (int tai = 0; tai < tarr.length; tai++) { + tps.accept(tensorProto(indexer.nameOf(params.get(i + firstInitializer), tai), tarr[tai], tensorDataExternalizer)); + } + } else { + tps.accept(tensorProto(indexer.nameOf(params.get(i + firstInitializer)), (Tensor)val, tensorDataExternalizer)); } - }) - .toList(); - return graphWithOutputs(graphName, graphInitializers, graphInputs, graphNodes, graphValueInfos, graphOutputs); - } - - static Set blockValues(Block block) { - var values = new HashSet(); - values.addAll(block.parameters()); - block.ops().forEach(op -> { - if (op.result() != null) { - values.add(op.result()); - } - }); - return values; + }).toList(), + tensorInfos(indexer, args, scalarArgs), + nodes(domain, indexer, block.ops()), + tensorInfos(indexer, block.terminatingOp().operands())); } static List opInputNames(Indexer indexer, SequencedMap inputs) { @@ -304,48 +266,52 @@ static List opInputNames(Indexer indexer, SequencedMapmapMulti((v, dump) -> { switch (v) { case Value val -> dump.accept(indexer.nameOf(val)); - case Optional o when o.isPresent() && o.get() instanceof Value val -> - dump.accept(indexer.nameOf(val)); - case List l -> l.forEach(val -> dump.accept(indexer.nameOf((Value) val))); + case Optional o when o.isPresent() && o.get() instanceof Value val -> dump.accept(indexer.nameOf(val)); + case List l -> l.forEach(val -> dump.accept(indexer.nameOf((Value)val))); default -> dump.accept(""); // empty names for unused optional inputs } }).toList(); + // trim trailing empty names return inputNames.reversed().stream().dropWhile(String::isEmpty).toList().reversed(); } - static List nodes(String domain, Indexer indexer, List ops, Map valueShapes, Map valueInfo) { + static List nodes(String domain, Indexer indexer, List ops) { return ops.stream().mapMulti((op, opNodes) -> { switch (op) { - case OnnxOps.If ifOp -> opNodes.accept(node( - ifOp.schema().name(), - List.of(indexer.nameOf(ifOp.operands().getFirst())), - IntStream.range(0, ifOp.resultType() instanceof TupleType tt ? tt.componentTypes().size() : 1).mapToObj(o -> indexer.nameOf(ifOp.result(), o)).toList(), - java.util.Map.of( - "then_branch", graph(domain, null, indexer, ifOp.thenBranch().entryBlock(), List.of(), 0, _ -> null, valueShapes, Map.of()), - "else_branch", graph(domain, null, indexer, ifOp.elseBranch().entryBlock(), List.of(), 0, _ -> null, valueShapes, Map.of())))); + case OnnxOps.If ifOp -> + opNodes.accept(node( + ifOp.schema().name(), + List.of(indexer.nameOf(ifOp.operands().getFirst())), + IntStream.range(0, ifOp.resultType() instanceof TupleType tt ? tt.componentTypes().size() : 1).mapToObj(o -> indexer.nameOf(ifOp.result(), o)).toList(), + java.util.Map.of( + "then_branch", graph(domain, null, indexer, ifOp.thenBranch().entryBlock(), List.of(), 0), + "else_branch", graph(domain, null, indexer, ifOp.elseBranch().entryBlock(), List.of(), 0)))); case OnnxOps.Loop loopOp -> { opNodes.accept(node(loopOp.schema().name(), expandTuples(indexer, loopOp.operands()), IntStream.range(0, loopOp.resultType() instanceof TupleType tt ? tt.componentTypes().size() : 1).mapToObj(o -> indexer.nameOf(loopOp.result(), o)).toList(), java.util.Map.of( - "body", graph(domain, null, indexer, loopOp.loopBody().entryBlock(), List.of(), 2, _ -> null, valueShapes, Map.of())))); + "body", graph(domain, null, indexer, loopOp.loopBody().entryBlock(), List.of(), 2)))); } - case OnnxOp onnxOp -> opNodes.accept(node( - onnxOp.schema().name(), - opInputNames(indexer, onnxOp.onnxInputs()), - IntStream.range(0, onnxOp.onnxOutputs().size()).mapToObj(o -> indexer.nameOf(onnxOp.result(), o)).toList(), - onnxOp.onnxAttributes())); - case CoreOp.FuncCallOp fco -> opNodes.accept(node( - domain, - fco.funcName(), - expandTuples(indexer, fco.operands()), - expandTuples(indexer, List.of(fco.result())), - java.util.Map.of())); + case OnnxOp onnxOp -> + opNodes.accept(node( + onnxOp.schema().name(), + opInputNames(indexer, onnxOp.onnxInputs()), + IntStream.range(0, onnxOp.onnxOutputs().size()).mapToObj(o -> indexer.nameOf(onnxOp.result(), o)).toList(), + onnxOp.onnxAttributes())); + case CoreOp.FuncCallOp fco -> + opNodes.accept(node( + domain, + fco.funcName(), + expandTuples(indexer, fco.operands()), + expandTuples(indexer, List.of(fco.result())), + java.util.Map.of())); case CoreOp.ReturnOp _, CoreOp.ConstantOp _ -> { // skip } case CoreOp.TupleLoadOp tlo -> - indexer.mapTupleLoad(tlo.result(), tlo.operands().getFirst(), tlo.index()); - case CoreOp.TupleOp to -> indexer.mapTupleElements(to.result(), to.operands()); + indexer.mapTupleLoad(tlo.result(), tlo.operands().getFirst(), tlo.index()); + case CoreOp.TupleOp to -> + indexer.mapTupleElements(to.result(), to.operands()); case JavaOp.InvokeOp io when io.invokeReference().refType().equals(JavaType.type(List.class)) -> { if (io.invokeReference().name().equals("get") && io.operands().getLast() instanceof Op.Result or && or.op() instanceof CoreOp.ConstantOp co && co.value() instanceof Integer i) { indexer.mapTupleLoad(io.result(), io.operands().getFirst(), i); @@ -362,22 +328,24 @@ static List nodes(String domain, Indexer indexer, List ops, Map tensorInfos(Indexer indexer, List args, int scalarArgs, Map valueShapes) { + static List tensorInfos(Indexer indexer, List args, int scalarArgs) { var infos = new ArrayList(); for (var arg : args) { switch (arg.type()) { - case OnnxType.TensorType tt -> infos.add(infos.size() < scalarArgs - ? tensorInfo(indexer.nameOf(arg), tt.eType().id(), true, valueShapes) - : tensorInfo(indexer.nameOf(arg), tt, valueShapes)); + case OnnxType.TensorType tt -> + infos.add(infos.size() < scalarArgs + ? tensorInfo(indexer.nameOf(arg), tt.eType().id(), true) + : tensorInfo(indexer.nameOf(arg),tt)); case TupleType tt -> { var ct = tt.componentTypes(); for (int i = 0; i < ct.size(); i++) { infos.add(infos.size() < scalarArgs && ct.get(i) instanceof OnnxType.TensorType tensorType - ? tensorInfo(indexer.nameOf(arg, i), tensorType.eType().id(), true, valueShapes) - : tensorInfo(indexer.nameOf(arg, i), ct.get(i), valueShapes)); + ? tensorInfo(indexer.nameOf(arg, i), tensorType.eType().id(), true) + : tensorInfo(indexer.nameOf(arg, i), ct.get(i))); } } - default -> throw new UnsupportedOperationException(arg.type().toString()); + default -> + throw new UnsupportedOperationException(arg.type().toString()); } } return infos; @@ -388,26 +356,21 @@ static GraphProto graph(String name, List initializers, List initializers, List inputs, List ops, List outputs) { - return graphWithOutputs(name, initializers, inputs, ops, List.of(), outputs); - } - - static GraphProto graphWithOutputs(String name, List initializers, List inputs, List ops, List valueInfos, List outputs) { return new GraphProto() .name(name) - .forEach(initializers, GraphProto::initializer) - .forEach(inputs, GraphProto::input) - .forEach(ops, GraphProto::node) - .forEach(valueInfos, GraphProto::valueInfo) - .forEach(outputs, GraphProto::output); + .forEach(initializers, (g, i) -> g.initializer(i)) + .forEach(inputs, (g, i) -> g.input(i)) + .forEach(ops, (g, op) -> g.node(op)) + .forEach(outputs, (g, o) -> g.output(o)); } static FunctionProto function(String functionDomain, List imports, String functionName, List inputNames, List outputNames, List ops) { return new FunctionProto() .domain(functionDomain) .name(functionName) - .forEach(inputNames, FunctionProto::input) - .forEach(ops, FunctionProto::node) - .forEach(outputNames, FunctionProto::output) + .forEach(inputNames, (f, i) -> f.input(i)) + .forEach(ops, (g, op) -> g.node(op)) + .forEach(outputNames, (f, o) -> f.output(o)) .opsetImport(new OperatorSetIdProto().version(OPSET_VERSION)) .forEach(imports, (f, d) -> f.opsetImport(new OperatorSetIdProto().domain(d).version(1))); } @@ -416,78 +379,44 @@ static NodeProto node(String domain, String opName, List inputNames, Lis return new NodeProto() .domain(domain) .opType(opName) - .forEach(inputNames, NodeProto::input) + .forEach(inputNames, (n, iName) -> n.input(iName)) .forEach(attributes.entrySet(), (n, ae) -> n.attribute(attribute(ae.getKey(), ae.getValue()))) - .forEach(outputNames, NodeProto::output); + .forEach(outputNames, (n, oName) -> n.output(oName)); } - static NodeProto node(String opName, List inputNames, List outputNames, java.util.Map attributes) { + static NodeProto node(String opName, List inputNames, List outputNames, Map attributes) { int di = opName.lastIndexOf('.'); return node(di < 0 ? null : opName.substring(0, di), opName.substring(di + 1), inputNames, outputNames, attributes); } - static List shapeOf(long[] shape) { - if (shape == null) { - return null; - } - var dims = new ArrayList<>(shape.length); - for (long dim : shape) { - dims.add(dim); - } - return dims; - } - - static List shapeOf(String name, Map valueShapes) { - long[] shape = valueShapes.get(name); - if (shape == null) { - int dot = name.lastIndexOf('.'); - if (dot > 0) { - try { - Integer.parseInt(name.substring(dot + 1)); - shape = valueShapes.get(name.substring(0, dot)); - } catch (NumberFormatException _) { - // Not a tuple-expanded value name. - } - } - } - return shapeOf(shape); - } - static ValueInfoProto tensorInfo(String name, int tensorElementType) { - return tensorInfo(name, tensorElementType, false, Map.of()); + return tensorInfo(name, tensorElementType, false); } static ValueInfoProto tensorInfo(String name, int tensorElementType, boolean addScalarShape) { - return tensorInfo(name, tensorElementType, addScalarShape, Map.of()); + return tensorInfo(name, tensorElementType, addScalarShape ? List.of() : determineLlmShape(name)); } - static ValueInfoProto tensorInfo(String name, int tensorElementType, boolean addScalarShape, Map valueShapes) { - return tensorInfo(name, tensorElementType, addScalarShape ? List.of() : shapeOf(name, valueShapes)); - } - - static ValueInfoProto tensorInfo(String name, Object type, Map valueShapes) { + static ValueInfoProto tensorInfo(String name, Object type) { return type instanceof OnnxType.TensorType tensorType - ? tensorInfo(name, tensorType, valueShapes) + ? tensorInfo(name, tensorType) : new ValueInfoProto().name(name); } - static ValueInfoProto tensorInfo(String name, OnnxType.TensorType tensorType, Map valueShapes) { - List shape = tensorType.shape() != null && !tensorType.shape().isEmpty() ? tensorType.shape() : shapeOf(name, valueShapes); - return tensorInfo(name, tensorType.eType().id(), shape); + static ValueInfoProto tensorInfo(String name, OnnxType.TensorType tensorType) { + List shapes = (tensorType.shape() != null) ? tensorType.shape() : determineLlmShape(name); + return tensorInfo(name, tensorType.eType().id(), shapes); } - static ValueInfoProto tensorInfo(String name, int tensorElementType, List shape) { + static ValueInfoProto tensorInfo(String name, int tensorElementType, List shapes) { var t = new TypeProto.Tensor().elemType(tensorElementType); - if (shape != null) { + if (shapes != null) { var tensorShape = new TensorShapeProto(); - for (int i = 0; i < shape.size(); i++) { - Object dim = shape.get(i); + for (Object dim : shapes) { tensorShape.dim(switch (dim) { - case Number n when n.longValue() < 0 -> - new TensorShapeProto.Dimension().dimParam(name + "_dim_" + i); case Number n -> new TensorShapeProto.Dimension().dimValue(n.longValue()); case String s -> new TensorShapeProto.Dimension().dimParam(s); - default -> throw new IllegalArgumentException("Unsupported tensor dimension: " + dim); + default -> throw new IllegalArgumentException("Unsupported tensor dimension " + dim); }); } t.shape(tensorShape); @@ -497,7 +426,17 @@ static ValueInfoProto tensorInfo(String name, int tensorElementType, List tensorDataExternalizer) { + private static List determineLlmShape(String name) { + return switch (name) { + case String shapeName when (shapeName.equals("inputIds") || shapeName.equals("attentionMask")) -> List.of("bath_size", "sequence_length"); + case String shapeName when (shapeName.equals("logits")) -> List.of("batch_size", "sequence_length", 128256L); + case String shapeName when (shapeName.matches("past(Key|Value)\\.\\d+")) -> List.of("bath_size", 8L, "past_sequence_length", 64L); + case String shapeName when (shapeName.matches("present(Key|Value)\\.\\d+")) -> List.of("bath_size", 8L, "total_sequence_length", 64L); + case String _ -> null; + }; + } + + static TensorProto tensorProto(String name,Tensor tensor, Function tensorDataExternalizer) { ExternalTensorDataInfo extInfo = tensorDataExternalizer.apply(tensor); TensorProto tp = new TensorProto() .name(name) @@ -506,9 +445,9 @@ static TensorProto tensorProto(String name, Tensor tensor, Function type) { boolean bypassInits = options != null && options.bypassInitilizers; List initValues = getInitValues(l, mi.initializers(), q.capturedValues().sequencedValues()); LOG.log(System.Logger.Level.DEBUG, "Building ONNX binary " + domainName); - byte[] protobufModel = OnnxProtoBuilder.buildModel(domainName, mi.module(), bypassInits ? List.of() : initValues, mi.valueInfo(), _-> null); + byte[] protobufModel = OnnxProtoBuilder.buildModel(domainName, mi.module(), bypassInits ? List.of() : initValues); if (DEBUG) { System.out.println(mi.module().toText()); diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/compiler/OnnxTransformer.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/compiler/OnnxTransformer.java index 59e8fd169d8..77b6cbb5f12 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/compiler/OnnxTransformer.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/compiler/OnnxTransformer.java @@ -1,3 +1,27 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ package oracle.code.onnx.compiler; import java.lang.invoke.MethodHandles; @@ -16,11 +40,8 @@ import jdk.incubator.code.dialect.core.SSA; import jdk.incubator.code.dialect.core.TupleType; import jdk.incubator.code.dialect.java.*; -import oracle.code.onnx.ExplicitOnnxOperators; import oracle.code.onnx.OnnxOperators; import oracle.code.onnx.Tensor; -import oracle.code.onnx.metadata.ModelMetadata; -import oracle.code.onnx.metadata.TensorMetadata; import oracle.code.onnx.ir.OnnxOp; import oracle.code.onnx.ir.OnnxOps; import oracle.code.onnx.ir.ExplicitOnnxOps; @@ -54,26 +75,12 @@ Lambdas expressions transform recursively (need to restrict where expressions ar public final class OnnxTransformer { static final JavaType ONNX_OPERATORS_CLASS = JavaType.type(OnnxOperators.class); - static final JavaType EXPLICIT_ONNX_OPERATORS_CLASS = JavaType.type(ExplicitOnnxOperators.class); static final JavaType TENSOR_CLASS = JavaType.type(Tensor.class); static final JavaType LIST_CLASS = JavaType.type(List.class); static final System.Logger LOG = System.getLogger("oracle.code.onnx"); - public record OnnxValueInfo(String name, long[] shape) { - } - - public record ModuleAndInitializers( - CoreOp.ModuleOp module, - SequencedCollection initializers, - Map valueInfo) { - - public ModuleAndInitializers { - initializers = (initializers != null) ? initializers : List.of(); - valueInfo = (valueInfo != null) ? valueInfo : Map.of(); - } - - } + public record ModuleAndInitializers(CoreOp.ModuleOp module, SequencedCollection initializers, Map namesMap) {} public static ModuleAndInitializers transform(MethodHandles.Lookup l, Quoted quotedLambda) { JavaOp.LambdaOp lambda = quotedLambda.op(); @@ -110,10 +117,6 @@ public static ModuleAndInitializers transform(MethodHandles.Lookup l, Quoted namesMap = new HashMap<>(); - CoreOp.ModuleOp transformedModule = transformModule(tc, mi.module, namesMap); - Map valueShapes = Map.of(); - if (metadata != null) { - List parameterNames = mainFunctionParameterNames(transformedModule, namesMap); - valueShapes = valueShapes(metadata, parameterNames); - } - Map valueInfo = inferValueInfo(transformedModule, namesMap, valueShapes); - return new ModuleAndInitializers(transformedModule, mi.initializers(), valueInfo); - } - - private static Map inferValueInfo(CoreOp.ModuleOp module, Map namesMap, Map valueShapes) { - Map valueInfos = toValueInfo(namesMap); - var shapes = new IdentityHashMap(); - var tupleShapes = new IdentityHashMap>(); - for (Map.Entry entry : namesMap.entrySet()) { - long[] shape = valueShape(entry.getValue(), valueShapes); - if (shape != null) { - shapes.put(entry.getKey(), shape); - } - } - - var shapeInputs = Collections.newSetFromMap(new IdentityHashMap()); - module.functionTable().sequencedValues().forEach(func -> inferBlockShapes(func.body().entryBlock(), namesMap, valueShapes, shapes, tupleShapes, shapeInputs)); - var inferred = new IdentityHashMap(); - for (Map.Entry entry: valueInfos.entrySet()) { - var value = entry.getKey(); - var info = entry.getValue(); - - long[] shape = info.shape(); - if (shape == null) { - shape = shapes.get(value); - } - if (shape == null) { - shape = valueShape(info.name(), valueShapes); - } - inferred.put(value, shape == null ? info : new OnnxValueInfo(info.name(), shape.clone())); - } - - for (Value input : shapeInputs) { - long[] shape = shapes.get(input); - if (shape != null) { - inferred.putIfAbsent(input, new OnnxValueInfo(namesMap.get(input), shape.clone())); - } - } - - return Map.copyOf(inferred); - } - - private static Map toValueInfo(Map namesMap) { - if (namesMap == null || namesMap.isEmpty()) { - return Map.of(); - } - return namesMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> new OnnxValueInfo(e.getValue(), null))); - } - - private static long[] valueShape(String name, Map valueShapes) { - if (name == null || valueShapes == null || valueShapes.isEmpty()) { - return null; - } - long[] shape = valueShapes.get(name); - if (shape == null) { - int dot = name.lastIndexOf('.'); - if (dot > 0) { - try { - Integer.parseInt(name.substring(dot + 1)); - shape = valueShapes.get(name.substring(0, dot)); - } catch (NumberFormatException _) { - LOG.log(System.Logger.Level.DEBUG, "Not a tuple-expanded name " + dot); - } - } - } - return (shape != null) ? shape.clone() : null; - } - - private static void inferBlockShapes(Block block, Map namesMap, Map valueShapes, - IdentityHashMap shapes, IdentityHashMap> tupleShapes, Set shapeInputs) { - - for (Block.Parameter parameter : block.parameters()) { - long[] shape = valueShape(namesMap.get(parameter), valueShapes); - if (shape != null) { - shapes.put(parameter, shape); - } - } - - for (Op op : block.ops()) { - switch (op) { - case CoreOp.TupleLoadOp tlo -> { - long[] shape = tupleElementShape(tlo.operands().getFirst(), tlo.index(), namesMap, valueShapes, shapes, tupleShapes); - putShape(tlo.result(), shape, shapes); - } - case CoreOp.TupleOp to -> - tupleShapes.put(to.result(), to.operands().stream().map(shapes::get).toList()); - case JavaOp.InvokeOp io when io.invokeReference().refType().equals(LIST_CLASS) && io.invokeReference().name().equals("get") -> { - if (io.operands().getLast() instanceof Op.Result or && or.op() instanceof CoreOp.ConstantOp co && co.value() instanceof Integer i) { - putShape(io.result(), tupleElementShape(io.operands().getFirst(), i, namesMap, valueShapes, shapes, tupleShapes), shapes); - } - } - case JavaOp.InvokeOp io when io.invokeReference().refType().equals(LIST_CLASS) && io.invokeReference().name().equals("of") -> - tupleShapes.put(io.result(), io.operands().stream().map(shapes::get).toList()); - case OnnxOp onnxOp -> collectShapeInputs(onnxOp, shapes, shapeInputs); - default -> LOG.log(System.Logger.Level.DEBUG, "Block shape could not be inferred for " + op); - } - } - } - - private static long[] tupleElementShape(Value tuple, int index, Map namesMap, Map valueShapes, - IdentityHashMap shapes, IdentityHashMap> tupleShapes) { - List elements = tupleShapes.get(tuple); - if (elements != null && index < elements.size() && elements.get(index) != null) { - return elements.get(index).clone(); - } - String name = namesMap.get(tuple) != null ? namesMap.get(tuple) + "." + index : null; - long[] shape = valueShape(name, valueShapes); - if (shape == null) { - shape = shapes.get(tuple); - } - return shape != null ? shape.clone() : null; - } - - private static void putShape(Value value, long[] shape, IdentityHashMap shapes) { - if (shape != null) { - shapes.put(value, shape.clone()); - } - } - - private static void collectShapeInputs(OnnxOp op, IdentityHashMap shapes, Set shapeInputs) { - if (op instanceof ExplicitOnnxOps.If || op instanceof ExplicitOnnxOps.Loop) - return; - - for (Map.Entry entry : op.onnxInputs().entrySet()) { - var parameter = entry.getKey(); - var input = entry.getValue(); - - List hints = parameter.onnxShapeHints(); - if (!hints.isEmpty() && input instanceof Value value) { - shapeInputs.add(value); - putShape(value, hints.stream().mapToLong(_ -> -1).toArray(), shapes); - } - } - } - - private static Map valueShapes(ModelMetadata metadata, List parameterNames) { - if (Objects.isNull(metadata)) - return Map.of(); - - var shapes = new HashMap(); - metadata.values().forEach((name, valueMetadata) -> putValueShape(shapes, name, valueMetadata)); - for (int i = 0; i < parameterNames.size(); i++) { - String name = parameterNames.get(i); - TensorMetadata valueMetadata = metadata.parameters().get(i); - if (name != null && valueMetadata != null) { - putValueShape(shapes, name, valueMetadata); - } - } - return Map.copyOf(shapes); - } - - private static void putValueShape(HashMap shapes, String name, TensorMetadata valueMetadata) { - if (valueMetadata.shape() != null) { - shapes.put(name, Objects.requireNonNull(valueMetadata.shape()).clone()); - for (int i = 0; i < valueMetadata.count(); i++) { - shapes.put(name + "." + i, Objects.requireNonNull(valueMetadata.shape()).clone()); - } - } - } - - private static List mainFunctionParameterNames(CoreOp.ModuleOp module, Map namesMap) { - return module.functionTable().sequencedValues().reversed().stream() - .findFirst() - .stream() - .flatMap(func -> func.parameters().stream()) - .map(namesMap::get) - .toList(); + return new ModuleAndInitializers(transformModule(tc, mi.module(), namesMap), mi.initializers(), namesMap); } static void collectModuleFunctions(MethodHandles.Lookup l, SequencedMap funcs, Set doNotInline, CoreOp.FuncOp func) { @@ -314,7 +145,7 @@ static CoreOp.ModuleOp collectModuleFunctions(MethodHandles.Lookup l, CoreOp.Fun funcs.putLast(null, inputFunc); return CoreOp.module(funcs.sequencedValues().stream() - .filter(doNotInline::contains) + .filter(f -> doNotInline.contains(f)) .map(f -> mapOrInline(f, funcs, doNotInline)).toList()); } @@ -344,25 +175,25 @@ static CoreOp.FuncOp mapOrInline(CoreOp.FuncOp f, SequencedMap initializers = new LinkedHashMap<>(); + LinkedHashMap initializers = new LinkedHashMap(); module.elements().forEach(op -> { if (op instanceof JavaOp.FieldAccessOp.FieldLoadOp flo && (flo.resultType() instanceof ClassType ct && ct.rawType().equals(TENSOR_CLASS) - || tc.isRecord(flo.resultType()) - || flo.resultType() instanceof ArrayType at && at.componentType() instanceof ClassType ct && ct.rawType().equals(TENSOR_CLASS) - )) { + || tc.isRecord(flo.resultType()) + || flo.resultType() instanceof ArrayType at && at.componentType() instanceof ClassType ct && ct.rawType().equals(TENSOR_CLASS) + )) { var targetType = tc.convertType(flo.result()); // computataion of the tuple size created out of the static array initializer field - initializers.compute(flo.fieldReference(), (_, ti) -> ti == null + initializers.compute(flo.fieldReference(), (fd, ti) -> ti == null ? new TI(targetType, initializers.size()) : targetType instanceof TupleType newTt && ti.type() instanceof TupleType oldTt && newTt.componentTypes().size() > oldTt.componentTypes().size() - ? new TI(newTt, ti.index()) - : ti); + ? new TI(newTt, ti.index()) + : ti); } }); if (initializers.isEmpty()) { - return new ModuleAndInitializers(module, List.of(), Map.of()); + return new ModuleAndInitializers(module, List.of(), null); } // map all initializers field loads into additional arguments @@ -417,7 +248,9 @@ public static CoreOp.FuncOp evaluate(MethodHandles.Lookup l, CoreOp.FuncOp f) { op -> switch (op) { case CoreOp.ConstantOp _ -> true; case JavaOp.FieldAccessOp.FieldLoadOp flo -> flo.resultType() instanceof PrimitiveType; - case JavaOp.InvokeOp _, CoreOp.ReturnOp _, JavaOp.NewOp _-> false; + case JavaOp.InvokeOp _ -> false; + case CoreOp.ReturnOp _ -> false; + case JavaOp.NewOp _ -> false; default -> op.result() != null; }, new HashSet<>(), f); @@ -482,7 +315,7 @@ static CoreOp.FuncOp transformFunc(TypeConvertor tc, CoreOp.FuncOp func, Map b.transformBody(func.body(), b.parameters(), toOnnxCodeTransformer(tc, pe))); + var func2 = CoreOp.func(func.funcName(), ft).body(b -> { + b.transformBody(func.body(), b.parameters(), toOnnxCodeTransformer(tc, pe)); + }); // double transformation to fix return type by the returned tuple type return CoreOp.func(func2.funcName(), tc.convertType(func2)) .body(b -> b.transformBody(func2.body(), b.parameters(), CodeTransformer.COPYING_TRANSFORMER)); @@ -525,9 +360,9 @@ static CoreOp.FuncOp removeDropedFuncCallsArgs(CoreOp.FuncOp func, Map newOperands = IntStream.range(0, fco.operands().size()).filter(i -> !argsToDrop.get(i)).mapToObj(i -> cc.getValue(fco.operands().get(i))).toList(); CoreOp.FuncCallOp newCall = CoreOp.funcCall(fco.funcName(), - CoreType.functionType(fco.opSignature().returnType(), - newOperands.stream().map(Value::type).toList()), - newOperands); + CoreType.functionType(fco.opSignature().returnType(), + newOperands.stream().map(Value::type).toList()), + newOperands); cc.mapValue(op.result(), bb.add(newCall)); } else { bb.add(op); @@ -570,23 +405,14 @@ static CodeTransformer toOnnxCodeTransformer(TypeConvertor tc, OnnxPartialEvalua } switch (op) { // Transform invocation to ONNX operator to operation modeling the operator - case JavaOp.InvokeOp io when (io.invokeReference().refType().equals(ONNX_OPERATORS_CLASS) - || io.invokeReference().refType().equals(EXPLICIT_ONNX_OPERATORS_CLASS)) -> { + case JavaOp.InvokeOp io when io.invokeReference().refType().equals(ONNX_OPERATORS_CLASS) -> { String operatorName = io.invokeReference().name(); Class opClass = onnxOpClassFromName(operatorName); OnnxOp.OnnxSchema schema = schemaFromOnnxOpClass(opClass); List attributes = pe.evaluatedAttributes.get(io); - Class apiClass = io.invokeReference().refType().equals(EXPLICIT_ONNX_OPERATORS_CLASS) - ? ExplicitOnnxOperators.class - : OnnxOperators.class; - attributes = orderAttributesInSchema(apiClass, operatorName, io.operands().size(), attributes, schema); - - Class factoryClass = io.invokeReference().refType().equals(EXPLICIT_ONNX_OPERATORS_CLASS) - ? ExplicitOnnxOps.class - : OnnxOps.class; - Method opMethod = Stream.of(factoryClass.getMethods()) + Method opMethod = Stream.of(OnnxOps.class.getMethods()) .filter(m -> m.getName().equals(operatorName)) .findFirst().orElseThrow(); @@ -732,32 +558,6 @@ case JavaOp.InvokeOp io when (io.invokeReference().refType().equals(ONNX_OPERATO }; } - private static List orderAttributesInSchema(Class apiClass, String operatorName, int inputCount, List attributes, OnnxOp.OnnxSchema schema) { - if (attributes == null || attributes.isEmpty()) { - return attributes; - } - Method apiMethod = Stream.of(apiClass.getMethods()) - .filter(m -> m.getName().equals(operatorName)) - .filter(m -> m.getParameterCount() == inputCount + attributes.size()) - .findFirst() - .orElse(null); - if (apiMethod == null || Stream.of(apiMethod.getParameters()).anyMatch(p -> !p.isNamePresent())) { - return attributes; - } - var attributesByName = new HashMap(); - var parameters = apiMethod.getParameters(); - for (int i = 0; i < attributes.size(); i++) { - attributesByName.put(parameters[inputCount + i].getName(), attributes.get(i)); - } - var ordered = new ArrayList<>(attributes.size()); - for (OnnxOp.OnnxAttribute attribute : schema.attributes()) { - if (attributesByName.containsKey(attribute.name())) { - ordered.add(attributesByName.get(attribute.name())); - } - } - return ordered.size() == attributes.size() ? ordered : attributes; - } - static Value skipVars(Value v) { return v instanceof Op.Result or && or.op() instanceof CoreOp.VarAccessOp.VarLoadOp vlo ? vlo.varOp().initOperand() : v; } @@ -770,7 +570,7 @@ static Body.Builder transformBodyTranslateTypes(TypeConvertor tc, Op.Invokable i FunctionType inputType = iop.invokableSignature(); FunctionType outputType = CoreType.functionType( tc.convertType(inputType.returnType()), - inputType.parameterTypes().stream().map(tc::convertType).toList()); + inputType.parameterTypes().stream().map(pt -> tc.convertType(pt)).toList()); // @@@ It's not clear in the API when to pass CopyContext and OpTransformer // @@@ create a Body.Builder structurally connected as a descendant of a Block.Builder diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java index 21702b7b96a..fa0974f620f 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java @@ -33,7 +33,6 @@ import java.nio.file.Path; import java.util.List; import java.util.Locale; -import java.util.Objects; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; import java.util.stream.Stream; @@ -41,8 +40,6 @@ import jdk.incubator.code.dialect.core.CoreOp; import oracle.code.onnx.OnnxProtoBuilder; import oracle.code.onnx.OnnxRuntime; -import oracle.code.onnx.metadata.ModelMetadata; -import oracle.code.onnx.metadata.ModelMetadataResolver; import oracle.code.onnx.compiler.OnnxTransformer; import static oracle.code.onnx.foreign.OrtGenApi.*; @@ -163,7 +160,7 @@ public static void loadGenAILib(Path libRoot) { throw new IllegalStateException("Unsupported os:" + os); } try (var libStream = OnnxRuntime.class.getResourceAsStream(libResource)) { - Files.copy(Objects.requireNonNull(libStream), runtime); + Files.copy(libStream, runtime); } catch (IOException ioe) { throw new RuntimeException(ioe); } @@ -185,12 +182,11 @@ public static void loadGenAILib(Path libRoot) { public static OnnxGenRuntimeSession buildFromCodeReflection(MethodHandles.Lookup l, Object codeReflectionModelInstance, String methodName, Path targetOnnxModelDir, String targetOnnxModelFileName, String targetExternalDataFileName) throws IOException { Method method = Stream.of(codeReflectionModelInstance.getClass().getDeclaredMethods()).filter(m -> m.getName().equals(methodName)).findFirst().orElseThrow(); CoreOp.FuncOp javaModel = OnnxTransformer.evaluate(l, Op.ofMethod(method).orElseThrow()); - ModelMetadata metadata = ModelMetadataResolver.from(method); - OnnxTransformer.ModuleAndInitializers onnxModel = OnnxTransformer.transform(l, javaModel, metadata); + OnnxTransformer.ModuleAndInitializers onnxModel = OnnxTransformer.transform(l, javaModel); List initializers = OnnxRuntime.getInitValues(l, onnxModel.initializers(), List.of(codeReflectionModelInstance)); try (OutputStream dataOutput = Files.newOutputStream(targetOnnxModelDir.resolve(targetExternalDataFileName))) { AtomicLong offset = new AtomicLong(); - byte[] protobufModel = OnnxProtoBuilder.buildModel("llm", onnxModel.module(), initializers, onnxModel.valueInfo(), t -> { + byte[] protobufModel = OnnxProtoBuilder.buildModel("llm", onnxModel.module(), initializers, onnxModel.namesMap(), t -> { byte[] data = t.data().toArray(ValueLayout.JAVA_BYTE); if (data.length <= PAYLOAD_LIMIT) { return null; diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOp.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOp.java index 791181d37ae..086ebac8ea7 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOp.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOp.java @@ -149,10 +149,6 @@ public boolean isVariadoc() { Quantifier quantifier(); - default List onnxShapeHints() { - return List.of(); - } - interface None extends OnnxParameter { @Override default String name() { diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOps.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOps.java index 9fa37f58c5a..20f8d723bea 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOps.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOps.java @@ -5971,12 +5971,7 @@ public OnnxType.TypeVariable typeVariable() { } public enum InputParameter implements OnnxParameter { - input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED) { - @Override - public List onnxShapeHints() { - return List.of("ConstantOfShape_input_rank"); - } - }, + input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; final OnnxType type; @@ -9198,12 +9193,7 @@ public OnnxType.TypeVariable typeVariable() { public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), - shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED) { - @Override - public List onnxShapeHints() { - return List.of("Expand_shape_rank"); - } - }, + shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; final OnnxType type; @@ -23632,12 +23622,7 @@ public OnnxType.TypeVariable typeVariable() { public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), - shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED) { - @Override - public List onnxShapeHints() { - return List.of("Reshape_shape_rank"); - } - }, + shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; final OnnxType type; diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/ElementShape.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/ElementShape.java deleted file mode 100644 index d3587f2a283..00000000000 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/ElementShape.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package oracle.code.onnx.metadata; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.PARAMETER, ElementType.RECORD_COMPONENT}) -public @interface ElementShape { - long[] value(); - int count() default -1; -} diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/ModelMetadata.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/ModelMetadata.java deleted file mode 100644 index fc7e1308019..00000000000 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/ModelMetadata.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package oracle.code.onnx.metadata; - -import java.util.HashMap; -import java.util.Map; - -public record ModelMetadata(Map parameters, Map values) { - - public ModelMetadata { - if (parameters == null || parameters.isEmpty()) { - parameters = Map.of(); - } - parameters = Map.copyOf(new HashMap<>(parameters)); - - if (values == null || values.isEmpty()) { - values = Map.of(); - } - values = Map.copyOf(new HashMap<>(values)); - } -} diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/ModelMetadataResolver.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/ModelMetadataResolver.java deleted file mode 100644 index 97d948b0139..00000000000 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/ModelMetadataResolver.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package oracle.code.onnx.metadata; - -import java.lang.reflect.Method; -import java.lang.reflect.Parameter; -import java.lang.reflect.RecordComponent; -import java.util.HashMap; - -public final class ModelMetadataResolver { - - private ModelMetadataResolver() {} - - public static ModelMetadata from(Method method) { - var parameterShapes = new HashMap(); - Parameter[] parameters = method.getParameters(); - for (int i = 0; i < parameters.length; i++) { - TensorMetadata tensorMetadata = toMetadata(parameters[i].getAnnotation(Shape.class), parameters[i].getAnnotation(ElementShape.class)); - if (tensorMetadata != null) { - parameterShapes.put(i, tensorMetadata); - } - } - - var valueShapes = new HashMap(); - Class returnType = method.getReturnType(); - if (returnType.isRecord()) { - for (RecordComponent component : returnType.getRecordComponents()) { - TensorMetadata tensorMetadata = toMetadata(component.getAnnotation(Shape.class), component.getAnnotation(ElementShape.class)); - if (tensorMetadata != null) { - valueShapes.put(component.getName(), tensorMetadata); - } - } - } - return new ModelMetadata(parameterShapes, valueShapes); - } - - private static TensorMetadata toMetadata(Shape shape, ElementShape elementShape) { - if (elementShape != null ) - return new TensorMetadata(elementShape.value(), elementShape.count()); - if (shape != null) - return new TensorMetadata(shape.value(), TensorMetadata.NO_ELEMENT_COUNT); - return null; - } - - -} diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/Shape.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/Shape.java deleted file mode 100644 index 89af309d58b..00000000000 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/Shape.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package oracle.code.onnx.metadata; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.PARAMETER, ElementType.RECORD_COMPONENT}) -public @interface Shape { - long[] value(); -} diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/TensorMetadata.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/TensorMetadata.java deleted file mode 100644 index 63fc7415bd9..00000000000 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/metadata/TensorMetadata.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package oracle.code.onnx.metadata; - -public record TensorMetadata(long[] shape, int count) { - public static final int NO_ELEMENT_COUNT = -1; - - public TensorMetadata { - shape = shape != null ? shape.clone() : null; - } - - @Override - public long[] shape() { - return shape != null ? shape.clone() : null; - } -} diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/proto/OnnxModel.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/proto/OnnxModel.java index 29a186ab7a8..f3a77b02069 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/proto/OnnxModel.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/proto/OnnxModel.java @@ -1019,7 +1019,7 @@ private static T readFrom(Class type, ByteBuffer bb) { private static void print(StringBuilder out, int indent, String name, Object value, boolean skipBigData) throws ReflectiveOperationException { if (value == null) return; - out.repeat(" ", indent).append(name); + out.append(" ".repeat(indent)).append(name); switch (value) { case List l -> { out.append(name.endsWith("s") ? ":" : "s:").append(System.lineSeparator()); diff --git a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java index 91aea4145fd..b72c2891ff4 100644 --- a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java +++ b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java @@ -26,8 +26,6 @@ import java.lang.foreign.Arena; import jdk.incubator.code.Reflect; import oracle.code.onnx.Tensor; -import oracle.code.onnx.metadata.ElementShape; -import oracle.code.onnx.metadata.Shape; import oracle.code.onnx.genai.TensorDataStream; import static java.util.Optional.*; @@ -51,7 +49,7 @@ public final class LlamaModel { public static final float EPSILON = 1.0E-5f, SCALE = 0.125f; - public final Tensor flat1, scalar1; + public final Tensor flat1, scalar1, logitsShape, kvShape; public final Tensor tokensWeights, initWeight, cosCache, sinCache; public final Tensor[] postAttentionWeights = new Tensor[LAYERS], inputWeights = new Tensor[LAYERS], @@ -71,8 +69,11 @@ public final class LlamaModel { mlpDownWeight = new Tensor[LAYERS]; public LlamaModel(Arena arena) throws IOException { - flat1 = Tensor.ofFlat(arena, 1L); - scalar1 = Tensor.ofScalar(arena, 1L); + flat1 = Tensor.ofFlat(arena, 1l); + scalar1 = Tensor.ofScalar(arena, 1l); + logitsShape = Tensor.ofFlat(arena, 1L, -1L, VOCAB_SIZE); + kvShape = Tensor.ofFlat(arena, 1L, NUM_KEY_VALUE_HEADS, -1L, HEAD_SIZE); + var modelData = new TensorDataStream(arena, LlamaModel.class.getResource("model_q4.onnx_data").getPath()); tokensWeights = modelData.nextTensor(FLOAT, VOCAB_SIZE, HIDEN_SIZE); initWeight = modelData.nextTensor(FLOAT, HIDEN_SIZE); @@ -100,24 +101,21 @@ public LlamaModel(Arena arena) throws IOException { } } - public record ForwardResponse(@Shape({1L, -1L, VOCAB_SIZE}) Tensor logits, - @ElementShape(value = {1L, NUM_KEY_VALUE_HEADS, -1L, HEAD_SIZE}, count = LAYERS) Tensor[] presentKey, - @ElementShape(value = {1L, NUM_KEY_VALUE_HEADS, -1L, HEAD_SIZE}, count = LAYERS) Tensor[] presentValue) { + public record ForwardResponse(Tensor logits, + Tensor[] presentKey, + Tensor[] presentValue) { } @Reflect - public ForwardResponse forward(@Shape({1L, -1L}) Tensor inputIds, - @Shape({1L, -1L}) Tensor attentionMask, - @ElementShape(value = {1L, NUM_KEY_VALUE_HEADS, -1L, HEAD_SIZE}, count = LAYERS) Tensor[] pastKey, - @ElementShape(value = {1L, NUM_KEY_VALUE_HEADS, -1L, HEAD_SIZE}, count = LAYERS) Tensor[] pastValue) { + public ForwardResponse forward(Tensor inputIds, Tensor attentionMask, Tensor[] pastKey, Tensor[] pastValue) { Tensor amSL = Cast(Sub(ReduceSum(attentionMask, of(flat1), empty(), empty()), flat1), empty(), OnnxType.INT32.id(), empty()); - Tensor amTSL = Cast(Gather(Shape(attentionMask, empty(), empty()), scalar1, of(0L)), empty(), OnnxType.INT32.id(), empty()); + Tensor amTSL = Cast(Gather(Shape(attentionMask, empty(), empty()), scalar1, of(0l)), empty(), OnnxType.INT32.id(), empty()); Tensor skipBias = Gather(tokensWeights, inputIds, empty()); - Tensor input = LayerNormalization(skipBias, initWeight, empty(), of(EPSILON), of(1L), of(-1L)).Y(); + Tensor input = LayerNormalization(skipBias, initWeight, empty(), of(EPSILON), of(1l), of(-1l)).Y(); Tensor[] presentKeys = new Tensor[LAYERS]; - Tensor[] presentValues = new Tensor[LAYERS]; + Tensor[] presentValues = new Tensor[LAYERS]; for (int i = 0; i < LAYERS; i++) { GroupQueryAttention attn = GroupQueryAttention(MatMulNBits(input, @@ -159,11 +157,11 @@ mlpDownScales[i], empty(), empty(), empty(), INTERMEDIATE_SIZE, HIDEN_SIZE, of(A input = norm.output(); skipBias = norm.input_skip_bias_sum(); - presentKeys[i] = attn.present_key(); - presentValues[i] = attn.present_value(); + presentKeys[i] = Reshape(attn.present_key(), kvShape, empty()); + presentValues[i] = Reshape(attn.present_value(), kvShape, empty()); } - Tensor logits = MatMul(input, Transpose(tokensWeights, of(new long[] {1L, 0L}))); + Tensor logits = Reshape(MatMul(input, Transpose(tokensWeights, of(new long[] {1L, 0L}))), logitsShape, empty()); return new ForwardResponse(logits, presentKeys, presentValues); } diff --git a/cr-examples/onnx/src/test/java/oracle/code/onnx/metadata/ModelMetadataResolverTest.java b/cr-examples/onnx/src/test/java/oracle/code/onnx/metadata/ModelMetadataResolverTest.java deleted file mode 100644 index 6c3c7635897..00000000000 --- a/cr-examples/onnx/src/test/java/oracle/code/onnx/metadata/ModelMetadataResolverTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package oracle.code.onnx.metadata; - -import oracle.code.onnx.Tensor; -import org.junit.jupiter.api.Test; - -import java.lang.reflect.Method; - -import static org.junit.jupiter.api.Assertions.*; - -class ModelMetadataResolverTest { - - record ForwardResponse(@Shape({1L, -1L, 64L}) Tensor logits, - @ElementShape(value = {1L, 8L, -1L, 64L}, count = 6) Tensor[] presentKey, - Tensor[] simpleOutput) { - } - - static ForwardResponse forward(@Shape({1L, -1L})Tensor inputIds, @ElementShape(value = {1L, 8L, -1L, 64L}, count = 6) Tensor[] pastKey, - Tensor[] simpleOutput) { - return null; - } - - @Test - void testFromMethodParameters() throws NoSuchMethodException { - Method method = ModelMetadataResolverTest.class.getDeclaredMethod("forward", Tensor.class, Tensor[].class, Tensor[].class); - - ModelMetadata modelMetadata = ModelMetadataResolver.from(method); - - assertEquals(2, modelMetadata.parameters().size()); - assertArrayEquals(new long[] {1L, -1L}, modelMetadata.parameters().get(0).shape()); - assertEquals(TensorMetadata.NO_ELEMENT_COUNT, modelMetadata.parameters().get(0).count()); - assertArrayEquals(new long[] {1L, 8L, -1L, 64L}, modelMetadata.parameters().get(1).shape()); - assertEquals(6, modelMetadata.parameters().get(1).count()); - assertFalse(modelMetadata.parameters().containsKey(2)); - - assertEquals(2, modelMetadata.values().size()); - assertArrayEquals(new long[] {1L, -1L, 64L}, modelMetadata.values().get("logits").shape()); - assertEquals(TensorMetadata.NO_ELEMENT_COUNT, modelMetadata.values().get("logits").count()); - assertArrayEquals(new long[] {1L, 8L, -1L, 64L}, modelMetadata.values().get("presentKey").shape()); - assertEquals(6, modelMetadata.values().get("presentKey").count()); - assertFalse(modelMetadata.values().containsKey("simpleOutput")); - } -} \ No newline at end of file From d97400044cddb6e365ae17370d54f369cee0a317 Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Tue, 14 Jul 2026 15:53:06 +0200 Subject: [PATCH 08/18] Revert OnnxProtoBuilder state to basics. Signed-off-by: Ana-Maria Mihalceanu --- .../oracle/code/onnx/OnnxProtoBuilder.java | 105 ++++-------------- 1 file changed, 20 insertions(+), 85 deletions(-) diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxProtoBuilder.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxProtoBuilder.java index 8d5890d710c..9d60b11dd32 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxProtoBuilder.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxProtoBuilder.java @@ -71,7 +71,7 @@ void setName(Value val, String name) { } case Block.Parameter _ when val.type() instanceof TupleType tt -> { for (int i = 0; i < tt.componentTypes().size(); i++) { - remap.put(baseName(val, i), name + "." + i); + remap.put(baseName(val, i), name +"." + i); } } default -> { @@ -162,6 +162,7 @@ public static byte[] buildModel(String domain, CoreOp.ModuleOp module, List initializers) { var indexer = new Indexer(block.ancestorOp(), Map.of()); var model = buildModel(graph(null, null, indexer, block, initializers, 0), List.of(), List.of()); +// System.out.println(OnnxModel.readFrom(model).toText()); return model; } @@ -178,7 +179,7 @@ static byte[] buildModel(GraphProto graph, List imports, List m.opsetImport(new OperatorSetIdProto().domain(d).version(1))) - .forEach(functions, (m, f) -> m.functions(f)) + .forEach(functions, ModelProto::functions) .graph(graph) .getBytes(); } @@ -206,29 +207,6 @@ static void expandTuples(Indexer indexer, List names, List tensorInfos(Indexer indexer, List values) { - var infos = new ArrayList(); - tensorInfos(indexer, infos, values); - return infos; - } - - private static void tensorInfos(Indexer indexer, ArrayList infos, List values) { - for (var v: values) { - if (v instanceof Op.Result or && or.op() instanceof CoreOp.TupleOp op) { - tensorInfos(indexer, infos, op.operands()); - } else if (v instanceof Op.Result or && or.op() instanceof CoreOp.TupleLoadOp top) { - infos.add(tensorInfo(indexer.nameOf(top.operands().getFirst(), top.index()), v.type())); - } else if (v.type() instanceof TupleType tt) { - var ct = tt.componentTypes(); - for (int i = 0; i < ct.size(); i++) { - infos.add(tensorInfo(indexer.nameOf(v, i), ct.get(i))); - } - } else { - infos.add(tensorInfo(indexer.nameOf(v), v.type())); - } - } - } - static GraphProto graph(String domain, String graphName, Indexer indexer, Block block, List initializers, int scalarArgs) { return graph(domain, graphName, indexer, block, initializers, scalarArgs, _ -> null); } @@ -238,7 +216,7 @@ static GraphProto graph(String domain, String graphName, Indexer indexer, Block params.forEach(indexer::nameOf); int firstInitializer = params.size() - initializers.size(); var args = params.subList(0, firstInitializer); - return graphWithOutputs(graphName, + return graph(graphName, IntStream.range(0, initializers.size()).boxed().mapMulti((i, tps) -> { Object val = initializers.get(i); if (val instanceof Record) { @@ -258,7 +236,7 @@ static GraphProto graph(String domain, String graphName, Indexer indexer, Block }).toList(), tensorInfos(indexer, args, scalarArgs), nodes(domain, indexer, block.ops()), - tensorInfos(indexer, block.terminatingOp().operands())); + expandTuples(indexer, block.terminatingOp().operands())); } static List opInputNames(Indexer indexer, SequencedMap inputs) { @@ -333,15 +311,11 @@ static List tensorInfos(Indexer indexer, List a for (var arg : args) { switch (arg.type()) { case OnnxType.TensorType tt -> - infos.add(infos.size() < scalarArgs - ? tensorInfo(indexer.nameOf(arg), tt.eType().id(), true) - : tensorInfo(indexer.nameOf(arg),tt)); + infos.add(tensorInfo(indexer.nameOf(arg), tt.eType().id(), infos.size() < scalarArgs)); case TupleType tt -> { var ct = tt.componentTypes(); for (int i = 0; i < ct.size(); i++) { - infos.add(infos.size() < scalarArgs && ct.get(i) instanceof OnnxType.TensorType tensorType - ? tensorInfo(indexer.nameOf(arg, i), tensorType.eType().id(), true) - : tensorInfo(indexer.nameOf(arg, i), ct.get(i))); + infos.add(tensorInfo(indexer.nameOf(arg, i), ((OnnxType.TensorType)ct.get(i)).eType().id(), infos.size() < scalarArgs)); } } default -> @@ -352,39 +326,35 @@ static List tensorInfos(Indexer indexer, List a } static GraphProto graph(String name, List initializers, List inputs, List ops, List outputNames) { - return graphWithOutputs(name, initializers, inputs, ops, outputNames.stream().map(oName -> new ValueInfoProto().name(oName)).toList()); - } - - static GraphProto graphWithOutputs(String name, List initializers, List inputs, List ops, List outputs) { return new GraphProto() .name(name) - .forEach(initializers, (g, i) -> g.initializer(i)) - .forEach(inputs, (g, i) -> g.input(i)) - .forEach(ops, (g, op) -> g.node(op)) - .forEach(outputs, (g, o) -> g.output(o)); + .forEach(initializers, GraphProto::initializer) + .forEach(inputs, GraphProto::input) + .forEach(ops, GraphProto::node) + .forEach(outputNames, (g, oName) -> g.output(new ValueInfoProto().name(oName))); } static FunctionProto function(String functionDomain, List imports, String functionName, List inputNames, List outputNames, List ops) { return new FunctionProto() .domain(functionDomain) .name(functionName) - .forEach(inputNames, (f, i) -> f.input(i)) - .forEach(ops, (g, op) -> g.node(op)) - .forEach(outputNames, (f, o) -> f.output(o)) + .forEach(inputNames, FunctionProto::input) + .forEach(ops, FunctionProto::node) + .forEach(outputNames, FunctionProto::output) .opsetImport(new OperatorSetIdProto().version(OPSET_VERSION)) .forEach(imports, (f, d) -> f.opsetImport(new OperatorSetIdProto().domain(d).version(1))); } - static NodeProto node(String domain, String opName, List inputNames, List outputNames, Map attributes) { + static NodeProto node(String domain, String opName, List inputNames, List outputNames, java.util.Map attributes) { return new NodeProto() .domain(domain) .opType(opName) - .forEach(inputNames, (n, iName) -> n.input(iName)) + .forEach(inputNames, NodeProto::input) .forEach(attributes.entrySet(), (n, ae) -> n.attribute(attribute(ae.getKey(), ae.getValue()))) - .forEach(outputNames, (n, oName) -> n.output(oName)); + .forEach(outputNames, NodeProto::output); } - static NodeProto node(String opName, List inputNames, List outputNames, Map attributes) { + static NodeProto node(String opName, List inputNames, List outputNames, java.util.Map attributes) { int di = opName.lastIndexOf('.'); return node(di < 0 ? null : opName.substring(0, di), opName.substring(di + 1), inputNames, outputNames, attributes); } @@ -394,49 +364,14 @@ static ValueInfoProto tensorInfo(String name, int tensorElementType) { } static ValueInfoProto tensorInfo(String name, int tensorElementType, boolean addScalarShape) { - return tensorInfo(name, tensorElementType, addScalarShape ? List.of() : determineLlmShape(name)); - } - - static ValueInfoProto tensorInfo(String name, Object type) { - return type instanceof OnnxType.TensorType tensorType - ? tensorInfo(name, tensorType) - : new ValueInfoProto().name(name); - } - - static ValueInfoProto tensorInfo(String name, OnnxType.TensorType tensorType) { - List shapes = (tensorType.shape() != null) ? tensorType.shape() : determineLlmShape(name); - return tensorInfo(name, tensorType.eType().id(), shapes); - } - - static ValueInfoProto tensorInfo(String name, int tensorElementType, List shapes) { var t = new TypeProto.Tensor().elemType(tensorElementType); - if (shapes != null) { - var tensorShape = new TensorShapeProto(); - for (Object dim : shapes) { - tensorShape.dim(switch (dim) { - case Number n -> new TensorShapeProto.Dimension().dimValue(n.longValue()); - case String s -> new TensorShapeProto.Dimension().dimParam(s); - default -> throw new IllegalArgumentException("Unsupported tensor dimension " + dim); - }); - } - t.shape(tensorShape); - } + if (addScalarShape) t.shape(new TensorShapeProto()); return new ValueInfoProto() .name(name) .type(new TypeProto().tensorType(t)); } - private static List determineLlmShape(String name) { - return switch (name) { - case String shapeName when (shapeName.equals("inputIds") || shapeName.equals("attentionMask")) -> List.of("bath_size", "sequence_length"); - case String shapeName when (shapeName.equals("logits")) -> List.of("batch_size", "sequence_length", 128256L); - case String shapeName when (shapeName.matches("past(Key|Value)\\.\\d+")) -> List.of("bath_size", 8L, "past_sequence_length", 64L); - case String shapeName when (shapeName.matches("present(Key|Value)\\.\\d+")) -> List.of("bath_size", 8L, "total_sequence_length", 64L); - case String _ -> null; - }; - } - - static TensorProto tensorProto(String name,Tensor tensor, Function tensorDataExternalizer) { + static TensorProto tensorProto(String name, Tensor tensor, Function tensorDataExternalizer) { ExternalTensorDataInfo extInfo = tensorDataExternalizer.apply(tensor); TensorProto tp = new TensorProto() .name(name) From e6ccad17e23477fa3dfb93274bb2b20d4d1168fa Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Tue, 14 Jul 2026 15:58:29 +0200 Subject: [PATCH 09/18] Remove extra spaces. Signed-off-by: Ana-Maria Mihalceanu --- .../java/oracle/code/onnx/OnnxOperators.java | 1722 ++++++++--------- 1 file changed, 861 insertions(+), 861 deletions(-) diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java index 013b7e18d94..3cef838114c 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java @@ -34,10 +34,10 @@ @SuppressWarnings({"unchecked", "OptionalUsedAsFieldOrParameterType"}) public final class OnnxOperators extends ExplicitOnnxOperators { - + private OnnxOperators() {} - - /// + + /// /// Absolute takes one input data (Tensor) and produces one output data /// (Tensor) where absolute value, y = abs(x), is applied to /// the tensor elementwise. @@ -45,34 +45,34 @@ public static Tensor Abs(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Abs.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the arccosine (inverse of cosine) of the given input tensor, element-wise. public static Tensor Acos(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Acos.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic arccosine of the given input tensor element-wise. public static Tensor Acosh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Acosh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Compute one iteration of ADAGRAD, a stochastic gradient based optimization /// algorithm. This operator can conduct the optimization of multiple tensor variables. - /// + /// /// Let's define the behavior of this operator. As you can imagine, ADAGRAD requires /// some parameters: - /// + /// /// - The initial learning-rate "R". /// - The update count "T". That is, the number of training iterations conducted. /// - A L2-norm regularization coefficient "norm_coefficient". /// - A learning-rate decay factor "decay_factor". /// - A small constant "epsilon" to avoid dividing-by-zero. - /// + /// /// At each ADAGRAD iteration, the optimized tensors are moved along a direction /// computed based on their estimated gradient and accumulated squared gradient. Assume /// that only a single tensor "X" is updated by this operator. We need the value of "X", @@ -82,32 +82,32 @@ public static Tensor Acosh(Tensor input) { /// corresponding output tensors are the new value of "X" (called "X_new"), and then /// the new accumulated squared gradient (called "H_new"). Those outputs are computed /// from the given inputs following the pseudo code below. - /// + /// /// Let "+", "-", "*", and "/" are all element-wise arithmetic operations with /// numpy-style broadcasting support. The pseudo code to compute those outputs is: - /// + /// /// // Compute a scalar learning-rate factor. At the first update of X, T is generally /// // 0 (0-based update index) or 1 (1-based update index). /// r = R / (1 + T * decay_factor); - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||_2^2, where ||X||_2 is the 2-norm. /// G_regularized = norm_coefficient * X + G; - /// + /// /// // Compute new accumulated squared gradient. /// H_new = H + G_regularized * G_regularized; - /// + /// /// // Compute the adaptive part of per-coordinate learning rate. Note that Sqrt(...) /// // computes element-wise square-root. /// H_adaptive = Sqrt(H_new) + epsilon - /// + /// /// // Compute the new value of "X". /// X_new = X - r * G_regularized / H_adaptive; - /// + /// /// If one assign this operators to optimize multiple inputs, for example, "X_1" and "X_2", the same /// pseudo code may be extended to handle all tensors jointly. More specifically, we can view "X" as a /// concatenation of "X_1" and "X_2" (of course, their gradient and accumulate gradient should /// be concatenated too) and then just reuse the entire pseudo code. - /// + /// /// Note that ADAGRAD was first proposed in http://jmlr.org/papers/volume12/duchi11a/duchi11a.pdf. /// In that reference paper, this operator is a special case of the Figure 1's composite mirror /// descent update. @@ -115,86 +115,86 @@ public static List> Adagrad(Tensor R, Tensor T, Li Object result = OnnxInterpreter.interpret(OnnxOps.Adagrad.class, List.of(R, T, inputs), List.of(epsilon, decay_factor, norm_coefficient)); return (List>) result; } - - /// + + /// /// Compute one iteration of Adam, a stochastic gradient based optimization /// algorithm. This operator can conduct the optimization of multiple tensor variables. - /// + /// /// Let's define the behavior of this operator. First of all, Adam requires /// some parameters: - /// + /// /// - The learning-rate "R". /// - The update count "T". That is, the number of training iterations conducted. /// - A L2-norm regularization coefficient "norm_coefficient". /// - A small constant "epsilon" to avoid dividing-by-zero. /// - Two coefficients, "alpha" and "beta". - /// + /// /// At each Adam iteration, the optimized tensors are moved along a direction /// computed based on their exponentially-averaged historical gradient and /// exponentially-averaged historical squared gradient. Assume that only a tensor /// "X" is being optimized. The rest of required information is - /// + /// /// - the value of "X", /// - "X"'s gradient (denoted by "G"), /// - "X"'s exponentially-averaged historical gradient (denoted by "V"), and /// - "X"'s exponentially-averaged historical squared gradient (denoted by "H"). - /// + /// /// Some of those parameters are passed into this operator as input tensors and others /// are stored as this operator's attributes. Specifically, this operator's input tensor /// list is ["R", "T", "X", "G", "V", "H"]. That is, "R" is the first input, "T" is /// the second input, and so on. Other parameters are given as attributes because they /// are constants. Moreover, the corresponding output tensors are - /// + /// /// - the new value of "X" (called "X_new"), /// - the new exponentially-averaged historical gradient (denoted by "V_new"), and /// - the new exponentially-averaged historical squared gradient (denoted by "H_new"). - /// + /// /// Those outputs are computed following the pseudo code below. - /// + /// /// Let "+", "-", "*", and "/" are all element-wise arithmetic operations with /// numpy-style broadcasting support. The pseudo code to compute those outputs is: - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||_2^2, where ||X||_2 is the 2-norm. /// G_regularized = norm_coefficient * X + G - /// + /// /// // Update exponentially-averaged historical gradient. /// V_new = alpha * V + (1 - alpha) * G_regularized - /// + /// /// // Update exponentially-averaged historical squared gradient. /// H_new = beta * H + (1 - beta) * G_regularized * G_regularized - /// + /// /// // Compute the element-wise square-root of H_new. V_new will be element-wisely /// // divided by H_sqrt for a better update direction. /// H_sqrt = Sqrt(H_new) + epsilon - /// + /// /// // Compute learning-rate. Note that "alpha**T"/"beta**T" is alpha's/beta's T-th power. /// R_adjusted = T > 0 ? R * Sqrt(1 - beta**T) / (1 - alpha**T) : R - /// + /// /// // Compute new value of "X". /// X_new = X - R_adjusted * V_new / H_sqrt - /// + /// /// // Post-update regularization. /// X_final = (1 - norm_coefficient_post) * X_new - /// + /// /// If there are multiple inputs to be optimized, the pseudo code will be applied /// independently to each of them. public static List> Adam(Tensor R, Tensor T, List> inputs, Optional epsilon, Optional norm_coefficient_post, Optional norm_coefficient, Optional alpha, Optional beta) { Object result = OnnxInterpreter.interpret(OnnxOps.Adam.class, List.of(R, T, inputs), List.of(epsilon, norm_coefficient_post, norm_coefficient, alpha, beta)); return (List>) result; } - - /// + + /// /// Performs element-wise binary addition (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Add(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Add.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Generates a 2D or 3D flow field (sampling grid), given a batch of affine matrices theta /// (https://pytorch.org/docs/stable/generated/torch.nn.functional.affine_grid.html). /// An affine matrix `theta` is applied to a position tensor represented in its homogeneous expression. Here is an example in 3D: @@ -206,10 +206,10 @@ public static Tensor Add(Tensor A, Tensor B) { /// ``` /// where `(x, y, z)` is the position in the original space, `(x', y', z')` is the position in the output space. /// The last row is always `[0, 0, 0, 1]` and is not stored in the affine matrix. Therefore we have `theta` of shape `(N, 2, 3)` for 2D or `(N, 3, 4)` for 3D. - /// + /// /// Input `size` is used to define grid of positions evenly spaced in the original 2D or 3D space, with dimensions ranging from `-1` to `1`. /// The output `grid` contains positions in the output space. - /// + /// /// When `align_corners=1`, consider `-1` and `1` to refer to the centers of the corner pixels (mark `v` in illustration). /// ``` /// v v v v @@ -226,18 +226,18 @@ public static Tensor AffineGrid(Tensor theta, Tensor size, Op Object result = OnnxInterpreter.interpret(OnnxOps.AffineGrid.class, List.of(theta, size), List.of(align_corners)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `and` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor And(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.And.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Computes the indices of the max elements of the input tensor's element along the /// provided axis. The resulting tensor has the same rank as the input if keepdims equals 1. /// If keepdims equals 0, then the resulting tensor has the reduced dimension pruned. @@ -249,8 +249,8 @@ public static Tensor ArgMax(Tensor data, Optional keepdims, O Object result = OnnxInterpreter.interpret(OnnxOps.ArgMax.class, List.of(data), List.of(keepdims, select_last_index, axis)); return (Tensor) result; } - - /// + + /// /// Computes the indices of the min elements of the input tensor's element along the /// provided axis. The resulting tensor has the same rank as the input if keepdims equals 1. /// If keepdims equals 0, then the resulting tensor has the reduced dimension pruned. @@ -262,65 +262,65 @@ public static Tensor ArgMin(Tensor data, Optional keepdims, O Object result = OnnxInterpreter.interpret(OnnxOps.ArgMin.class, List.of(data), List.of(keepdims, select_last_index, axis)); return (Tensor) result; } - - /// + + /// /// Select elements of the input tensor based on the indices passed.
/// The indices are applied to the last axes of the tensor. public static Tensor ArrayFeatureExtractor(Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.ArrayFeatureExtractor.class, List.of(X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the arcsine (inverse of sine) of the given input tensor, element-wise. public static Tensor Asin(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Asin.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic arcsine of the given input tensor element-wise. public static Tensor Asinh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Asinh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the arctangent (inverse of tangent) of the given input tensor, element-wise. public static Tensor Atan(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Atan.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic arctangent of the given input tensor element-wise. public static Tensor Atanh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Atanh.class, List.of(input), List.of()); return (Tensor) result; } - + public record AttentionResult(Tensor Y, Tensor present_key, Tensor present_value, Tensor qk_matmul_output) { } - /// - /// + /// + /// /// Computes scaled dot product attention on query, key and value tensors, using an optional attention mask if passed. - /// + /// /// This operator covers self and cross variants of the attention operation based on sequence lengths of K, Q and V. - /// + /// /// For self attention, `kv_sequence_length` equals to `q_sequence_length`. - /// + /// /// For cross attention, query and key might have different lengths. - /// + /// /// This operator also covers the 3 following variants based on the number of heads: /// 1) Multi-headed Attention (MHA): Described in the paper https://arxiv.org/pdf/1706.03762, `q_num_heads = kv_num_heads`. /// 2) Group-query Attention (GQA): Described in the paper https://arxiv.org/pdf/2305.13245, `q_num_heads > kv_num_heads`, `q_num_heads % kv_num_heads == 0`. /// 3) Multi-query Attention (MQA): Described in the paper https://arxiv.org/pdf/1911.02150, `q_num_heads > kv_num_heads`, `kv_num_heads=1`. - /// + /// /// Attention bias to be added is calculated based on `attn_mask` input and `is_causal` attribute: /// 1) `attn_mask`: A boolean mask where a value of `True` indicates that the element should take part in attention or a float mask of the same type as query, key, value that is added to the attention score. /// 2) If `is_causal` is set to `1`, attention scores above the diagonal are masked out, regardless of the `attn_mask` input. - /// + /// /// With respect to KV cache update, this operator allows the following two use cases: - /// + /// /// 1) Cache update happens inside the Attention operator. In this case, the `K` and `V` inputs contain only the incoming /// tokens for the current autoregressive step, and the four optional inputs/outputs past and present key and value are /// all needed. The Attention op performs a Concat operation on the past and incoming key and value to form the present @@ -332,10 +332,10 @@ public record AttentionResult(Tensor Y, Tensor present_key, Tens /// provided to indicate the number of non-padding tokens in each sample of the batch to save unnecessary computation. /// Here, the kv_sequence dimension of `attn_mask` can be shorter than `K` and `V`, but still needs to be at least as long /// as the maximum value of `nonpad_kv_seqlen`. - /// + /// /// Both past and present state key/values are optional. They shall be used together, and not allowed to use only one of them. /// The following pattern is applied to the Q, K and V inputs after appropriate reshaping of K and V inputs based on sequence lengths and num heads provided: - /// + /// /// ``` /// The following pattern is applied by this operator: /// Q K V @@ -361,8 +361,8 @@ public static AttentionResult Attention(Tensor Q, Tensor Object[] resultArray = (Object[]) result; return new AttentionResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2], (Tensor)resultArray[3]); } - - /// + + /// /// AveragePool consumes an input tensor X and applies average pooling across /// the tensor according to kernel sizes, stride sizes, and pad lengths. /// average pooling consisting of computing the average on all values of a @@ -378,7 +378,7 @@ public static AttentionResult Attention(Tensor Q, Tensor /// output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1) /// ``` /// if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`. Sliding windows that would start in the right padded region are ignored. - /// + /// /// `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled: /// ``` /// VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i]) @@ -394,14 +394,14 @@ public static AttentionResult Attention(Tensor Q, Tensor /// pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i] /// ``` /// The output of each pooling window is divided by the number of elements (exclude pad when attribute count_include_pad is zero). - /// + /// public static Tensor AveragePool(Tensor X, Optional pads, Optional dilations, Optional auto_pad, Optional count_include_pad, Optional ceil_mode, Optional strides, long[] kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.AveragePool.class, List.of(X), List.of(pads, dilations, auto_pad, count_include_pad, ceil_mode, strides, kernel_shape)); return (Tensor) result; } - + public record BatchNormalizationResult(Tensor Y, Tensor running_mean, Tensor running_var) { } - /// + /// /// Carries out batch normalization as described in the paper /// https://arxiv.org/abs/1502.03167. Depending on the mode it is being run, /// There are five required inputs 'X', 'scale', 'B', 'input_mean' and @@ -410,16 +410,16 @@ public record BatchNormalizationResult(Tensor Y, Tensor running_me /// statistics in inference mode (training_mode=False, default), /// and the running statistics in training mode (training_mode=True). /// There are multiple cases for the number of outputs, which we list below: - /// + /// /// * Output case #1: Y, running_mean, running_var (training_mode=True) /// * Output case #2: Y (training_mode=False) - /// + /// /// When training_mode=False, extra outputs are invalid. /// The outputs are updated as follows when training_mode=True: /// ``` /// running_mean = input_mean * momentum + current_mean * (1 - momentum) /// running_var = input_var * momentum + current_var * (1 - momentum) - /// + /// /// Y = (X - current_mean) / sqrt(current_var + epsilon) * scale + B /// ``` /// where: @@ -430,14 +430,14 @@ public record BatchNormalizationResult(Tensor Y, Tensor running_me /// Notice that `ReduceVar` refers to the population variance, and it equals to /// `sum(sqrd(x_i - x_avg)) / N` /// where `N` is the population size (this formula does not use sample size `N - 1`). - /// + /// /// The computation of ReduceMean and ReduceVar uses float to avoid overflow for float16 inputs. - /// + /// /// When training_mode=False: /// ``` /// Y = (X - input_mean) / sqrt(input_var + epsilon) * scale + B /// ``` - /// + /// /// For previous (depreciated) non-spatial cases, implementors are suggested /// to flatten the input shape to (N x C * D1 * D2 * ... * Dn) before a BatchNormalization Op. /// This operator has **optional** inputs/outputs. See [the doc](IR.md) for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted. @@ -446,31 +446,31 @@ public static BatchNormalizationResult BatchNormalization(Ten Object[] resultArray = (Object[]) result; return new BatchNormalizationResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// Draws binary random numbers (0 or 1) from a Bernoulli distribution. The input tensor should be a tensor /// containing probabilities p (a value in the range [0,1]) to be used for drawing the binary random number, /// where an output of 1 is produced with probability p and an output of 0 is produced with probability (1-p). - /// + /// /// This operator is non-deterministic and may not produce the same values in different /// implementations (even if a seed is specified). public static Tensor Bernoulli(Tensor input, Optional seed, Optional dtype) { Object result = OnnxInterpreter.interpret(OnnxOps.Bernoulli.class, List.of(input), List.of(seed, dtype)); return (Tensor) result; } - - /// + + /// /// Maps the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value. public static Tensor Binarizer(Tensor X, Optional threshold) { Object result = OnnxInterpreter.interpret(OnnxOps.Binarizer.class, List.of(X), List.of(threshold)); return (Tensor) result; } - - /// + + /// /// Reinterprets the binary representation of a tensor as a different data type, /// specified by the 'to' attribute. Unlike Cast, BitCast preserves the exact bit /// pattern without any value conversion. - /// + /// /// The target data type must have the same bit-width as the input data type. /// The output tensor has the same shape as the input tensor. /// All types except string are supported. Implementations must treat the @@ -479,8 +479,8 @@ public static Tensor BitCast(Tensor input, long to) { Object result = OnnxInterpreter.interpret(OnnxOps.BitCast.class, List.of(input), List.of(to)); return (Tensor) result; } - - /// + + /// /// Bitwise shift operator performs element-wise operation. For each input element, if the /// attribute "direction" is "RIGHT", this operator moves its binary representation toward /// the right side so that the input value is effectively decreased. If the attribute "direction" @@ -489,7 +489,7 @@ public static Tensor BitCast(Tensor input, long to) { /// Y specifies the amounts of shifting. For example, if "direction" is "Right", X is [1, 4], /// and S is [1, 1], the corresponding output Z would be [0, 2]. If "direction" is "LEFT" with /// X=[1, 2] and S=[1, 2], the corresponding output Y would be [2, 8]. - /// + /// /// Because this operator supports Numpy-style broadcasting, X's and Y's shapes are /// not necessarily identical. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -497,57 +497,57 @@ public static Tensor BitShift(Tensor X, Tensor Y, String direction) Object result = OnnxInterpreter.interpret(OnnxOps.BitShift.class, List.of(X, Y), List.of(direction)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulting from performing the bitwise `and` operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor BitwiseAnd(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseAnd.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the bitwise not of the input tensor element-wise. public static Tensor BitwiseNot(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseNot.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulting from performing the bitwise `or` operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor BitwiseOr(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseOr.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulting from performing the bitwise `xor` operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor BitwiseXor(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseXor.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Generates a Blackman window as described in the paper https://ieeexplore.ieee.org/document/1455106. public static Tensor BlackmanWindow(Tensor size, Optional periodic, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.BlackmanWindow.class, List.of(size), List.of(periodic, output_datatype)); return (Tensor) result; } - - /// + + /// /// The operator casts the elements of a given input tensor to a data type /// specified by the 'to' argument and returns an output tensor of the same size in /// the converted type. The 'to' argument must be one of the data types specified /// in the 'DataType' enum field in the TensorProto message. - /// + /// /// Casting from string tensor in plain (e.g., "3.14" and "1000") and scientific numeric representations /// (e.g., "1e-5" and "1E8") to float types is supported. For example, converting string "100.5" to an integer may /// yield result 100. There are some string literals reserved for special floating-point values; @@ -557,15 +557,15 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// to string tensors, plain floating-point representation (such as "314.15926") would be used. /// Converting non-numerical-literal string such as "Hello World!" is an undefined behavior. Cases /// of converting string representing floating-point arithmetic value, such as "2.718", to INT is an undefined behavior. - /// + /// /// Conversion from a numerical type to any numerical type is always allowed. /// User must be aware of precision loss and value change caused by range difference between two types. /// For example, a 64-bit float 3.1415926459 may be round to a 32-bit float 3.141592. Similarly, converting /// an integer 36 to Boolean may produce 1 because we truncate bits which can't be stored in the targeted type. - /// + /// /// In more detail, the conversion among numerical types should follow these rules /// if the destination type is not a float 8 type. - /// + /// /// * Casting from floating point to: /// * floating point: +/- infinity if OOR (out of range). /// * fixed point: undefined if OOR. @@ -579,12 +579,12 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// * floating point: `{1.0, 0.0}`. /// * fixed point: `{1, 0}`. /// * bool: no change. - /// + /// /// Float 8 types (E4M3FN, E4M3FNUZ, E5M2, E5M2FNUZ) were introduced to speed up the training of /// deep models. By default the conversion of a float *x* obeys /// to the following rules. `[x]` means the value rounded to /// the target mantissa width. - /// + /// /// | x | E4M3FN | E4M3FNUZ | E5M2 | E5M2FNUZ | /// | ----------------- | -------- | -------- | -------- | -------- | /// | 0 | 0 | 0 | 0 | 0 | @@ -595,10 +595,10 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// | \[x\] > FLT_MAX | FLT_MAX | FLT_MAX | FLT_MAX | FLT_MAX | /// | \[x\] \< -FLT_MAX | -FLT_MAX | -FLT_MAX | -FLT_MAX | -FLT_MAX | /// | else | RNE | RNE | RNE | RNE | - /// + /// /// The behavior changes if the parameter 'saturate' is set to False. /// The rules then become: - /// + /// /// | x | E4M3FN | E4M3FNUZ | E5M2 | E5M2FNUZ | /// | ----------------- | ------ | -------- | ---- | -------- | /// | 0 | 0 | 0 | 0 | 0 | @@ -610,12 +610,12 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// | \[x\] > FLT_MAX | NaN | NaN | Inf | NaN | /// | \[x\] \< -FLT_MAX | NaN | NaN | -Inf | NaN | /// | else | RNE | RNE | RNE | RNE | - /// + /// /// FLOAT8E8M0 type was introduced to enable [Microscaling (MX) formats](https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf). /// When casting to FLOAT8E8M0, the rounding behavior can be specified using the `round_mode` and `saturate` attributes. /// The current CUDA behavior is to round up and saturate. Casting negative values to FLOAT8E8M0 gives undefined behavior. /// The following table describes the casting behavior of special values to FLOAT8E8M0 in the two most common cases. - /// + /// /// | x | saturate + up | non-saturate + nearest | /// | ----------------- | ------------- | --------------------- | /// | 0 | 0 | NaN | @@ -629,8 +629,8 @@ public static Tensor Cast(Tensor input, Optional saturate Object result = OnnxInterpreter.interpret(OnnxOps.Cast.class, List.of(input), List.of(saturate, to, round_mode)); return (Tensor) result; } - - /// + + /// /// The operator casts the elements of a given input tensor (the first input) to /// the same data type as the elements of the second input tensor. /// See documentation of the Cast operator for further details. @@ -638,8 +638,8 @@ public static Tensor CastLike(Tensor input, Tensor target_t Object result = OnnxInterpreter.interpret(OnnxOps.CastLike.class, List.of(input, target_type), List.of(saturate, round_mode)); return (Tensor) result; } - - /// + + /// /// Converts a map to a tensor.
The map key must be an int64 and the values will be ordered /// in ascending order based on this key.
The operator supports dense packing or sparse packing. /// If using sparse packing, the key cannot exceed the max_map-1 value. @@ -647,8 +647,8 @@ public static Tensor CastMap(Map X, Optional map_ Object result = OnnxInterpreter.interpret(OnnxOps.CastMap.class, List.of(X), List.of(map_form, cast_to, max_map)); return (Tensor) result; } - - /// + + /// /// Converts strings to integers and vice versa.
/// Two sequences of equal length are used to map between integers and strings, /// with strings and integers at the same index detailing the mapping.
@@ -661,34 +661,34 @@ public static Tensor CategoryMapper(Tensor X, Optional Object result = OnnxInterpreter.interpret(OnnxOps.CategoryMapper.class, List.of(X), List.of(cats_int64s, cats_strings, default_int64, default_string)); return (Tensor) result; } - + public record CausalConvWithStateResult(Tensor output, Tensor present_state) { } - /// - /// + /// + /// /// Stateful causal 1D depthwise convolution. - /// + /// /// Used by Gated DeltaNet (Qwen3.5) and Mamba (Jamba, FalconMamba) as a preprocessing step. /// Replaces the 3-op pattern (Concat + Conv + Slice) with a single fused operation. - /// + /// /// The convolution is causal (looks only at current and past positions) and depthwise /// (each channel is convolved independently with its own kernel). - /// + /// /// The input, weight, past_state, output, and present_state tensors are rank-3 with /// shape (batch_size, channels, length). The optional bias input is rank-1 with /// shape (channels). For higher-dimensional data, use Reshape nodes before and /// after this operator to pack extra dimensions into the batch or channel axis. - /// + /// /// Weight layout: (channels, 1, k) for depthwise convolution. /// The carry state stores the last (k-1) positions for incremental decode. - /// + /// /// The optional activation attribute supports fused SiLU/Swish activation. public static CausalConvWithStateResult CausalConvWithState(Tensor input, Tensor weight, Optional> bias, Optional> past_state, Optional activation) { Object result = OnnxInterpreter.interpret(OnnxOps.CausalConvWithState.class, List.of(input, weight, bias, past_state), List.of(activation)); Object[] resultArray = (Object[]) result; return new CausalConvWithStateResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Ceil takes one input data (Tensor) and produces one output data /// (Tensor) where the ceil is, y = ceil(x), is applied to /// the tensor elementwise. If x is integral, +0, -0, NaN, or infinite, x itself is returned. @@ -696,12 +696,12 @@ public static Tensor Ceil(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Ceil.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Continuously Differentiable Exponential Linear Units: /// Perform the linear unit element-wise on the input tensor X /// using formula: - /// + /// /// ``` /// max(0,x) + min(0,alpha*(exp(x/alpha)-1)) /// ``` @@ -709,28 +709,28 @@ public static Tensor Celu(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.Celu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Center crop or pad an input to given dimensions. - /// + /// /// The crop/pad dimensions can be specified for a subset of the `axes`; unspecified dimensions will remain unchanged. - /// + /// /// If the input dimensions are larger than the target crop dimensions, a centered cropping window will be extracted /// from the input. The starting value for the cropping window is rounded down, which means that if the difference /// between the input shape and the crop shape is odd, the cropping window will be shifted half a pixel to the left /// of the input center. - /// + /// /// If the input dimensions are smaller than the target crop dimensions, the input will be padded equally on both sides /// to center it in the output. In cases where the total number of padding pixels is odd, an additional pixel will be /// added to the right side. - /// + /// /// The padding value used is zero. public static Tensor CenterCropPad(Tensor input_data, Tensor shape, Optional axes) { Object result = OnnxInterpreter.interpret(OnnxOps.CenterCropPad.class, List.of(input_data, shape), List.of(axes)); return (Tensor) result; } - - /// + + /// /// Clip operator limits the given input within an interval. The interval is /// specified by the inputs 'min' and 'max'. They default to /// numeric_limits::lowest() and numeric_limits::max(), respectively. @@ -740,14 +740,14 @@ public static Tensor Clip(Tensor input, Optional> min, Optio Object result = OnnxInterpreter.interpret(OnnxOps.Clip.class, List.of(input, min, max), List.of()); return (Tensor) result; } - - /// + + /// /// The operator rearranges column blocks back into a multidimensional image - /// + /// /// Col2Im behaves similarly to PyTorch's fold https://pytorch.org/docs/stable/generated/torch.nn.Fold.html, /// but it only supports *batched* multi-dimensional image tensors. /// Another implementation in Python with N-dimension support can be found at https://github.com/f-dangel/unfoldNd/. - /// + /// /// NOTE: /// Although specifying image_shape looks redundant because it could be calculated from /// convolution formulas, it is required as input for more advanced scenarios as explained @@ -756,24 +756,24 @@ public static Tensor Col2Im(Tensor input, Tensor image_shape, Te Object result = OnnxInterpreter.interpret(OnnxOps.Col2Im.class, List.of(input, image_shape, block_shape), List.of(pads, dilations, strides)); return (Tensor) result; } - - /// + + /// /// Selects slices from an input tensor along a given axis where condition evaluates to True for each axis index. /// In case axis is not provided, input is flattened before elements are selected. /// Compress behaves like numpy.compress: https://docs.scipy.org/doc/numpy/reference/generated/numpy.compress.html - /// + /// public static Tensor Compress(Tensor input, Tensor condition, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Compress.class, List.of(input, condition), List.of(axis)); return (Tensor) result; } - + /// Concatenate a list of tensors into a single tensor. All input tensors must have the same shape, except for the dimension size of the axis to concatenate on. public static Tensor Concat(List> inputs, long axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Concat.class, List.of(inputs), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Concatenate a sequence of tensors into a single tensor. /// All input tensors must have the same shape, except for the dimension size of the axis to concatenate on. /// By default 'new_axis' is 0, the behavior is similar to numpy.concatenate. @@ -782,78 +782,78 @@ public static Tensor ConcatFromSequence(List> input_sequence Object result = OnnxInterpreter.interpret(OnnxOps.ConcatFromSequence.class, List.of(input_sequence), List.of(axis, new_axis)); return (Tensor) result; } - - /// + + /// /// This operator produces a constant tensor. Exactly one of the provided attributes, either value, sparse_value, /// or value_* must be specified. public static Tensor Constant(Optional value_int, Optional value_floats, Optional value_strings, Optional value_float, Optional value_string, Optional value_ints, Optional sparse_value, Optional value) { Object result = OnnxInterpreter.interpret(OnnxOps.Constant.class, List.of(), List.of(value_int, value_floats, value_strings, value_float, value_string, value_ints, sparse_value, value)); return (Tensor) result; } - - /// + + /// /// Generate a tensor with given value and shape. public static Tensor ConstantOfShape(Tensor input, Optional value) { Object result = OnnxInterpreter.interpret(OnnxOps.ConstantOfShape.class, List.of(input), List.of(value)); return (Tensor) result; } - - /// + + /// /// The convolution operator consumes an input tensor and a filter, and /// computes the output. public static Tensor Conv(Tensor X, Tensor W, Optional> B, Optional pads, Optional dilations, Optional auto_pad, Optional strides, Optional group, Optional kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.Conv.class, List.of(X, W, B), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); return (Tensor) result; } - - /// + + /// /// The integer convolution operator consumes an input tensor, its zero-point, a filter, and its zero-point, /// and computes the output. The production MUST never overflow. The accumulation may overflow if and only if in 32 bits. public static Tensor ConvInteger(Tensor x, Tensor w, Optional> x_zero_point, Optional> w_zero_point, Optional pads, Optional dilations, Optional auto_pad, Optional strides, Optional group, Optional kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.ConvInteger.class, List.of(x, w, x_zero_point, w_zero_point), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); return (Tensor) result; } - - /// + + /// /// The convolution transpose operator consumes an input tensor and a filter, /// and computes the output. - /// + /// /// If the pads parameter is provided the shape of the output is calculated via the following equation: - /// + /// /// output_shape[i] = stride[i] * (input_size[i] - 1) + output_padding[i] + ((kernel_shape[i] - 1) * dilations[i] + 1) - pads[start_i] - pads[end_i] - /// + /// /// output_shape can also be explicitly specified in which case pads values are auto generated using these equations: - /// + /// /// total_padding[i] = stride[i] * (input_size[i] - 1) + output_padding[i] + ((kernel_shape[i] - 1) * dilations[i] + 1) - output_shape[i] /// If (auto_pads == SAME_UPPER): pads[start_i] = total_padding[i]/2; pads[end_i] = total_padding[i] - (total_padding[i]/2) /// Else: pads[start_i] = total_padding[i] - (total_padding[i]/2); pads[end_i] = (total_padding[i]/2). - /// - /// + /// + /// public static Tensor ConvTranspose(Tensor X, Tensor W, Optional> B, Optional output_shape, Optional pads, Optional dilations, Optional auto_pad, Optional strides, Optional group, Optional kernel_shape, Optional output_padding) { Object result = OnnxInterpreter.interpret(OnnxOps.ConvTranspose.class, List.of(X, W, B), List.of(output_shape, pads, dilations, auto_pad, strides, group, kernel_shape, output_padding)); return (Tensor) result; } - - /// + + /// /// Calculates the cosine of the given input tensor, element-wise. public static Tensor Cos(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Cos.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic cosine of the given input tensor element-wise. public static Tensor Cosh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Cosh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Performs cumulative product of the input elements along the given axis. /// By default, it will do the product inclusively meaning the first element is copied as is. /// Through an `exclusive` attribute, this behavior can change to exclude the first element. /// It can also perform product in the opposite direction of the axis. For that, set `reverse` attribute to 1. - /// + /// /// Example: /// ``` /// input_x = [1, 2, 3] @@ -868,18 +868,18 @@ public static Tensor Cosh(Tensor input) { /// reverse=1 /// output = [6, 3, 1] /// ``` - /// + /// public static Tensor CumProd(Tensor x, Tensor axis, Optional exclusive, Optional reverse) { Object result = OnnxInterpreter.interpret(OnnxOps.CumProd.class, List.of(x, axis), List.of(exclusive, reverse)); return (Tensor) result; } - - /// + + /// /// Performs cumulative sum of the input elements along the given axis. /// By default, it will do the sum inclusively meaning the first element is copied as is. /// Through an `exclusive` attribute, this behavior can change to exclude the first element. /// It can also perform summation in the opposite direction of the axis. For that, set `reverse` attribute to 1. - /// + /// /// Example: /// ``` /// input_x = [1, 2, 3] @@ -894,59 +894,59 @@ public static Tensor CumProd(Tensor x, Tensor axis, Optional Tensor CumSum(Tensor x, Tensor axis, Optional exclusive, Optional reverse) { Object result = OnnxInterpreter.interpret(OnnxOps.CumSum.class, List.of(x, axis), List.of(exclusive, reverse)); return (Tensor) result; } - + /// Computes the discrete Fourier Transform (DFT) of the input. - /// + /// /// Assuming the input has shape `[M, N]`, where `N` is the dimension over which the /// DFT is computed and `M` denotes the conceptual "all other dimensions," /// the DFT `y[m, k]` of shape `[M, N]` is defined as - /// + /// /// $$y[m, k] = \sum_{n=0}^{N-1} e^{-2 \pi j \frac{k n}{N} } x[m, n] ,$$ - /// + /// /// and the inverse transform is defined as - /// + /// /// $$x[m, n] = \frac{1}{N} \sum_{k=0}^{N-1} e^{2 \pi j \frac{k n}{N} } y[m, k] ,$$ - /// + /// /// where $j$ is the imaginary unit. - /// + /// /// The actual shape of the output is specified in the "output" section. - /// + /// /// Reference: https://docs.scipy.org/doc/scipy/tutorial/fft.html public static Tensor DFT(Tensor input, Optional> dft_length, Optional> axis, Optional inverse, Optional onesided) { Object result = OnnxInterpreter.interpret(OnnxOps.DFT.class, List.of(input, dft_length, axis), List.of(inverse, onesided)); return (Tensor) result; } - - /// + + /// /// Performs deformable convolution as described in https://arxiv.org/abs/1703.06211 and https://arxiv.org/abs/1811.11168. /// This operator specification supports the general N-D case. Note that most common use cases have 2D or 3D data. public static Tensor DeformConv(Tensor X, Tensor W, Tensor offset, Optional> B, Optional> mask, Optional pads, Optional dilations, Optional strides, Optional offset_group, Optional group, Optional kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.DeformConv.class, List.of(X, W, offset, B, mask), List.of(pads, dilations, strides, offset_group, group, kernel_shape)); return (Tensor) result; } - + /// DepthToSpace rearranges (permutes) data from depth into blocks of spatial data. /// This is the reverse transformation of SpaceToDepth. More specifically, this op outputs a copy of /// the input tensor where values from the depth dimension are moved in spatial blocks to the height /// and width dimensions. By default, `mode` = `DCR`. /// In the DCR mode, elements along the depth dimension from the input tensor are rearranged in the /// following order: depth, column, and then row. The output y is computed from the input x as below: - /// + /// /// ``` /// b, c, h, w = x.shape /// tmp = np.reshape(x, [b, blocksize, blocksize, c // (blocksize**2), h, w]) /// tmp = np.transpose(tmp, [0, 3, 4, 1, 5, 2]) /// y = np.reshape(tmp, [b, c // (blocksize**2), h * blocksize, w * blocksize]) /// ``` - /// + /// /// In the CRD mode, elements along the depth dimension from the input tensor are rearranged in the /// following order: column, row, and the depth. The output y is computed from the input x as below: - /// + /// /// ``` /// b, c, h, w = x.shape /// tmp = np.reshape(x, [b, c // (blocksize ** 2), blocksize, blocksize, h, w]) @@ -957,14 +957,14 @@ public static Tensor DepthToSpace(Tensor input, Optional mode, Object result = OnnxInterpreter.interpret(OnnxOps.DepthToSpace.class, List.of(input), List.of(mode, blocksize)); return (Tensor) result; } - - /// + + /// /// The linear dequantization operator. It consumes a quantized tensor, a scale, and a zero point to compute the /// full-precision tensor. The dequantization formula is `y = (x - x_zero_point) * x_scale`. `x_scale` and `x_zero_point` /// must have the same shape, determining the quantization's granularity: a scalar for per-tensor/per-layer quantization, /// a 1-D tensor for per-axis quantization, or have a rank identical to the input for blocked quantization. /// See QuantizeLinear for details on quantization granularity. - /// + /// /// `x_zero_point` and `x` must have the same type. `x` and `y` must have the same shape. In the case of dequantizing /// `int32`, there's no zero point (zero point is supposed to be 0). /// `zero-point` is usually not used in the case of float8 and 4-bit types quantization, but the dequantization formula remains the same @@ -974,8 +974,8 @@ public static Tensor DequantizeLinear(Tensor x, Tensor Object result = OnnxInterpreter.interpret(OnnxOps.DequantizeLinear.class, List.of(x, x_scale, x_zero_point), List.of(output_dtype, axis, block_size)); return (Tensor) result; } - - /// + + /// /// Det calculates determinant of a square matrix or batches of square matrices. /// Det takes one input tensor of shape `[*, M, M]`, where `*` is zero or more batch dimensions, /// and the inner-most 2 dimensions form square matrices. @@ -985,8 +985,8 @@ public static Tensor Det(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Det.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Uses an index mapping to convert a dictionary to an array.
/// Given a dictionary, each key is looked up in the vocabulary attribute corresponding to /// the key type. The index into the vocabulary array at which the key is found is then @@ -998,26 +998,26 @@ public static Tensor Det(Tensor X) { /// Any keys not present in the input dictionary, will be zero in the output array.
/// For example: if the ``string_vocabulary`` parameter is set to ``["a", "c", "b", "z"]``, /// then an input of ``{"a": 4, "c": 8}`` will produce an output of ``[4, 8, 0, 0]``. - /// + /// public static Tensor DictVectorizer(Map X, Optional string_vocabulary, Optional int64_vocabulary) { Object result = OnnxInterpreter.interpret(OnnxOps.DictVectorizer.class, List.of(X), List.of(string_vocabulary, int64_vocabulary)); return (Tensor) result; } - - /// + + /// /// Performs element-wise binary division (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// For integer inputs, the result is computed using truncating division (rounding toward zero). /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Div(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Div.class, List.of(A, B), List.of()); return (Tensor) result; } - + public record DropoutResult(Tensor output, Tensor mask) { } - /// + /// /// Dropout takes an input floating-point tensor, an optional input ratio (floating-point scalar) and an optional input training_mode (boolean scalar). It produces two tensor outputs, /// output (floating-point tensor) and mask (optional `Tensor`). If `training_mode` is true then the output Y will be a random dropout; /// Note that this Dropout scales the masked input data by the following equation, so to convert the trained model into inference mode, @@ -1035,34 +1035,34 @@ public static DropoutResult Dropout(Tensor data, Optional((Tensor)resultArray[0], (Tensor)resultArray[1]); } - + public record DynamicQuantizeLinearResult(Tensor y, Tensor y_scale, Tensor y_zero_point) { } - /// + /// /// A Function to fuse calculation for Scale, Zero Point and FP32->8Bit conversion of FP32 Input data. /// Outputs Scale, ZeroPoint and Quantized Input for a given FP32 Input. /// Scale is calculated as: /// ``` /// y_scale = (maximum(0, max(x)) - minimum(0, min(x))) / (qmax - qmin) /// ``` - /// + /// /// * where qmax and qmin are max and min values for quantization range i.e. [0, 255] in case of uint8 /// * data range is adjusted to include 0. - /// + /// /// Zero point is calculated as: /// ``` /// intermediate_zero_point = qmin - min(x)/y_scale /// y_zero_point = cast(round(saturate(intermediate_zero_point))) /// ``` - /// + /// /// * where qmax and qmin are max and min values for quantization range .i.e [0, 255] in case of uint8 /// * for saturation, it saturates to [0, 255] if it's uint8, or [-127, 127] if it's int8. Right now only uint8 is supported. /// * rounding to nearest ties to even. - /// + /// /// Data quantization formula is: /// ``` /// y = saturate (round (x / y_scale) + y_zero_point) /// ``` - /// + /// /// * for saturation, it saturates to [0, 255] if it's uint8, or [-127, 127] if it's int8. Right now only uint8 is supported. /// * rounding to nearest ties to even. public static DynamicQuantizeLinearResult DynamicQuantizeLinear(Tensor x) { @@ -1070,29 +1070,29 @@ public static DynamicQuantizeLinearResult DynamicQuantizeLinear(Tensor x) Object[] resultArray = (Object[]) result; return new DynamicQuantizeLinearResult((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// An einsum of the form `term1, term2 -> output-term` produces an output tensor using the following equation - /// + /// /// ``` /// output[output-term] = reduce-sum( input1[term1] * input2[term2] ) /// ``` - /// + /// /// where the reduce-sum performs a summation over all the indices occurring in the input terms (term1, term2) /// that do not occur in the output-term. - /// + /// /// The Einsum operator evaluates algebraic tensor operations on a sequence of tensors, using the Einstein summation /// convention. The equation string contains a comma-separated sequence of lower case letters. Each term corresponds to /// an operand tensor, and the characters within the terms correspond to operands dimensions. - /// + /// /// This sequence may be followed by "->" to separate the left and right hand side of the equation. /// If the equation contains "->" followed by the right-hand side, the explicit (not classical) form of the Einstein /// summation is performed, and the right-hand side indices indicate output tensor dimensions. In other cases, /// output indices are (implicitly) set to the alphabetically sorted sequence of indices appearing exactly once in the /// equation. - /// + /// /// When a dimension character is repeated in the left-hand side, it represents summation along the dimension. - /// + /// /// The equation may contain ellipsis ("...") to enable broadcasting. Ellipsis must indicate a fixed number of dimensions. /// Specifically, every occurrence of ellipsis in the equation must represent the same number of dimensions. /// The right-hand side may contain exactly one ellipsis. In implicit mode, the ellipsis dimensions are set to the @@ -1101,8 +1101,8 @@ public static Tensor Einsum(List> Inputs, String equation) { Object result = OnnxInterpreter.interpret(OnnxOps.Einsum.class, List.of(Inputs), List.of(equation)); return (Tensor) result; } - - /// + + /// /// Elu takes one input data (Tensor) and produces one output data /// (Tensor) where the function `f(x) = alpha * (exp(x) - 1.) for x < /// 0`, `f(x) = x for x >= 0`., is applied to the tensor elementwise. @@ -1110,32 +1110,32 @@ public static Tensor Elu(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.Elu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `equal` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Equal(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Equal.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Computes the error function of the given input tensor element-wise. public static Tensor Erf(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Erf.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the exponential of the given input tensor, element-wise. public static Tensor Exp(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Exp.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Broadcast the input tensor following the given shape and the broadcast rule. /// The broadcast rule is similar to numpy.array(input) * numpy.ones(shape): /// Dimensions are right alignment; @@ -1148,8 +1148,8 @@ public static Tensor Expand(Tensor input, Tensor shape) { Object result = OnnxInterpreter.interpret(OnnxOps.Expand.class, List.of(input, shape), List.of()); return (Tensor) result; } - - /// + + /// /// Generate a 2D tensor (matrix) with ones on the diagonal and zeros everywhere else. Only 2D /// tensors are supported, i.e. input T1 must be of rank 2. The shape of the output tensor is the /// same as the input tensor. The data type can be specified by the 'dtype' argument. If @@ -1161,8 +1161,8 @@ public static Tensor EyeLike(Tensor input, Optional dtype Object result = OnnxInterpreter.interpret(OnnxOps.EyeLike.class, List.of(input), List.of(dtype, k)); return (Tensor) result; } - - /// + + /// /// Concatenates input tensors into one continuous output.
/// All input shapes are 2-D and are concatenated along the second dimension. 1-D tensors are treated as [1,C]. /// Inputs are copied to the output maintaining the order of the input arguments.
@@ -1171,8 +1171,8 @@ public static Tensor FeatureVectorizer(List> X, Optional< Object result = OnnxInterpreter.interpret(OnnxOps.FeatureVectorizer.class, List.of(X), List.of(inputdimensions)); return (Tensor) result; } - - /// + + /// /// Flattens the input tensor into a 2D matrix. If input tensor has shape /// (d_0, d_1, ... d_n) then the output will have shape /// (d_0 X d_1 ... d_(axis-1), d_axis X d_(axis+1) ... X dn). @@ -1180,8 +1180,8 @@ public static Tensor Flatten(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Flatten.class, List.of(input), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Floor takes one input data (Tensor) and produces one output data /// (Tensor) where the floor is, y = floor(x), is applied to /// the tensor elementwise. If x is integral, +0, -0, NaN, or infinite, x itself is returned. @@ -1189,14 +1189,14 @@ public static Tensor Floor(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Floor.class, List.of(X), List.of()); return (Tensor) result; } - + public record GRUResult(Tensor Y, Tensor Y_h) { } - /// + /// /// Computes an one-layer GRU. This operator is usually supported via some custom /// implementation such as CuDNN. - /// + /// /// Notations: - /// + /// /// * `X` - input tensor /// * `z` - update gate /// * `r` - reset gate @@ -1212,16 +1212,16 @@ public record GRUResult(Tensor Y, Tensor Y_h) { } /// * `RBb[zrh]` - R bias vectors for backward update, reset, and hidden gates /// * `H` - Hidden state /// * `num_directions` - 2 if direction == bidirectional else 1 - /// + /// /// Activation functions: - /// + /// /// * Relu(x) - max(0, x) /// * Tanh(x) - (1 - e^{-2x})/(1 + e^{-2x}) /// * Sigmoid(x) - 1/(1 + e^{-x}) - /// + /// /// NOTE: /// Below are optional - /// + /// /// * Affine(x) - alpha * x + beta /// * LeakyRelu(x) - x if x >= 0 else alpha * x /// * ThresholdedRelu(x) - x if x >= alpha else 0 @@ -1230,9 +1230,9 @@ public record GRUResult(Tensor Y, Tensor Y_h) { } /// * Elu(x) - x if x >= 0 else alpha * (e^x - 1) /// * Softsign(x) - x/(1 + |x|) /// * Softplus(x) - log(1 + e^x) - /// + /// /// Equations (Default: f=Sigmoid, g=Tanh): - /// + /// /// * zt = f(Xt*(Wz^T) + Ht-1*(Rz^T) + Wbz + Rbz) /// * rt = f(Xt*(Wr^T) + Ht-1*(Rr^T) + Wbr + Rbr) /// * ht = g(Xt*(Wh^T) + (rt (.) Ht-1)*(Rh^T) + Rbh + Wbh) # default, when linear_before_reset = 0 @@ -1244,18 +1244,18 @@ public static GRUResult GRU(Tensor X, Tensor W, Tensor R, Option Object[] resultArray = (Object[]) result; return new GRUResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Given `data` tensor of rank r >= 1, and `indices` tensor of rank q, gather /// entries of the axis dimension of `data` (by default outer-most one as axis=0) indexed by `indices`, and concatenates /// them in an output tensor of rank q + (r - 1). - /// + /// /// It is an indexing operation that indexes into the input `data` along a single (specified) axis. /// Each entry in `indices` produces a `r-1` dimensional slice of the input tensor. /// The entire operation produces, conceptually, a `q`-dimensional tensor of `r-1` dimensional slices, /// which is arranged into a `q + (r-1)`-dimensional tensor, with the `q` dimensions taking the /// place of the original `axis` that is being indexed into. - /// + /// /// The following few examples illustrate how `Gather` works for specific shapes of `data`, /// `indices`, and given value of `axis`: /// | data shape | indices shape | axis | output shape | output equation | @@ -1264,10 +1264,10 @@ public static GRUResult GRU(Tensor X, Tensor W, Tensor R, Option /// | (P, Q, R) | ( ) (a scalar) | 1 | (P, R) | output[p, r] = data[p, indices, r] | /// | (P, Q) | (R, S) | 0 | (R, S, Q) | output[r, s, q] = data[ [indices[r, s], q] | /// | (P, Q) | (R, S) | 1 | (P, R, S) | output[p, r, s] = data[ p, indices[r, s]] | - /// + /// /// More generally, if `axis = 0`, let `k = indices[i_{0}, ..., i_{q-1}]` /// then `output[i_{0}, ..., i_{q-1}, j_{0}, ..., j_{r-2}] = input[k , j_{0}, ..., j_{r-2}]`: - /// + /// /// ``` /// data = [ /// [1.0, 1.2], @@ -1289,10 +1289,10 @@ public static GRUResult GRU(Tensor X, Tensor W, Tensor R, Option /// ], /// ] /// ``` - /// + /// /// If `axis = 1`, let `k = indices[i_{0}, ..., i_{q-1}]` /// then `output[j_{0}, i_{0}, ..., i_{q-1}, j_{1}, ..., j_{r-2}] = input[j_{0}, k, j_{1}, ..., j_{r-2}]`: - /// + /// /// ``` /// data = [ /// [1.0, 1.2, 1.9], @@ -1313,9 +1313,9 @@ public static Tensor Gather(Tensor data, Tensor indices, O Object result = OnnxInterpreter.interpret(OnnxOps.Gather.class, List.of(data, indices), List.of(axis)); return (Tensor) result; } - - /// - /// + + /// + /// /// GatherElements takes two inputs `data` and `indices` of the same rank r >= 1 /// and an optional attribute `axis` that identifies an axis of `data` /// (by default, the outer-most axis, that is axis 0). It is an indexing operation @@ -1323,7 +1323,7 @@ public static Tensor Gather(Tensor data, Tensor indices, O /// positions determined by elements of the `indices` tensor. /// Its output shape is the same as the shape of `indices` and consists of one value /// (gathered from the `data`) for each element in `indices`. - /// + /// /// For instance, in the 3-D case (r = 3), the output produced is determined /// by the following equations: /// ``` @@ -1331,9 +1331,9 @@ public static Tensor Gather(Tensor data, Tensor indices, O /// out[i][j][k] = input[i][index[i][j][k]][k] if axis = 1, /// out[i][j][k] = input[i][j][index[i][j][k]] if axis = 2, /// ``` - /// + /// /// This operator is also the inverse of ScatterElements. It is similar to Torch's gather operation. - /// + /// /// Example 1: /// ``` /// data = [ @@ -1371,86 +1371,86 @@ public static Tensor GatherElements(Tensor data, Tensor in Object result = OnnxInterpreter.interpret(OnnxOps.GatherElements.class, List.of(data, indices), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Given `data` tensor of rank `r` >= 1, `indices` tensor of rank `q` >= 1, and `batch_dims` integer `b`, this operator gathers /// slices of `data` into an output tensor of rank `q + r - indices_shape[-1] - 1 - b`. - /// + /// /// `indices` is an q-dimensional integer tensor, best thought of as a `(q-1)`-dimensional tensor of index-tuples into `data`, /// where each element defines a slice of `data` - /// + /// /// `batch_dims` (denoted as `b`) is an integer indicating the number of batch dimensions, i.e the leading `b` number of dimensions of /// `data` tensor and `indices` are representing the batches, and the gather starts from the `b+1` dimension. - /// + /// /// Some salient points about the inputs' rank and shape: - /// + /// /// 1) r >= 1 and q >= 1 are to be honored. There is no dependency condition to be met between ranks `r` and `q` - /// + /// /// 2) The first `b` dimensions of the shape of `indices` tensor and `data` tensor must be equal. - /// + /// /// 3) b < min(q, r) is to be honored. - /// + /// /// 4) The `indices_shape[-1]` should have a value between 1 (inclusive) and rank `r-b` (inclusive) - /// + /// /// 5) All values in `indices` are expected to be within bounds [-s, s-1] along axis of size `s` (i.e.) `-data_shape[i] <= indices[...,i] <= data_shape[i] - 1`. /// It is an error if any of the index values are out of bounds. - /// + /// /// The output is computed as follows: - /// + /// /// The output tensor is obtained by mapping each index-tuple in the `indices` tensor to the corresponding slice of the input `data`. - /// + /// /// 1) If `indices_shape[-1] > r-b` => error condition - /// + /// /// 2) If `indices_shape[-1] == r-b`, since the rank of `indices` is `q`, `indices` can be thought of as `N` `(q-b-1)`-dimensional tensors /// containing 1-D tensors of dimension `r-b`, where `N` is an integer equals to the product of 1 and all the elements in the batch dimensions /// of the indices_shape. Let us think of each such `r-b` ranked tensor as `indices_slice`. Each *scalar value* corresponding to `data[0:b-1,indices_slice]` /// is filled into the corresponding location of the `(q-b-1)`-dimensional tensor to form the `output` tensor (Example 1 below) - /// + /// /// 3) If `indices_shape[-1] < r-b`, since the rank of `indices` is `q`, `indices` can be thought of as `N` `(q-b-1)`-dimensional tensor /// containing 1-D tensors of dimension `< r-b`. Let us think of each such tensors as `indices_slice`. Each *tensor slice* corresponding /// to `data[0:b-1, indices_slice , :]` is filled into the corresponding location of the `(q-b-1)`-dimensional tensor /// to form the `output` tensor (Examples 2, 3, 4 and 5 below) - /// + /// /// This operator is the inverse of `ScatterND`. - /// + /// /// **Example 1** - /// + /// /// ``` /// batch_dims = 0 /// data = [[0,1],[2,3]] # data_shape = [2, 2] /// indices = [[0,0],[1,1]] # indices_shape = [2, 2] /// output = [0,3] # output_shape = [2] /// ``` - /// + /// /// **Example 2** - /// + /// /// ``` /// batch_dims = 0 /// data = [[0,1],[2,3]] # data_shape = [2, 2] /// indices = [[1],[0]] # indices_shape = [2, 1] /// output = [[2,3],[0,1]] # output_shape = [2, 2] /// ``` - /// + /// /// **Example 3** - /// + /// /// ``` /// batch_dims = 0 /// data = [[[0,1],[2,3]],[[4,5],[6,7]]] # data_shape = [2, 2, 2] /// indices = [[0,1],[1,0]] # indices_shape = [2, 2] /// output = [[2,3],[4,5]] # output_shape = [2, 2] /// ``` - /// + /// /// **Example 4** - /// + /// /// ``` /// batch_dims = 0 /// data = [[[0,1],[2,3]],[[4,5],[6,7]]] # data_shape = [2, 2, 2] /// indices = [[[0,1]],[[1,0]]] # indices_shape = [2, 1, 2] /// output = [[[2,3]],[[4,5]]] # output_shape = [2, 1, 2] /// ``` - /// + /// /// **Example 5** - /// + /// /// ``` /// batch_dims = 1 /// data = [[[0,1],[2,3]],[[4,5],[6,7]]] # data_shape = [2, 2, 2] @@ -1461,8 +1461,8 @@ public static Tensor GatherND(Tensor data, Tensor indices, Optio Object result = OnnxInterpreter.interpret(OnnxOps.GatherND.class, List.of(data, indices), List.of(batch_dims)); return (Tensor) result; } - - /// + + /// /// Gelu takes one input data (Tensor) and produces one /// output data (Tensor) where the gaussian error linear units function, /// $y = 0.5 * x * (1 + erf(x/sqrt(2)))$ is applied to the tensor elementwise. @@ -1473,13 +1473,13 @@ public static Tensor Gelu(Tensor X, Optional approximate) { Object result = OnnxInterpreter.interpret(OnnxOps.Gelu.class, List.of(X), List.of(approximate)); return (Tensor) result; } - + /// General Matrix multiplication: /// https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 - /// + /// /// * A' = transpose(A) if transA else A /// * B' = transpose(B) if transB else B - /// + /// /// Compute Y = alpha * A' * B' + beta * C, where input tensor A has shape (M, K) or (K, M), /// input tensor B has shape (K, N) or (N, K), input tensor C is broadcastable to shape (M, N), /// and output tensor Y has shape (M, N). A will be transposed before doing the @@ -1490,8 +1490,8 @@ public static Tensor Gemm(Tensor A, Tensor B, Optional> C Object result = OnnxInterpreter.interpret(OnnxOps.Gemm.class, List.of(A, B, C), List.of(alpha, transB, beta, transA)); return (Tensor) result; } - - /// + + /// /// GlobalAveragePool consumes an input tensor X and applies average pooling across /// the values in the same channel. This is equivalent to AveragePool with kernel size /// equal to the spatial dimension of input tensor. @@ -1499,8 +1499,8 @@ public static Tensor GlobalAveragePool(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.GlobalAveragePool.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// GlobalLpPool consumes an input tensor X and applies lp pool pooling across /// the values in the same channel. This is equivalent to LpPool with kernel size /// equal to the spatial dimension of input tensor. @@ -1508,8 +1508,8 @@ public static Tensor GlobalLpPool(Tensor X, Optional p) { Object result = OnnxInterpreter.interpret(OnnxOps.GlobalLpPool.class, List.of(X), List.of(p)); return (Tensor) result; } - - /// + + /// /// GlobalMaxPool consumes an input tensor X and applies max pooling across /// the values in the same channel. This is equivalent to MaxPool with kernel size /// equal to the spatial dimension of input tensor. @@ -1517,12 +1517,12 @@ public static Tensor GlobalMaxPool(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.GlobalMaxPool.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Gradient operator computes the partial derivatives of a specific tensor w.r.t. /// some other tensors. This operator is widely used in gradient-based training /// algorithms. To illustrate its use, let's consider a computation graph, - /// + /// /// ``` /// X -----. /// | @@ -1532,12 +1532,12 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// Z /// ``` - /// + /// /// , where W and Z are trainable tensors. Note that operators' attributes are /// omitted for the sake of simplicity. Let dY/dW (dY/dZ) be the gradient of /// Y with respect to W (Z). The user can compute gradient by inserting Gradient /// operator to form another graph shown below. - /// + /// /// ``` /// W --> Conv --> H --> Gemm --> Y /// | ^ ^ @@ -1554,21 +1554,21 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---------------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// By definition, the tensor "y" is a function of independent variables in "xs" /// and "zs". Since we only compute the gradient of "y" w.r.t. the differentiable /// variables in "xs", this Gradient only outputs dY/dW and dY/dZ. Note that "H" /// cannot appear in "xs" and "zs". The reason is that "H" can be determined by /// tensors "W" and "X" and therefore "H" is not an independent variable. - /// + /// /// All outputs are optional. If needed, for example, user can assign an empty /// string to the 1st output name of that Gradient to skip the generation of dY/dW. /// Note that the concept of optional outputs can also be found in ONNX's RNN, GRU, /// and LSTM. - /// + /// /// Gradient operator can compute derivative against intermediate tensors. For /// example, the gradient of Y with respect to H can be done via - /// + /// /// ``` /// W --> Conv --> H --> Gemm --> Y /// ^ | ^ @@ -1584,20 +1584,20 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---------------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// It is possible to represent high-order differentiation using Gradient operators. /// For example, given the following linear model: - /// + /// /// ``` /// W --> Gemm --> Y --> Loss --> O /// ^ ^ /// | | /// X L /// ``` - /// + /// /// To compute the 2nd order derivative of O with respect to W (denoted by /// d^2O/dW^2), one can do - /// + /// /// ``` /// W --> Gemm --> Y --> Loss --> O /// | ^ ^ @@ -1615,20 +1615,20 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---> d^2O/dW^2 (2nd output of Gradient) /// ``` - /// + /// /// The tensors named in attributes "xs", "zs", and "y" define the differentiated /// computation graph, and the inputs to Gradient node define the values at /// which the gradient is computed. We can feed different tensors to the identified /// graph. For example, one can compute the gradient of Y with respect to H at /// a specific value of H, H_1, by providing that value as an input to the Gradient /// node. - /// + /// /// ``` /// W --> Conv --> H --> Gemm --> Y /// ^ ^ /// | | /// X Z - /// + /// /// Z_1 (2nd input of Gradient) /// | /// v @@ -1636,7 +1636,7 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// When the inputs of Gradient are the tensors named in "xs" and "zs", the /// computation can be optimized. More specifically, intermediate variables in /// forward pass can be reused if the gradient is computed via reverse-mode @@ -1645,43 +1645,43 @@ public static List> Gradient(List> Inputs, String Object result = OnnxInterpreter.interpret(OnnxOps.Gradient.class, List.of(Inputs), List.of(y, zs, xs)); return (List>) result; } - - /// + + /// /// Returns the tensor resulted from performing the `greater` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Greater(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Greater.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `greater_equal` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor GreaterOrEqual(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.GreaterOrEqual.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Given an input `X` and a flow-field `grid`, computes the output `Y` using `X` values and pixel locations from the `grid`. /// For spatial input `X` with shape (N, C, H, W), the `grid` will have shape (N, H_out, W_out, 2), /// the output `Y` will have shape (N, C, H_out, W_out). For volumetric input `X` with shape (N, C, D, H, W), /// the `grid` will have shape (N, D_out, H_out, W_out, 3), the output `Y` will have shape (N, C, D_out, H_out, W_out). /// More generally, for an input `X` of rank r+2 with shape (N, C, d1, d2, ..., dr), /// the `grid` will have shape (N, D1_out, D2_out, ..., Dr_out, r), the output `Y` will have shape (N, C, D1_out, D2_out, ..., Dr_out). - /// + /// /// The tensor `X` contains values at centers of square pixels (voxels, etc) locations such as (n, c, d1_in, d2_in, ..., dr_in). /// The (n, d1_out, d2_out, ..., dr_out, :) values from the tensor `grid` are the normalized positions for interpolating the values /// at the (n, c, d1_out, d2_out, ..., dr_out) locations from the output tensor `Y` using a specified interpolation method (the mode) /// and a padding mode (for `grid` positions falling outside the 2-dimensional image). - /// + /// /// For example, the values in `grid[n, h_out, w_out, :]` are size-2 vectors specifying normalized positions in the 2-dimensional space of `X`. /// They are used to interpolate output values of `Y[n, c, h_out, w_out]`. - /// + /// /// The GridSample operator is often used in doing grid generator and sampler in the /// [Spatial Transformer Networks](https://arxiv.org/abs/1506.02025). /// See also in [torch.nn.functional.grid_sample](https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html). @@ -1689,11 +1689,11 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti Object result = OnnxInterpreter.interpret(OnnxOps.GridSample.class, List.of(X, grid), List.of(mode, align_corners, padding_mode)); return (Tensor) result; } - - /// + + /// /// A GroupNormalization function. Carries out group normalization as described in /// the paper https://arxiv.org/abs/1803.08494 - /// + /// /// This operator transforms input according to /// ``` /// y = scale * (x - mean) / sqrt(variance + epsilon) + bias, @@ -1702,7 +1702,7 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti /// `scale` and `bias` should be specified for each channel. The number of /// groups `num_groups` should be divisible by the number of channels so that there are /// an equal number of channels per group. - /// + /// /// The overall computation has two stages: the first stage normalizes the elements to /// have zero mean and unit variance for each instance in each group, and the second /// stage scales and shifts the results of the first stage. The floating-point precision @@ -1710,7 +1710,7 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti /// if `stash_type` is 1, the operator casts all input variables to 32-bit float, /// performs the computation, and finally casts the normalized results back to the /// original type of `X`. The second stage does not depend on `stash_type`. - /// + /// /// When the number of groups is the same as the number of channels, this operator is /// equivalent to InstanceNormalization. When there is only one group, this operator /// is equivalent to LayerNormalization. @@ -1718,22 +1718,22 @@ public static Tensor GroupNormalization(Tensor X, Tensor scale, Ten Object result = OnnxInterpreter.interpret(OnnxOps.GroupNormalization.class, List.of(X, scale, bias), List.of(epsilon, stash_type, num_groups)); return (Tensor) result; } - - /// + + /// /// Generates a Hamming window as described in the paper https://ieeexplore.ieee.org/document/1455106. public static Tensor HammingWindow(Tensor size, Optional periodic, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.HammingWindow.class, List.of(size), List.of(periodic, output_datatype)); return (Tensor) result; } - - /// + + /// /// Generates a Hann window as described in the paper https://ieeexplore.ieee.org/document/1455106. public static Tensor HannWindow(Tensor size, Optional periodic, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.HannWindow.class, List.of(size), List.of(periodic, output_datatype)); return (Tensor) result; } - - /// + + /// /// HardSigmoid takes one input data (Tensor) and produces one output data /// (Tensor) where the HardSigmoid function, y = max(0, min(1, alpha * x + beta)), /// is applied to the tensor elementwise. @@ -1741,8 +1741,8 @@ public static Tensor HardSigmoid(Tensor X, Optional alpha, Opti Object result = OnnxInterpreter.interpret(OnnxOps.HardSigmoid.class, List.of(X), List.of(alpha, beta)); return (Tensor) result; } - - /// + + /// /// HardSwish takes one input data (Tensor) and produces one output data (Tensor) where /// the HardSwish function, y = x * max(0, min(1, alpha * x + beta)) = x * HardSigmoid(x), /// where alpha = 1/6 and beta = 0.5, is applied to the tensor elementwise. @@ -1750,12 +1750,12 @@ public static Tensor HardSwish(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.HardSwish.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the hardmax values for the given input: - /// + /// /// Hardmax(element in input, axis) = 1 if the element is the first maximum value along the specified axis, 0 otherwise - /// + /// /// The "axis" attribute indicates the dimension along which Hardmax /// will be performed. The output tensor has the same shape /// and contains the Hardmax values of the corresponding input. @@ -1763,13 +1763,13 @@ public static Tensor Hardmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Hardmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - + /// Identity operator public static V Identity(V input) { Object result = OnnxInterpreter.interpret(OnnxOps.Identity.class, List.of(input), List.of()); return (V) result; } - + /// Loads and decodes and image from a file. If it can't decode for any reason (e.g. corrupted encoded /// stream, invalid format, it will return an empty matrix). /// The following image formats are supported: @@ -1797,8 +1797,8 @@ public static Tensor ImageDecoder(Tensor encoded_stream, Optional) result; } - - /// + + /// /// Replaces inputs that equal one value with another, leaving all other elements alone.
/// This operator is typically used to replace missing values in situations where they have a canonical /// representation, such as -1, 0, NaN, or some extreme value.
@@ -1811,53 +1811,53 @@ public static Tensor Imputer(Tensor X, Optional replaced_value_i Object result = OnnxInterpreter.interpret(OnnxOps.Imputer.class, List.of(X), List.of(replaced_value_int64, replaced_value_float, imputed_value_int64s, imputed_value_floats)); return (Tensor) result; } - - /// + + /// /// Carries out instance normalization as described in the paper /// https://arxiv.org/abs/1607.08022. - /// + /// /// y = scale * (x - mean) / sqrt(variance + epsilon) + B, /// where mean and variance are computed per instance per channel. public static Tensor InstanceNormalization(Tensor input, Tensor scale, Tensor B, Optional epsilon) { Object result = OnnxInterpreter.interpret(OnnxOps.InstanceNormalization.class, List.of(input, scale, B), List.of(epsilon)); return (Tensor) result; } - + /// Map infinity to true and other values to false. public static Tensor IsInf(Tensor X, Optional detect_negative, Optional detect_positive) { Object result = OnnxInterpreter.interpret(OnnxOps.IsInf.class, List.of(X), List.of(detect_negative, detect_positive)); return (Tensor) result; } - + /// Returns which elements of the input are NaN. public static Tensor IsNaN(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.IsNaN.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Local Response Normalization proposed in the [AlexNet paper](https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf). /// It normalizes over local input regions. /// The local region is defined across the channels. For an element `X[n, c, d1, ..., dk]` in a tensor /// of shape `(N x C x D1 x D2, ..., Dk)`, its region is /// `{X[n, i, d1, ..., dk] | max(0, c - floor((size - 1) / 2)) <= i <= min(C - 1, c + ceil((size - 1) / 2))}`. - /// + /// /// `square_sum[n, c, d1, ..., dk] = sum(X[n, i, d1, ..., dk] ^ 2)`, /// where `max(0, c - floor((size - 1) / 2)) <= i <= min(C - 1, c + ceil((size - 1) / 2))`. - /// + /// /// `Y[n, c, d1, ..., dk] = X[n, c, d1, ..., dk] / (bias + alpha / size * square_sum[n, c, d1, ..., dk] ) ^ beta` public static Tensor LRN(Tensor X, long size, Optional alpha, Optional bias, Optional beta) { Object result = OnnxInterpreter.interpret(OnnxOps.LRN.class, List.of(X), List.of(size, alpha, bias, beta)); return (Tensor) result; } - + public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } - /// + /// /// Computes an one-layer LSTM. This operator is usually supported via some /// custom implementation such as CuDNN. - /// + /// /// Notations: - /// + /// /// * `X` - input tensor /// * `i` - input gate /// * `o` - output gate @@ -1876,15 +1876,15 @@ public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } /// * `PB[iof]` - P peephole weight vector for backward input, output, and forget gates /// * `H` - Hidden state /// * `num_directions` - 2 if direction == bidirectional else 1 - /// + /// /// Activation functions: - /// + /// /// * Relu(x) - max(0, x) /// * Tanh(x) - (1 - e^{-2x})/(1 + e^{-2x}) /// * Sigmoid(x) - 1/(1 + e^{-x}) - /// + /// /// NOTE: Below are optional - /// + /// /// * Affine(x) - alpha*x + beta /// * LeakyRelu(x) - x if x >= 0 else alpha * x /// * ThresholdedRelu(x) - x if x >= alpha else 0 @@ -1893,9 +1893,9 @@ public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } /// * Elu(x) - x if x >= 0 else alpha*(e^x - 1) /// * Softsign(x) - x/(1 + |x|) /// * Softplus(x) - log(1 + e^x) - /// + /// /// Equations (Default: f=Sigmoid, g=Tanh, h=Tanh): - /// + /// /// * it = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Pi (.) Ct-1 + Wbi + Rbi) /// * ft = f(Xt*(Wf^T) + Ht-1*(Rf^T) + Pf (.) Ct-1 + Wbf + Rbf) /// * ct = g(Xt*(Wc^T) + Ht-1*(Rc^T) + Wbc + Rbc) @@ -1908,8 +1908,8 @@ public static LSTMResult LSTM(Tensor X, Tensor W, Tensor R, Opti Object[] resultArray = (Object[]) result; return new LSTMResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// Maps each element in the input tensor to another value.
/// The mapping is determined by the two parallel attributes, 'keys_*' and /// 'values_*' attribute. The i-th value in the specified 'keys_*' attribute @@ -1933,9 +1933,9 @@ public static Tensor LabelEncoder(Tensor X, Optional Object result = OnnxInterpreter.interpret(OnnxOps.LabelEncoder.class, List.of(X), List.of(values_strings, keys_int64s, keys_tensor, keys_strings, default_float, keys_floats, default_tensor, default_int64, values_tensor, values_int64s, default_string, values_floats)); return (Tensor) result; } - + public record LayerNormalizationResult(Tensor Y, Tensor Mean, Tensor InvStdDev) { } - /// + /// /// This is layer normalization defined in ONNX as function. /// The overall computation can be split into two stages. /// The first stage is standardization, which makes the @@ -1982,8 +1982,8 @@ public static LayerNormalizationResult LayerNormalization(Tensor Object[] resultArray = (Object[]) result; return new LayerNormalizationResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// LeakyRelu takes input data (Tensor) and an argument alpha, and produces one /// output data (Tensor) where the function `f(x) = alpha * x for x < 0`, /// `f(x) = x for x >= 0`, is applied to the data tensor elementwise. @@ -1991,50 +1991,50 @@ public static Tensor LeakyRelu(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.LeakyRelu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `less` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Less(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Less.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `less_equal` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor LessOrEqual(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.LessOrEqual.class, List.of(A, B), List.of()); return (Tensor) result; } - + public record LinearAttentionResult(Tensor output, Tensor present_state) { } - /// + /// /// Unified linear attention operator for autoregressive decoding (T=1) and prefill (T>1). - /// + /// /// The query, key, value, and (where applicable) decay/beta inputs use 3D packed format /// [B, T, H*D], where heads are flattened into the last dimension; q_num_heads and /// kv_num_heads are always required and are used to unpack to 4D internally for computation. /// The optional past_state and present_state are 4D with shape (B, H_kv, d_k, d_v). - /// + /// /// Group-query attention (GQA) is supported: q_num_heads must be a positive multiple of /// kv_num_heads. When q_num_heads == kv_num_heads this reduces to multi-headed linear /// attention; when q_num_heads > kv_num_heads each KV head (and its recurrent state) is /// shared by `q_num_heads / kv_num_heads` query heads (multi-query attention is the /// special case kv_num_heads == 1). - /// + /// /// The update_rule attribute selects the recurrence type: /// - "linear": S_t = S_{t-1} + k_t ⊗ v_t; o_t = scale * q_t^T S_t /// - "gated": S_t = exp(g_t) * S_{t-1} + k_t ⊗ v_t; o_t = scale * q_t^T S_t /// - "delta": S_t = S_{t-1} + β_t * k_t ⊗ (v_t - S_{t-1}^T k_t); o_t = scale * q_t^T S_t /// - "gated_delta": S_t = exp(g_t) * S_{t-1} + β_t * k_t ⊗ (v_t - exp(g_t) * S_{t-1}^T k_t); o_t = scale * q_t^T S_t - /// + /// /// where g_t is the decay (in log-space), β_t is the update rate, and ⊗ denotes outer product. - /// + /// /// Semantics: Equivalent to running the recurrent update sequentially for each token, /// but may be implemented using chunk-parallel algorithms for GPU efficiency. public static LinearAttentionResult LinearAttention(Tensor query, Tensor key, Tensor value, Optional> past_state, Optional> decay, Optional> beta, Optional chunk_size, Optional update_rule, Optional scale, long q_num_heads, long kv_num_heads) { @@ -2042,17 +2042,17 @@ public static LinearAttentionResult LinearAttention(Tensor query Object[] resultArray = (Object[]) result; return new LinearAttentionResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - + public record LinearClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// Linear classifier public static LinearClassifierResult LinearClassifier(Tensor X, Optional classlabels_ints, Optional post_transform, float[] coefficients, Optional multi_class, Optional intercepts, Optional classlabels_strings) { Object result = OnnxInterpreter.interpret(OnnxOps.LinearClassifier.class, List.of(X), List.of(classlabels_ints, post_transform, coefficients, multi_class, intercepts, classlabels_strings)); Object[] resultArray = (Object[]) result; return new LinearClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Generalized linear regression evaluation.
/// If targets is set to 1 (default) then univariate regression is performed.
/// If targets is set to M then M sets of coefficients must be passed in as a sequence @@ -2063,19 +2063,19 @@ public static Tensor LinearRegressor(Tensor X, Optional po Object result = OnnxInterpreter.interpret(OnnxOps.LinearRegressor.class, List.of(X), List.of(post_transform, coefficients, targets, intercepts)); return (Tensor) result; } - - /// + + /// /// Calculates the natural log of the given input tensor, element-wise. public static Tensor Log(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Log.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the log of softmax values for the given input: - /// + /// /// LogSoftmax(input, axis) = Log(Softmax(input, axis=axis)) - /// + /// /// The "axis" attribute indicates the dimension along which LogSoftmax /// will be performed. The output tensor has the same shape /// and contains the LogSoftmax values of the corresponding input. @@ -2083,8 +2083,8 @@ public static Tensor LogSoftmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.LogSoftmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Given a matrix, apply Lp-normalization along the provided axis. /// The output is computed as: `output = input / Lp_norm(input, axis)`. /// When the Lp norm is zero (i.e., all elements along the axis are zero), @@ -2093,8 +2093,8 @@ public static Tensor LpNormalization(Tensor input, Optional p, O Object result = OnnxInterpreter.interpret(OnnxOps.LpNormalization.class, List.of(input), List.of(p, axis)); return (Tensor) result; } - - /// + + /// /// LpPool consumes an input tensor X and applies Lp pooling across /// the tensor according to kernel sizes, stride sizes, and pad lengths. /// Lp pooling consisting of computing the Lp norm on all values of a subset @@ -2108,7 +2108,7 @@ public static Tensor LpNormalization(Tensor input, Optional p, O /// output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - {kernelSpatialShape}) / strides_spatial_shape[i] + 1) /// ``` /// if ceil_mode is enabled `pad_shape[i]` is the sum of pads along axis `i`. - /// + /// /// `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following: /// ``` /// VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - {kernelSpatialShape} + 1) / strides_spatial_shape[i]) @@ -2122,23 +2122,23 @@ public static Tensor LpPool(Tensor X, Optional p, Optional) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). public static Tensor MatMul(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.MatMul.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). /// The production MUST never overflow. The accumulation may overflow if and only if in 32 bits. public static Tensor MatMulInteger(Tensor A, Tensor B, Optional> a_zero_point, Optional> b_zero_point) { Object result = OnnxInterpreter.interpret(OnnxOps.MatMulInteger.class, List.of(A, B, a_zero_point, b_zero_point), List.of()); return (Tensor) result; } - - /// + + /// /// Element-wise max of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2146,9 +2146,9 @@ public static Tensor Max(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Max.class, List.of(data_0), List.of()); return (Tensor) result; } - + public record MaxPoolResult(Tensor Y, Tensor Indices) { } - /// + /// /// MaxPool consumes an input tensor X and applies max pooling across /// the tensor according to kernel sizes, stride sizes, and pad lengths. /// max pooling consisting of computing the max on all values of a @@ -2164,7 +2164,7 @@ public record MaxPoolResult(Tensor Y, Tensor Indices) { } /// output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1) /// ``` /// if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`. Sliding windows that would start in the right padded region are ignored. - /// + /// /// `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled: /// ``` /// VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i]) @@ -2179,15 +2179,15 @@ public record MaxPoolResult(Tensor Y, Tensor Indices) { } /// ``` /// pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i] /// ``` - /// The output of each pooling window is maximum number of elements exclude pad. - /// + /// The output of each pooling window is maximum number of elements exclude pad. + /// public static MaxPoolResult MaxPool(Tensor X, Optional pads, Optional dilations, Optional auto_pad, Optional ceil_mode, Optional storage_order, Optional strides, long[] kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.MaxPool.class, List.of(X), List.of(pads, dilations, auto_pad, ceil_mode, storage_order, strides, kernel_shape)); Object[] resultArray = (Object[]) result; return new MaxPoolResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// ROI max pool consumes an input tensor X and region of interests (RoIs) to /// apply max pooling across each RoI, to produce output 4-D tensor of shape /// (num_rois, channels, pooled_shape[0], pooled_shape[1]). @@ -2195,23 +2195,23 @@ public static Tensor MaxRoiPool(Tensor X, Tensor rois, Optional) result; } - - /// + + /// /// MaxUnpool essentially computes the partial inverse of the MaxPool op. /// The input information to this op is typically the output information from a MaxPool op. The first /// input tensor X is the tensor that needs to be unpooled, which is typically the pooled tensor (first output) /// from MaxPool. The second input tensor, I, contains the indices to the (locally maximal) elements corresponding /// to the elements in the first input tensor X. Input tensor I is typically the second output of the MaxPool op. /// The third (optional) input is a tensor that specifies the output size of the unpooling operation. - /// + /// /// MaxUnpool is intended to do 'partial' inverse of the MaxPool op. 'Partial' because all the non-maximal /// values from the original input to MaxPool are set to zero in the output of the MaxUnpool op. Pooling /// the result of an unpooling operation should give back the original input to the unpooling op. - /// + /// /// MaxUnpool can produce the same output size for several input sizes, which makes unpooling op ambiguous. /// The third input argument, output_size, is meant to disambiguate the op and produce output tensor of /// known/predictable size. - /// + /// /// In addition to the inputs, MaxUnpool takes three attributes, namely kernel_shape, strides, and pads, /// which define the exact unpooling op. The attributes typically have the same values as the corresponding /// pooling op that the unpooling op is trying to invert. @@ -2219,8 +2219,8 @@ public static Tensor MaxUnpool(Tensor X, Tensor I, Optional) result; } - - /// + + /// /// Element-wise mean of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2228,30 +2228,30 @@ public static Tensor Mean(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Mean.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// A MeanVarianceNormalization Function: Perform mean variance normalization /// on the input tensor X using formula: `(X-EX)/sqrt(E(X-EX)^2)` public static Tensor MeanVarianceNormalization(Tensor X, Optional axes) { Object result = OnnxInterpreter.interpret(OnnxOps.MeanVarianceNormalization.class, List.of(X), List.of(axes)); return (Tensor) result; } - - /// + + /// /// Generate a MelWeightMatrix that can be used to re-weight a Tensor containing a linearly sampled frequency spectra (from DFT or STFT) into num_mel_bins frequency information based on the [lower_edge_hertz, upper_edge_hertz] range on the mel scale. /// This function defines the mel scale in terms of a frequency in hertz according to the following formula: - /// + /// /// mel(f) = 2595 * log10(1 + f/700) - /// + /// /// In the returned matrix, all the triangles (filterbanks) have a peak value of 1.0. - /// + /// /// The returned MelWeightMatrix can be used to right-multiply a spectrogram S of shape [frames, num_spectrogram_bins] of linear scale spectrum values (e.g. STFT magnitudes) to generate a "mel spectrogram" M of shape [frames, num_mel_bins]. public static Tensor MelWeightMatrix(Tensor num_mel_bins, Tensor dft_length, Tensor sample_rate, Tensor lower_edge_hertz, Tensor upper_edge_hertz, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.MelWeightMatrix.class, List.of(num_mel_bins, dft_length, sample_rate, lower_edge_hertz, upper_edge_hertz), List.of(output_datatype)); return (Tensor) result; } - - /// + + /// /// Element-wise min of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2259,12 +2259,12 @@ public static Tensor Min(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Min.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// Mish: A Self Regularized Non-Monotonic Neural Activation Function. - /// + /// /// Perform the linear unit element-wise on the input tensor X using formula: - /// + /// /// ``` /// mish(x) = x * tanh(softplus(x)) = x * tanh(ln(1 + e^{x})) /// ``` @@ -2272,14 +2272,14 @@ public static Tensor Mish(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Mish.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Performs an element-wise binary modulo operation. /// The semantics and supported data types depend on the value of the `fmod` attribute which must be `0` (default), or `1`. - /// + /// /// If the `fmod` attribute is set to `0`, `T` is constrained to integer data types and the semantics follow that of the Python `%`-operator. /// The sign of the result is that of the divisor. - /// + /// /// If `fmod` is set to `1`, the behavior of this operator follows that of the `fmod` function in C and `T` is constrained to floating point data types. /// The result of this operator is the remainder of the division operation `x / y` where `x` and `y` are respective elements of `A` and `B`. The result is exactly the value `x - n * y`, where `n` is `x / y` with its fractional part truncated. /// The returned value has the same sign as `x` (except if `x` is `-0`) and is less or equal to `|y|` in magnitude. @@ -2289,20 +2289,20 @@ public static Tensor Mish(Tensor X) { /// - If `y` is `±0` and `x` is not `NaN`, `NaN` should be returned. /// - If `y` is `±∞` and `x` is finite, `x` is returned. /// - If either argument is `NaN`, `NaN` is returned. - /// + /// /// This operator supports **multidirectional (i.e., NumPy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Mod(Tensor A, Tensor B, Optional fmod) { Object result = OnnxInterpreter.interpret(OnnxOps.Mod.class, List.of(A, B), List.of(fmod)); return (Tensor) result; } - - /// + + /// /// Compute one iteration of stochastic gradient update with momentum. /// This operator can conduct the optimization of multiple tensor variables. - /// + /// /// Let's define the behavior of this operator. As you can imagine, SG with momentum requires /// several parameters: - /// + /// /// - The learning-rate "R". /// - The update count "T". That is, the number of conducted training iterations. It should /// be zero in the first training iteration. @@ -2311,48 +2311,48 @@ public static Tensor Mod(Tensor A, Tensor B, Optional fmod) { /// - The scaling coefficient of current gradient "beta". /// - An attribute to choose either standard momentum or Nesterov's momentum "mode" should /// be used. - /// + /// /// For the sake of simplicity, assume that there is only one tensor (called "X") to be optimized. /// Other necessary inputs are "X"'s gradient (called "G") and "X"'s momentum (called "V"). This /// Momentum operator maps all these inputs to the new value of "X" (called "X_new") and its new /// momentum (called "V_new"). - /// + /// /// This operator supports two different momentum algorithms. Set the attribute "mode" to /// "nesterov" if Nesterov's momentum is desired. Otherwise, set the attribute "model" to /// "standard" to use standard momentum. Computation details are described subsequently. - /// + /// /// Let "+", "-", "*", and "/" are all element-wise operations with numpy-style broadcasting. - /// + /// /// Pseudo code for SG with standard momentum: - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||^2, where ||X|| is the sum of squared /// // values of all elements in X. /// G_regularized = norm_coefficient * X + G - /// + /// /// // In the first training iteration, beta should always be 1. /// beta_adjusted = T > 0 ? beta : 1 - /// + /// /// // Compute the current momentum based on previous momentum and the current gradient. /// V_new = alpha * V + beta_adjusted * G_regularized - /// + /// /// // Update X. /// X_new = X - R * V_new - /// + /// /// Pseudo code for SG with Nesterov's momentum: - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||^2, where ||X|| is the sum of squared /// // values of all elements in X. /// G_regularized = norm_coefficient * X + G; - /// + /// /// // In the first training iteration, beta should always be 1. /// beta_adjusted = T > 0 ? beta : 1 - /// + /// /// // Compute the current momentum based on previous momentum and the current gradient. /// V_new = alpha * V + beta_adjusted * G_regularized; - /// + /// /// // Compute final update direction and then update X. /// X_new = X - R * (G_regularized + alpha * V_new) - /// + /// /// If one assign this operators to optimize multiple inputs, for example, "X_1" and "X_2". The same /// pseudo code would be extended to handle all tensors jointly. More specifically, we can view "X" as a /// concatenation of "X_1" and "X_2" (of course, their gradient and accumulate gradient should @@ -2361,27 +2361,27 @@ public static List> Momentum(Tensor R, Tensor T, L Object result = OnnxInterpreter.interpret(OnnxOps.Momentum.class, List.of(R, T, inputs), List.of(mode, norm_coefficient, alpha, beta)); return (List>) result; } - - /// + + /// /// Performs element-wise binary multiplication (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Mul(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Mul.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Generate a tensor of samples from a multinomial distribution according to the probabilities /// of each of the possible outcomes. public static Tensor Multinomial(Tensor input, Optional seed, Optional sample_size, Optional dtype) { Object result = OnnxInterpreter.interpret(OnnxOps.Multinomial.class, List.of(input), List.of(seed, sample_size, dtype)); return (Tensor) result; } - - /// + + /// /// Neg takes one input data (Tensor) and produces one output data /// (Tensor) where each element flipped sign, y = -x, is applied to /// the tensor elementwise. @@ -2389,70 +2389,70 @@ public static Tensor Neg(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Neg.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// A NegativeLogLikelihoodLoss operator computes (weighted) negative log likelihood loss. /// Its "input" tensor has the shape of (N, C, d1, d2, ..., dk) where k >= 0. /// The "input" tensor contains log-probabilities for input[n, :, d_1, d_2,..., d_k] being in a class of [0, C). /// The operator's "target" input tensor has the shape of (N, d1, d2, ..., dk). It encodes class labels (one of C classes) /// or it may contain a special value (indicated by an attribute ignore_index) for N x d1 x d2 x ... x dk samples. /// The loss value for input[n, :, d_1, d_2,...d_k] being classified as class c = target[n][d_1][d_2]...[d_k] is computed as: - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = -input[n][c][d_1][d_2]...[d_k]. /// ``` - /// + /// /// When an optional "weight" is provided, the sample loss is calculated as: - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = -input[n][c][d_1][d_2]...[d_k] * weight[c]. /// ``` - /// + /// /// loss is zero for the case when target-value equals ignore_index. - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = 0, when target[n][d_1][d_2]...[d_k] = ignore_index /// ``` - /// + /// /// If "reduction" attribute is set to "none", the operator's output will be the above loss with shape (N, d1, d2, ..., dk). /// If "reduction" attribute is set to "mean" (the default attribute value), the output loss is (weight) averaged: - /// + /// /// ``` /// mean(loss), if "weight" is not provided, /// ``` - /// + /// /// or if weight is provided, - /// + /// /// ``` /// sum(loss) / sum(weight[target[n][d_1][d_2]...[d_k]]]), for all samples. /// ``` - /// + /// /// If "reduction" attribute is set to "sum", the output is a scalar: `sum(loss)`. - /// + /// /// See also https://pytorch.org/docs/stable/nn.html#torch.nn.NLLLoss. - /// + /// /// Example 1: - /// + /// /// ``` /// // negative log likelihood loss, "none" reduction /// N, C, d1 = 2, 3, 2 /// input = [[[1.0, 2.0], [2.0, 2.0], [3.0, 2.0]], /// [[0.0, 1.0], [2.0, 2.0], [1.0, 2]]] /// target = [[2, 1], [0, 2]] - /// + /// /// loss = np.zeros((N, d1)) /// for n in range(N): /// for d_1 in range(d1): /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] - /// + /// /// // print(loss) /// // [[-3. -2.] /// // [-0. -2.]] /// ``` - /// + /// /// Example 2: - /// + /// /// ``` /// // weighted negative log likelihood loss, sum reduction /// N, C, d1 = 2, 3, 2 @@ -2465,14 +2465,14 @@ public static Tensor Neg(Tensor X) { /// for d_1 in range(d1): /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] * weight[c] - /// + /// /// loss = np.sum(loss) /// // print(loss) /// // -1.1 /// ``` - /// + /// /// Example 3: - /// + /// /// ``` /// // weighted negative log likelihood loss, mean reduction /// N, C, d1 = 2, 3, 2 @@ -2487,7 +2487,7 @@ public static Tensor Neg(Tensor X) { /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] * weight[c] /// weight_total = weight_total + weight[c] - /// + /// /// loss = np.sum(loss) / weight_total /// // print(loss) /// // -1.57 @@ -2496,8 +2496,8 @@ public static Tensor NegativeLogLikelihoodLoss(Tensor input, Ten Object result = OnnxInterpreter.interpret(OnnxOps.NegativeLogLikelihoodLoss.class, List.of(input, target, weight), List.of(ignore_index, reduction)); return (Tensor) result; } - - /// + + /// /// Filter out boxes that have high intersection-over-union (IOU) overlap with previously selected boxes. /// Bounding boxes with score less than score_threshold are removed. Bounding box format is indicated by attribute center_point_box. /// Boxes are suppressed if their IOU with a previously selected box is strictly greater than iou_threshold (i.e., boxes with IOU exactly equal to the threshold are kept). @@ -2510,8 +2510,8 @@ public static Tensor NonMaxSuppression(Tensor boxes, Tensor Object result = OnnxInterpreter.interpret(OnnxOps.NonMaxSuppression.class, List.of(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold), List.of(center_point_box)); return (Tensor) result; } - - /// + + /// /// Returns the indices of the elements that are non-zero /// (in row-major order - by dimension). /// NonZero behaves similar to numpy.nonzero: @@ -2521,8 +2521,8 @@ public static Tensor NonZero(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.NonZero.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Normalize the input. There are three normalization modes, which have the corresponding formulas, /// defined using element-wise infix operators '/' and '^' and tensor-wide functions 'max' and 'sum':
///
@@ -2537,15 +2537,15 @@ public static Tensor Normalizer(Tensor X, Optional norm) { Object result = OnnxInterpreter.interpret(OnnxOps.Normalizer.class, List.of(X), List.of(norm)); return (Tensor) result; } - - /// + + /// /// Returns the negation of the input tensor element-wise. public static Tensor Not(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Not.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Produces a one-hot tensor based on inputs. /// The locations represented by the index values in the 'indices' input tensor will have 'on_value' /// and the other locations will have 'off_value' in the output tensor, where 'on_value' and 'off_value' @@ -2558,18 +2558,18 @@ public static Tensor Not(Tensor X) { /// as the type of the 'values' input. Any entries in the 'indices' input tensor with values outside /// the range [-depth, depth-1] will result in one-hot representation with all 'off_value' values in the /// output tensor. - /// + /// /// when axis = 0: /// output[input[i, j, k], i, j, k] = 1 for all i, j, k and 0 otherwise. - /// + /// /// when axis = -1: /// output[i, j, k, input[i, j, k]] = 1 for all i, j, k and 0 otherwise. public static Tensor OneHot(Tensor indices, Tensor depth, Tensor values, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.OneHot.class, List.of(indices, depth, values), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Replace each input element with an array of ones and zeros, where a single /// one is placed at the index of the category that was passed in. The total category count /// will determine the size of the extra dimension of the output array Y.
@@ -2582,16 +2582,16 @@ public static Tensor OneHotEncoder(Tensor X, Optional ca Object result = OnnxInterpreter.interpret(OnnxOps.OneHotEncoder.class, List.of(X), List.of(cats_strings, cats_int64s, zeros)); return (Tensor) result; } - - /// + + /// /// Constructs an optional-type value containing either an empty optional of a certain type specified by the attribute, /// or a non-empty value containing the input element. public static Optional Optional(Optional input, Optional type) { Object result = OnnxInterpreter.interpret(OnnxOps.Optional.class, List.of(input), List.of(type)); return (Optional) result; } - - /// + + /// /// If the input is a tensor or sequence type, it returns the input. /// If the input is an optional type, it outputs the element in the input. /// It is an error if the input is an empty optional-type (i.e. does not have an element) and the behavior is undefined in this case. @@ -2599,8 +2599,8 @@ public static V OptionalGetElement(O input) { Object result = OnnxInterpreter.interpret(OnnxOps.OptionalGetElement.class, List.of(input), List.of()); return (V) result; } - - /// + + /// /// Returns true if (1) the input is an optional-type and contains an element, /// or, (2) the input is a tensor or sequence type. /// If the input is not provided or is an empty optional-type, this op returns false. @@ -2608,18 +2608,18 @@ public static Tensor OptionalHasElement(Optional input) { Object result = OnnxInterpreter.interpret(OnnxOps.OptionalHasElement.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `or` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Or(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Or.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// PRelu takes input data (Tensor) and slope tensor as input, and produces one /// output data (Tensor) where the function `f(x) = slope * x for x < 0`, /// `f(x) = x for x >= 0`., is applied to the data tensor elementwise. @@ -2628,99 +2628,99 @@ public static Tensor PRelu(Tensor X, Tensor slope) { Object result = OnnxInterpreter.interpret(OnnxOps.PRelu.class, List.of(X, slope), List.of()); return (Tensor) result; } - - /// + + /// /// Given a tensor containing the data to be padded (`data`), a tensor containing the number of start and end pad values for axis (`pads`), (optionally) a `mode`, and (optionally) `constant_value`, /// a padded tensor (`output`) is generated. - /// + /// /// The four supported `modes` are (similar to corresponding modes supported by `numpy.pad`): - /// + /// /// 1) `constant`(default) - pads with a given constant value as specified by `constant_value` (which defaults to 0, empty string, or False) - /// + /// /// 2) `reflect` - pads with the reflection of the vector mirrored on the first and last values of the vector along each axis - /// + /// /// 3) `edge` - pads with the edge values of array - /// + /// /// 4) `wrap` - wrap-around padding as if the data tensor forms a torus - /// - /// + /// + /// /// Example 1 (`constant` mode): - /// + /// /// Insert 0 pads to the beginning of the second dimension. - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'constant' - /// + /// /// constant_value = 0.0 - /// + /// /// output = [ /// [0.0, 0.0, 1.0, 1.2], /// [0.0, 0.0, 2.3, 3.4], /// [0.0, 0.0, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 2 (`reflect` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'reflect' - /// + /// /// output = [ /// [1.0, 1.2, 1.0, 1.2], /// [2.3, 3.4, 2.3, 3.4], /// [4.5, 5.7, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 3 (`edge` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'edge' - /// + /// /// output = [ /// [1.0, 1.0, 1.0, 1.2], /// [2.3, 2.3, 2.3, 3.4], /// [4.5, 4.5, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 4 (`wrap` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [2, 1, 1, 1] - /// + /// /// mode = 'wrap' - /// + /// /// output = [ /// [3.4, 2.3, 3.4, 2.3], /// [5.7, 4.5, 5.7, 4.5], @@ -2734,8 +2734,8 @@ public static Tensor Pad(Tensor data, Tensor pads, Optiona Object result = OnnxInterpreter.interpret(OnnxOps.Pad.class, List.of(data, pads, constant_value, axes), List.of(mode)); return (Tensor) result; } - - /// + + /// /// Pow takes input data (Tensor) and exponent Tensor, and /// produces one output data (Tensor) where the function `f(x) = x^exponent`, /// is applied to the data tensor elementwise. @@ -2744,8 +2744,8 @@ public static Tensor Pow(Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.Pow.class, List.of(X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// The convolution operator consumes a quantized input tensor, its scale and zero point, /// a quantized filter, its scale and zero point, and output's scale and zero point, /// and computes the quantized output. Each scale and zero-point pair must have same shape. @@ -2757,8 +2757,8 @@ public static Tensor QLinearConv(Tensor x, Tensor x_ Object result = OnnxInterpreter.interpret(OnnxOps.QLinearConv.class, List.of(x, x_scale, x_zero_point, w, w_scale, w_zero_point, y_scale, y_zero_point, B), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); return (Tensor) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). /// It consumes two quantized input tensors, their scales and zero points, scale and zero point of output, /// and computes the quantized output. The quantization formula is y = saturate((x / y_scale) + y_zero_point). @@ -2774,12 +2774,12 @@ public static Tensor QLinearMatMul(Tensor a, Tensor Object result = OnnxInterpreter.interpret(OnnxOps.QLinearMatMul.class, List.of(a, a_scale, a_zero_point, b, b_scale, b_zero_point, y_scale, y_zero_point), List.of()); return (Tensor) result; } - - /// + + /// /// The linear quantization operator consumes a high-precision tensor, a scale, and a zero point to compute the /// low-precision/quantized tensor. The scale factor and zero point must have the same shape, determining the quantization /// granularity. The quantization formula is `y = saturate((x / y_scale) + y_zero_point)`. - /// + /// /// Saturation is done according to: /// - uint16: [0, 65535] /// - int16: [-32768, 32767] @@ -2789,14 +2789,14 @@ public static Tensor QLinearMatMul(Tensor a, Tensor /// - int4: [-8, 7] /// - uint2: [0, 3] /// - int2: [-2, 1] - /// + /// /// For `(x / y_scale)`, it rounds to the nearest even. Refer to https://en.wikipedia.org/wiki/Rounding for details. - /// + /// /// `y_zero_point` and `y` must have the same type. `y_zero_point` is usually not used for quantization to float8 and 4bit types, but the quantization /// formula remains the same for consistency, and the type of the attribute `y_zero_point` still determines the quantization type. /// `x` and `y_scale` are allowed to have different types. The type of `y_scale` determines the precision of the division operation between `x` and /// `y_scale`, unless the `precision` attribute is specified. - /// + /// /// There are three supported quantization granularities, determined by the shape of `y_scale`. /// In all cases, `y_zero_point` must have the same shape as `y_scale`. /// - Per-tensor (per-layer) quantization: `y_scale` is a scalar. @@ -2809,8 +2809,8 @@ public static Tensor QuantizeLinear(Tensor x, Tensor y_ Object result = OnnxInterpreter.interpret(OnnxOps.QuantizeLinear.class, List.of(x, y_scale, y_zero_point), List.of(output_dtype, saturate, precision, axis, block_size)); return (Tensor) result; } - - /// + + /// /// This is RMS normalization defined in ONNX as function as described in the paper https://arxiv.org/pdf/1910.07467. /// The overall computation can be split into two stages. The root mean squared norm is taken over the last D dimensions, /// where D is the dimension of normalized_shape. For example, if normalized_shape is (3, 5) (a 2-dimensional shape), @@ -2843,14 +2843,14 @@ public static Tensor RMSNormalization(Tensor X, Tensor scale, Op Object result = OnnxInterpreter.interpret(OnnxOps.RMSNormalization.class, List.of(X, scale), List.of(epsilon, stash_type, axis)); return (Tensor) result; } - + public record RNNResult(Tensor Y, Tensor Y_h) { } - /// + /// /// Computes an one-layer simple RNN. This operator is usually supported /// via some custom implementation such as CuDNN. - /// + /// /// Notations: - /// + /// /// * `X` - input tensor /// * `i` - input gate /// * `t` - time step (t-1 means previous time step) @@ -2864,15 +2864,15 @@ public record RNNResult(Tensor Y, Tensor Y_h) { } /// * `RBbi` - RR bias vectors for backward input gate /// * `H` - Hidden state /// * `num_directions` - 2 if direction == bidirectional else 1 - /// + /// /// Activation functions: - /// + /// /// * Relu(x) - max(0, x) /// * Tanh(x) - (1 - e^{-2x})/(1 + e^{-2x}) /// * Sigmoid(x) - 1/(1 + e^{-x}) - /// + /// /// NOTE: Below are optional - /// + /// /// * Affine(x) - alpha*x + beta /// * LeakyRelu(x) - x if x >= 0 else alpha * x /// * ThresholdedRelu(x) - x if x >= alpha else 0 @@ -2881,9 +2881,9 @@ public record RNNResult(Tensor Y, Tensor Y_h) { } /// * Elu(x) - x if x >= 0 else alpha*(e^x - 1) /// * Softsign(x) - x/(1 + |x|) /// * Softplus(x) - log(1 + e^x) - /// + /// /// Equations (Default: f=Tanh): - /// + /// /// * Ht = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Wbi + Rbi) /// This operator has **optional** inputs/outputs. See [the doc](IR.md) for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted. public static RNNResult RNN(Tensor X, Tensor W, Tensor R, Optional> B, Optional> sequence_lens, Optional> initial_h, Optional layout, Optional activation_alpha, Optional hidden_size, Optional activation_beta, Optional activations, Optional clip, Optional direction) { @@ -2891,12 +2891,12 @@ public static RNNResult RNN(Tensor X, Tensor W, Tensor R, Option Object[] resultArray = (Object[]) result; return new RNNResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Generate a tensor with random values drawn from a normal distribution. The shape /// of the tensor is specified by the `shape` argument and the parameter of the normal distribution /// specified by `mean` and `scale`. - /// + /// /// The data type is specified by the 'dtype' argument. The 'dtype' argument must /// be one of the data types specified in the 'DataType' enum field in the /// TensorProto message. @@ -2904,12 +2904,12 @@ public static Tensor RandomNormal(long[] shape, Optional seed, Opt Object result = OnnxInterpreter.interpret(OnnxOps.RandomNormal.class, List.of(), List.of(shape, seed, mean, scale, dtype)); return (Tensor) result; } - - /// + + /// /// Generate a tensor with random values drawn from a normal distribution. /// The shape of the output tensor is copied from the shape of the input tensor, /// and the parameters of the normal distribution are specified by `mean` and `scale`. - /// + /// /// The data type is specified by the 'dtype' argument, or copied from the input tensor if not provided. /// The 'dtype' argument must be one of the data types specified in the 'DataType' enum field in the /// TensorProto message, and be valid as an output type. @@ -2917,11 +2917,11 @@ public static Tensor RandomNormalLike(Tensor input, Optional) result; } - - /// + + /// /// Generate a tensor with random values drawn from a uniform distribution. The shape /// of the tensor is specified by the `shape` argument and the range by `low` and `high`. - /// + /// /// The data type is specified by the 'dtype' argument. The 'dtype' argument must /// be one of the data types specified in the 'DataType' enum field in the /// TensorProto message. @@ -2929,12 +2929,12 @@ public static Tensor RandomUniform(Optional high, long[] shape, Op Object result = OnnxInterpreter.interpret(OnnxOps.RandomUniform.class, List.of(), List.of(high, shape, seed, low, dtype)); return (Tensor) result; } - - /// + + /// /// Generate a tensor with random values drawn from a uniform distribution. /// The shape of the output tensor is copied from the shape of the input tensor, /// and the parameters of the uniform distribution are specified by `low` and `high`. - /// + /// /// The data type is specified by the 'dtype' argument, or copied from the input tensor if not provided. /// The 'dtype' argument must be one of the data types specified in the 'DataType' enum field in the /// TensorProto message and be valid as an output type. @@ -2942,11 +2942,11 @@ public static Tensor RandomUniformLike(Tensor input, Optional) result; } - - /// + + /// /// Generate a tensor containing a sequence of numbers that begin at `start` and extends by increments of `delta` /// up to `limit` (exclusive). - /// + /// /// The number of elements in the output of range is computed as below: /// ``` /// number_of_elements = max( ceil( (limit - start) / delta ) , 0 ) @@ -2967,7 +2967,7 @@ public static Tensor RandomUniformLike(Tensor input, Optional Tensor Range(Tensor start, Tensor limit, Tensor de Object result = OnnxInterpreter.interpret(OnnxOps.Range.class, List.of(start, limit, delta), List.of(stash_type)); return (Tensor) result; } - - /// + + /// /// Reciprocal takes one input data (Tensor) and produces one output data /// (Tensor) where the reciprocal is, y = 1/x, is applied to /// the tensor elementwise. @@ -2986,158 +2986,158 @@ public static Tensor Reciprocal(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Reciprocal.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Computes the L1 norm of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceL1(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceL1.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the L2 norm of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceL2(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceL2.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the log sum of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or undefined otherwise. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceLogSum(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceLogSum.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the log sum exponent of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or undefined otherwise. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceLogSumExp(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceLogSumExp.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the max of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or the minimum value of the data type otherwise. - /// - /// + /// + /// /// If the input data type is Boolean, the comparison should consider `False < True`. - /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMax(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMax.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the mean of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields undefined. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMean(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMean.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the min of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields plus infinity (if supported by the datatype) or the maximum value of the data type otherwise. - /// - /// + /// + /// /// If the input data type is Boolean, the comparison should consider `False < True`. - /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMin(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMin.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the product of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 1. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceProd(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceProd.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the sum of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceSum(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceSum.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the sum square of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceSumSquare(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceSumSquare.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - + /// RegexFullMatch performs a full regex match on each element of the input tensor. If an element fully matches the regex pattern specified as an attribute, the corresponding element in the output is True and it is False otherwise. [RE2](https://github.com/google/re2/wiki/Syntax) regex syntax is used. public static Tensor RegexFullMatch(Tensor X, Optional pattern) { Object result = OnnxInterpreter.interpret(OnnxOps.RegexFullMatch.class, List.of(X), List.of(pattern)); return (Tensor) result; } - - /// + + /// /// Relu takes one input data (Tensor) and produces one output data /// (Tensor) where the rectified linear function, y = max(0, x), is applied to /// the tensor elementwise. @@ -3145,8 +3145,8 @@ public static Tensor Relu(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Relu.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Reshape the input tensor similar to numpy.reshape. /// First input is the data tensor, second input is a shape tensor which specifies the output shape. It outputs the reshaped tensor. /// At most one dimension of the new shape can be -1. In this case, the value is @@ -3156,7 +3156,7 @@ public static Tensor Relu(Tensor X) { /// dimension will be set explicitly to zero (i.e. not taken from input tensor). /// Shape (second input) could be an empty shape, which means converting to a scalar. /// The input tensor's shape and the output tensor's shape are required to have the same number of elements. - /// + /// /// If the attribute 'allowzero' is set, it is invalid for the specified shape to /// contain both a zero value and -1, as the value of the dimension corresponding /// to -1 cannot be determined uniquely. @@ -3164,8 +3164,8 @@ public static Tensor Reshape(Tensor data, Tensor shape, Optional Object result = OnnxInterpreter.interpret(OnnxOps.Reshape.class, List.of(data, shape), List.of(allowzero)); return (Tensor) result; } - - /// + + /// /// Resize the input tensor. In general, it calculates every value in the output tensor as a weighted average of neighborhood (a.k.a. sampling locations) in the input tensor. /// Each dimension value of the output tensor is: /// ``` @@ -3176,14 +3176,14 @@ public static Tensor Resize(Tensor X, Optional> roi, Object result = OnnxInterpreter.interpret(OnnxOps.Resize.class, List.of(X, roi, scales, sizes), List.of(mode, extrapolation_value, nearest_mode, antialias, cubic_coeff_a, axes, coordinate_transformation_mode, keep_aspect_ratio_policy, exclude_outside)); return (Tensor) result; } - - /// + + /// /// Reverse batch of sequences having different lengths specified by `sequence_lens`. - /// + /// /// For each slice i iterating on batch axis, the operator reverses the first sequence_lens[i] elements on time axis, /// and copies elements whose index's beyond sequence_lens[i] to the output. So the output slice i contains reversed /// sequences on the first sequence_lens[i] elements, then have original values copied for the other elements. - /// + /// /// Example 1: /// input = [[0.0, 4.0, 8.0, 12.0], /// [1.0, 5.0, 9.0, 13.0], @@ -3192,12 +3192,12 @@ public static Tensor Resize(Tensor X, Optional> roi, /// sequence_lens = [4, 3, 2, 1] /// time_axis = 0 /// batch_axis = 1 - /// + /// /// output = [[3.0, 6.0, 9.0, 12.0], /// [2.0, 5.0, 8.0, 13.0], /// [1.0, 4.0, 10.0, 14.0], /// [0.0, 7.0, 11.0, 15.0]] - /// + /// /// Example 2: /// input = [[0.0, 1.0, 2.0, 3.0 ], /// [4.0, 5.0, 6.0, 7.0 ], @@ -3206,7 +3206,7 @@ public static Tensor Resize(Tensor X, Optional> roi, /// sequence_lens = [1, 2, 3, 4] /// time_axis = 1 /// batch_axis = 0 - /// + /// /// output = [[0.0, 1.0, 2.0, 3.0 ], /// [5.0, 4.0, 6.0, 7.0 ], /// [10.0, 9.0, 8.0, 11.0], @@ -3215,14 +3215,14 @@ public static Tensor ReverseSequence(Tensor input, Tensor sequen Object result = OnnxInterpreter.interpret(OnnxOps.ReverseSequence.class, List.of(input, sequence_lens), List.of(time_axis, batch_axis)); return (Tensor) result; } - - /// + + /// /// Region of Interest (RoI) align operation described in the /// [Mask R-CNN paper](https://arxiv.org/abs/1703.06870). /// RoiAlign consumes an input tensor X and region of interests (rois) /// to apply pooling across each RoI; it produces a 4-D tensor of shape /// (num_rois, C, output_height, output_width). - /// + /// /// RoiAlign is proposed to avoid the misalignment by removing /// quantizations while converting from original image into feature /// map and from feature map into RoI feature; in each ROI bin, @@ -3232,21 +3232,21 @@ public static Tensor RoiAlign(Tensor X, Tensor rois, Tensor) result; } - - /// + + /// /// RotaryEmbedding is the implementation of rotary positional embeddings (RoPE) based on the paper https://arxiv.org/pdf/2104.09864. /// The key advantage of RoPE is that it allows the model to understand both the absolute position of a token and the relative distances /// between tokens. This is achieved through a rotational mechanism where the extent of rotation is computed based on the token's absolute position (position_ids). - /// + /// /// The rotational mechanism is defined by sine and cosine functions that are used to represent the rotation angles. /// For each token in the sequence, its positional embedding is computed by rotating its embedding vector. This is done by splitting the /// embedding vector either into two halves or interleaving every alternate token and applying the rotation matrix to each half of the embedding vector. /// The rotation matrix is parameterized by the token's position in the sequence. The rotated halves of the embedding vector are concatenated /// to form the final positional embedding for each token. The rotated positional embeddings are used in the self-attention mechanism. /// The rotation ensures that the model captures both absolute and relative positional information. - /// + /// /// Rotary embeddings are defined using the following algorithm: - /// + /// /// ```python /// def rotary_embedding( /// input: np.ndarray, @@ -3271,7 +3271,7 @@ public static Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RotaryEmbedding(Tensor X, Tensor cos_cache, Te Object result = OnnxInterpreter.interpret(OnnxOps.RotaryEmbedding.class, List.of(X, cos_cache, sin_cache, position_ids), List.of(num_heads, rotary_embedding_dim, interleaved)); return (Tensor) result; } - - /// + + /// /// Round takes one input Tensor and rounds the values, element-wise, meaning /// it finds the nearest integer for each value. /// In case of halves, the rule is to round them to the nearest even integer. /// If input x is integral, +0, -0, NaN, or infinite, x itself is returned. /// The output tensor has the same shape and type as the input. - /// + /// /// Examples: /// ``` /// round([0.9]) = [1.0] @@ -3358,61 +3358,61 @@ public static Tensor Round(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Round.class, List.of(X), List.of()); return (Tensor) result; } - + /// Computes the Short-time Fourier Transform of the signal. public static Tensor STFT(Tensor signal, Tensor frame_step, Optional> window, Optional> frame_length, Optional onesided) { Object result = OnnxInterpreter.interpret(OnnxOps.STFT.class, List.of(signal, frame_step, window, frame_length), List.of(onesided)); return (Tensor) result; } - + public record SVMClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// Support Vector Machine classifier public static SVMClassifierResult SVMClassifier(Tensor X, Optional prob_b, Optional kernel_params, Optional kernel_type, Optional classlabels_ints, Optional post_transform, Optional rho, Optional coefficients, Optional support_vectors, Optional vectors_per_class, Optional prob_a, Optional classlabels_strings) { Object result = OnnxInterpreter.interpret(OnnxOps.SVMClassifier.class, List.of(X), List.of(prob_b, kernel_params, kernel_type, classlabels_ints, post_transform, rho, coefficients, support_vectors, vectors_per_class, prob_a, classlabels_strings)); Object[] resultArray = (Object[]) result; return new SVMClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Support Vector Machine regression prediction and one-class SVM anomaly detection. public static Tensor SVMRegressor(Tensor X, Optional kernel_type, Optional kernel_params, Optional n_supports, Optional rho, Optional post_transform, Optional coefficients, Optional support_vectors, Optional one_class) { Object result = OnnxInterpreter.interpret(OnnxOps.SVMRegressor.class, List.of(X), List.of(kernel_type, kernel_params, n_supports, rho, post_transform, coefficients, support_vectors, one_class)); return (Tensor) result; } - - /// + + /// /// Rescale input data, for example to standardize features by removing the mean and scaling to unit variance. public static Tensor Scaler(Tensor X, Optional offset, Optional scale) { Object result = OnnxInterpreter.interpret(OnnxOps.Scaler.class, List.of(X), List.of(offset, scale)); return (Tensor) result; } - - /// + + /// /// This operator is deprecated. Please use ScatterElements, which provides the same functionality. - /// + /// /// Scatter takes three inputs `data`, `updates`, and `indices` of the same /// rank r >= 1 and an optional attribute axis that identifies an axis of `data` /// (by default, the outer-most axis, that is axis 0). The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value /// to values specified by `updates` at specific index positions specified by /// `indices`. Its output shape is the same as the shape of `data`. - /// + /// /// For each entry in `updates`, the target index in `data` is obtained by combining /// the corresponding entry in `indices` with the index of the entry itself: the /// index-value for dimension = axis is obtained from the value of the corresponding /// entry in `indices` and the index-value for dimension != axis is obtained from the /// index of the entry itself. - /// + /// /// For instance, in a 2-D tensor case, the update corresponding to the [i][j] entry /// is performed as below: /// ``` /// output[indices[i][j]][j] = updates[i][j] if axis = 0, /// output[i][indices[i][j]] = updates[i][j] if axis = 1, /// ``` - /// + /// /// This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation. - /// + /// /// Example 1: /// ``` /// data = [ @@ -3446,21 +3446,21 @@ public static Tensor Scatter(Tensor data, Tensor indices, Object result = OnnxInterpreter.interpret(OnnxOps.Scatter.class, List.of(data, indices, updates), List.of(axis)); return (Tensor) result; } - - /// + + /// /// ScatterElements takes three inputs `data`, `updates`, and `indices` of the same /// rank r >= 1 and an optional attribute axis that identifies an axis of `data` /// (by default, the outer-most axis, that is axis 0). The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value /// to values specified by `updates` at specific index positions specified by /// `indices`. Its output shape is the same as the shape of `data`. - /// + /// /// For each entry in `updates`, the target index in `data` is obtained by combining /// the corresponding entry in `indices` with the index of the entry itself: the /// index-value for dimension = axis is obtained from the value of the corresponding /// entry in `indices` and the index-value for dimension != axis is obtained from the /// index of the entry itself. - /// + /// /// `reduction` allows specification of an optional reduction operation, which is applied to all values in `updates` /// tensor into `output` at the specified `indices`. /// In cases where `reduction` is set to "none", indices should not have duplicate entries: that is, if idx1 != idx2, @@ -3476,11 +3476,11 @@ public static Tensor Scatter(Tensor data, Tensor indices, /// output[i][indices[i][j]] = f(output[i][indices[i][j]], updates[i][j]) if axis = 1, /// ``` /// where the `f` is `+`, `*`, `max` or `min` as specified. - /// + /// /// This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation. - /// + /// /// (Opset 18 change): Adds max/min to the set of allowed reduction ops. - /// + /// /// Example 1: /// ``` /// data = [ @@ -3514,21 +3514,21 @@ public static Tensor ScatterElements(Tensor data, Tensor i Object result = OnnxInterpreter.interpret(OnnxOps.ScatterElements.class, List.of(data, indices, updates), List.of(reduction, axis)); return (Tensor) result; } - - /// + + /// /// ScatterND takes three inputs `data` tensor of rank r >= 1, `indices` tensor of rank q >= 1, /// and `updates` tensor of rank q + r - indices.shape[-1] - 1. The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value to values /// specified by `updates` at specific index positions specified by `indices`. Its output shape /// is the same as the shape of `data`. - /// + /// /// `indices` is an integer tensor. Let k denote indices.shape[-1], the last dimension in the shape of `indices`. /// `indices` is treated as a (q-1)-dimensional tensor of k-tuples, where each k-tuple is a partial-index into `data`. /// Hence, k can be a value at most the rank of `data`. When k equals rank(data), each update entry specifies an /// update to a single element of the tensor. When k is less than rank(data) each update entry specifies an /// update to a slice of the tensor. Index values are allowed to be negative, as per the usual /// convention for counting backwards from the end, but are expected in the valid range. - /// + /// /// `updates` is treated as a (q-1)-dimensional tensor of replacement-slice-values. Thus, the /// first (q-1) dimensions of updates.shape must match the first (q-1) dimensions of indices.shape. /// The remaining dimensions of `updates` correspond to the dimensions of the @@ -3536,39 +3536,39 @@ public static Tensor ScatterElements(Tensor data, Tensor i /// corresponding to the trailing (r-k) dimensions of `data`. Thus, the shape of `updates` /// must equal indices.shape[0:q-1] ++ data.shape[k:r-1], where ++ denotes the concatenation /// of shapes. - /// + /// /// The `output` is calculated via the following equation: - /// + /// /// ``` /// output = np.copy(data) /// update_indices = indices.shape[:-1] /// for idx in np.ndindex(update_indices): /// output[tuple(indices[idx])] = updates[idx] /// ``` - /// + /// /// The order of iteration in the above loop is not specified. /// In particular, indices should not have duplicate entries: that is, if idx1 != idx2, then indices[idx1] != indices[idx2]. /// This ensures that the output value does not depend on the iteration order. - /// + /// /// `reduction` allows specification of an optional reduction operation, which is applied to all values in `updates` /// tensor into `output` at the specified `indices`. /// In cases where `reduction` is set to "none", indices should not have duplicate entries: that is, if idx1 != idx2, /// then indices[idx1] != indices[idx2]. This ensures that the output value does not depend on the iteration order. /// When `reduction` is set to some reduction function `f`, `output` is calculated as follows: - /// + /// /// ``` /// output = np.copy(data) /// update_indices = indices.shape[:-1] /// for idx in np.ndindex(update_indices): /// output[tuple(indices[idx])] = f(output[tuple(indices[idx])], updates[idx]) /// ``` - /// + /// /// where the `f` is `+`, `*`, `max` or `min` as specified. - /// + /// /// This operator is the inverse of GatherND. - /// + /// /// (Opset 18 change): Adds max/min to the set of allowed reduction ops. - /// + /// /// Example 1: /// ``` /// data = [1, 2, 3, 4, 5, 6, 7, 8] @@ -3576,7 +3576,7 @@ public static Tensor ScatterElements(Tensor data, Tensor i /// updates = [9, 10, 11, 12] /// output = [1, 11, 3, 10, 9, 6, 7, 12] /// ``` - /// + /// /// Example 2: /// ``` /// data = [[[1, 2, 3, 4], [5, 6, 7, 8], [8, 7, 6, 5], [4, 3, 2, 1]], @@ -3595,8 +3595,8 @@ public static Tensor ScatterND(Tensor data, Tensor indices, Tens Object result = OnnxInterpreter.interpret(OnnxOps.ScatterND.class, List.of(data, indices, updates), List.of(reduction)); return (Tensor) result; } - - /// + + /// /// Selu takes one input data (Tensor) and produces one output data /// (Tensor) where the scaled exponential linear unit function, /// `y = gamma * (alpha * e^x - alpha) for x <= 0`, `y = gamma * x for x > 0`, @@ -3605,8 +3605,8 @@ public static Tensor Selu(Tensor X, Optional alpha, Optional) result; } - - /// + + /// /// Outputs a tensor copy from the tensor at 'position' in 'input_sequence'. /// Accepted range for 'position' is in `[-n, n - 1]`, where `n` is the number of tensors in 'input_sequence'. /// Negative value means counting positions from the back. @@ -3614,23 +3614,23 @@ public static Tensor SequenceAt(List> input_sequence, Ten Object result = OnnxInterpreter.interpret(OnnxOps.SequenceAt.class, List.of(input_sequence, position), List.of()); return (Tensor) result; } - - /// + + /// /// Construct a tensor sequence containing 'inputs' tensors. /// All tensors in 'inputs' must have the same data type. public static List> SequenceConstruct(List> inputs) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceConstruct.class, List.of(inputs), List.of()); return (List>) result; } - - /// + + /// /// Construct an empty tensor sequence, with given data type. public static List> SequenceEmpty(Optional dtype) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceEmpty.class, List.of(), List.of(dtype)); return (List>) result; } - - /// + + /// /// Outputs a tensor sequence that removes the tensor at 'position' from 'input_sequence'. /// Accepted range for 'position' is in `[-n, n - 1]`, where `n` is the number of tensors in 'input_sequence'. /// Negative value means counting positions from the back. @@ -3639,8 +3639,8 @@ public static List> SequenceErase(List> input_sequenc Object result = OnnxInterpreter.interpret(OnnxOps.SequenceErase.class, List.of(input_sequence, position), List.of()); return (List>) result; } - - /// + + /// /// Outputs a tensor sequence that inserts 'tensor' into 'input_sequence' at 'position'. /// 'tensor' must have the same data type as 'input_sequence'. /// Accepted range for 'position' is in `[-n, n]`, where `n` is the number of tensors in 'input_sequence'. @@ -3650,15 +3650,15 @@ public static List> SequenceInsert(List> input_seq Object result = OnnxInterpreter.interpret(OnnxOps.SequenceInsert.class, List.of(input_sequence, tensor, position), List.of()); return (List>) result; } - - /// + + /// /// Produces a scalar(tensor of empty shape) containing the number of tensors in 'input_sequence'. public static Tensor SequenceLength(List> input_sequence) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceLength.class, List.of(input_sequence), List.of()); return (Tensor) result; } - - /// + + /// /// Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor. /// Optional attributes start and end can be used to compute a slice of the input tensor's shape. /// If start axis is omitted, the slice starts from axis 0. @@ -3670,27 +3670,27 @@ public static Tensor SequenceLength(List> input_sequence) { /// negative axis). Thus, specifying any end value > r is equivalent to specifying an end /// value of r, and specifying any start value < -r is equivalent to specifying a start /// value of 0. If start > end, the result will be an empty shape. - /// + /// /// Examples: - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// No attributes specified. /// Output: [2, 3, 4] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// start: -1 /// Output: [4] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// end: -1 /// Output: [2, 3] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// start: 1 @@ -3701,8 +3701,8 @@ public static Tensor Shape(Tensor data, Optional start, Optio Object result = OnnxInterpreter.interpret(OnnxOps.Shape.class, List.of(data), List.of(start, end)); return (Tensor) result; } - - /// + + /// /// Shrink takes one input data (Tensor) and produces one Tensor output, /// having same datatype and shape with input. It has two attributes, lambd and /// bias. The formula of this operator is: If x < -lambd, y = x + bias; @@ -3711,8 +3711,8 @@ public static Tensor Shrink(Tensor input, Optional lambd, Optio Object result = OnnxInterpreter.interpret(OnnxOps.Shrink.class, List.of(input), List.of(lambd, bias)); return (Tensor) result; } - - /// + + /// /// Sigmoid takes one input data (Tensor) and produces one output data /// (Tensor) where the sigmoid function, y = 1 / (1 + exp(-x)), is applied to the /// tensor elementwise. @@ -3720,72 +3720,72 @@ public static Tensor Sigmoid(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Sigmoid.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Calculate the sign of the given input tensor element-wise. /// If input > 0, output 1. if input < 0, output -1. if input == 0, output 0. public static Tensor Sign(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sign.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the sine of the given input tensor, element-wise. public static Tensor Sin(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sin.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic sine of the given input tensor element-wise. public static Tensor Sinh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sinh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Takes a tensor as input and outputs a int64 scalar that equals to the total number of elements of the input tensor. public static Tensor Size(Tensor data) { Object result = OnnxInterpreter.interpret(OnnxOps.Size.class, List.of(data), List.of()); return (Tensor) result; } - - /// + + /// /// Produces a slice of the input tensor along multiple axes. Similar to numpy: /// https://numpy.org/doc/stable/user/basics.indexing.html?highlight=slice#slicing-and-striding - /// + /// /// Slice uses the `starts`, `ends`, `axes` and `steps` inputs to select a sub-tensor /// of its input `data` tensor. - /// + /// /// An effective `starts[i]`, `ends[i]`, and `steps[i]` must be computed for each `i` /// in `[0, ... r-1]` where `r = rank(input)` as follows: - /// + /// /// If `axes` are omitted, they are set to `[0, ..., r-1]`. /// If `steps` are omitted, they are set to `[1, ..., 1]` of length `len(starts)` - /// + /// /// The effective values are initialized as `start[i] = 0`, `ends[i] = dims[i]` where /// `dims` are the dimensions of `input` and `steps[i] = 1`. - /// + /// /// All negative elements of `axes` are made non-negative by adding `r` to them, where /// `r =rank(input)`. - /// + /// /// All negative values in `starts[i]` and `ends[i]` have `dims[axes[i]]` added to them, /// where `dims` are the dimensions of `input`. Then `start[axes[i]]` is the adjusted /// `starts[i]` is clamped into the range `[0, dims[axes[i]]]` for positive stepping /// and `[0, dims[axes[i]]-1]` for negative stepping. - /// + /// /// The clamping for the adjusted `ends[i]` depends on the sign of `steps[i]` and must /// accommodate copying 0 through `dims[axes[i]]` elements, so for positive stepping /// `ends[axes[i]]` is clamped to `[0, dims[axes[i]]]`, while for negative stepping it /// is clamped to `[-1, dims[axes[i]]-1]`. - /// + /// /// Finally, `steps[axes[i]] = steps[i]`. - /// + /// /// For slicing to the end of a dimension with unknown size, it is recommended to pass /// in `INT_MAX` when slicing forward and 'INT_MIN' when slicing backward. - /// + /// /// Example 1: - /// + /// /// ``` /// data = [ /// [1, 2, 3, 4], @@ -3799,9 +3799,9 @@ public static Tensor Size(Tensor data) { /// [5, 7], /// ] /// ``` - /// + /// /// Example 2: - /// + /// /// ``` /// data = [ /// [1, 2, 3, 4], @@ -3817,12 +3817,12 @@ public static Tensor Slice(Tensor data, Tensor starts, Ten Object result = OnnxInterpreter.interpret(OnnxOps.Slice.class, List.of(data, starts, ends, axes, steps), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the normalized exponential values for the given input: - /// - /// Softmax(input, axis) = Exp(input) / ReduceSum(Exp(input), axis=axis, keepdims=1) - /// + /// + /// Softmax(input, axis) = Exp(input) / ReduceSum(Exp(input), axis=axis, keepdims=1) + /// /// The "axis" attribute indicates the dimension along which Softmax /// will be performed. The output tensor has the same shape /// and contains the Softmax values of the corresponding input. @@ -3830,7 +3830,7 @@ public static Tensor Softmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Softmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - + public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_prob) { } /// Loss function that measures the softmax cross entropy /// between 'scores' and 'labels'. @@ -3839,12 +3839,12 @@ public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_p /// If the input is N-D tensor with shape (N, C, D1, D2, ..., Dk), /// the loss tensor L may have (N, D1, D2, ..., Dk) as its shape and L[i,][j_1][j_2]...[j_k] denotes a scalar element in L. /// After L is available, this operator can optionally do a reduction operator. - /// + /// /// * shape(scores): (N, C) where C is the number of classes, or (N, C, D1, D2,..., Dk), /// with K >= 1 in case of K-dimensional loss. /// * shape(labels): (N) where each value is 0 <= labels[i] <= C-1, or (N, D1, D2,..., Dk), /// with K >= 1 in case of K-dimensional loss. - /// + /// /// The loss for one sample, l_i, can calculated as follows: /// ``` /// l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk], where i is the index of classes. @@ -3853,21 +3853,21 @@ public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_p /// ``` /// l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk] * weights[c], if 'weights' is provided. /// ``` - /// + /// /// loss is zero for the case when label-value equals ignore_index. /// ``` /// l[i][d1][d2]...[dk] = 0, when labels[n][d1][d2]...[dk] = ignore_index /// ``` - /// + /// /// where: /// ``` /// p = Softmax(scores) /// y = Log(p) /// c = labels[i][d1][d2]...[dk] /// ``` - /// + /// /// Finally, L is optionally reduced: - /// + /// /// * If reduction = 'none', the output is L with shape (N, D1, D2, ..., Dk). /// * If reduction = 'sum', the output is scalar: Sum(L). /// * If reduction = 'mean', the output is scalar: ReduceMean(L), or if weight is provided: `ReduceSum(L) / ReduceSum(W)`, @@ -3877,8 +3877,8 @@ public static SoftmaxCrossEntropyLossResult SoftmaxCrossEntropyLoss Object[] resultArray = (Object[]) result; return new SoftmaxCrossEntropyLossResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Softplus takes one input data (Tensor) and produces one output data /// (Tensor) where the softplus function, y = ln(exp(x) + 1), is applied to /// the tensor elementwise. @@ -3886,14 +3886,14 @@ public static Tensor Softplus(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Softplus.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the softsign (x/(1+|x|)) of the given input tensor element-wise. public static Tensor Softsign(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Softsign.class, List.of(input), List.of()); return (Tensor) result; } - + /// SpaceToDepth rearranges blocks of spatial data into depth. More specifically, /// this op outputs a copy of the input tensor where values from the height and width dimensions /// are moved to the depth dimension. @@ -3901,7 +3901,7 @@ public static Tensor SpaceToDepth(Tensor input, long blocksize) { Object result = OnnxInterpreter.interpret(OnnxOps.SpaceToDepth.class, List.of(input), List.of(blocksize)); return (Tensor) result; } - + /// Split a tensor into a list of tensors, along the specified 'axis'. /// Either input 'split' or the attribute 'num_outputs' should be specified, but not both. /// If the attribute 'num_outputs' is specified, then the tensor is split into equal sized parts. @@ -3911,8 +3911,8 @@ public static List> Split(Tensor input, Optional> Object result = OnnxInterpreter.interpret(OnnxOps.Split.class, List.of(input, split), List.of(num_outputs, axis)); return (List>) result; } - - /// + + /// /// Split a tensor into a sequence of tensors, along the specified 'axis'. /// Lengths of the parts can be specified using the optional argument 'split'. /// If the argument `split' is not specified, a default scalar value of 1 @@ -3929,8 +3929,8 @@ public static List> SplitToSequence(Tensor input, Optiona Object result = OnnxInterpreter.interpret(OnnxOps.SplitToSequence.class, List.of(input, split), List.of(keepdims, axis)); return (List>) result; } - - /// + + /// /// Square root takes one input data (Tensor) and produces one output data /// (Tensor) where the square root is, y = x^0.5, is applied to /// the tensor elementwise. If x is negative, then it will return NaN. @@ -3938,8 +3938,8 @@ public static Tensor Sqrt(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Sqrt.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Remove single-dimensional entries from the shape of a tensor. /// Takes an input `axes` with a list of axes to squeeze. /// If `axes` is not provided, all the single dimensions will be removed from @@ -3948,14 +3948,14 @@ public static Tensor Squeeze(Tensor data, Optional> axes) Object result = OnnxInterpreter.interpret(OnnxOps.Squeeze.class, List.of(data, axes), List.of()); return (Tensor) result; } - + /// StringConcat concatenates string tensors elementwise (with NumPy-style broadcasting support) public static Tensor StringConcat(Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.StringConcat.class, List.of(X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// StringNormalization performs string operations for basic cleaning. /// This operator has only one input (denoted by X) and only one output /// (denoted by Y). This operator first examines the elements in the X, @@ -3969,31 +3969,31 @@ public static Tensor StringNormalizer(Tensor X, Optional i Object result = OnnxInterpreter.interpret(OnnxOps.StringNormalizer.class, List.of(X), List.of(is_case_sensitive, locale, stopwords, case_change_action)); return (Tensor) result; } - + public record StringSplitResult(Tensor Y, Tensor Z) { } /// StringSplit splits a string tensor's elements into substrings based on a delimiter attribute and a maxsplit attribute. - /// + /// /// The first output of this operator is a tensor of strings representing the substrings from splitting each input string on the `delimiter` substring. This tensor has one additional rank compared to the input tensor in order to store the substrings for each input element (where the input tensor is not empty). Note that, in order to ensure the same number of elements are present in the final dimension, this tensor will pad empty strings as illustrated in the examples below. Consecutive delimiters are not grouped together and are deemed to delimit empty strings, except if the `delimiter` is unspecified or is the empty string (""). In the case where the `delimiter` is unspecified or the empty string, consecutive whitespace characters are regarded as a single separator and leading or trailing whitespace is removed in the output. - /// + /// /// The second output tensor represents the number of substrings generated. `maxsplit` can be used to limit the number of splits performed - after the `maxsplit`th split if the string is not fully split, the trailing suffix of input string after the final split point is also added. For elements where fewer splits are possible than specified in `maxsplit`, it has no effect. public static StringSplitResult StringSplit(Tensor X, Optional delimiter, Optional maxsplit) { Object result = OnnxInterpreter.interpret(OnnxOps.StringSplit.class, List.of(X), List.of(delimiter, maxsplit)); Object[] resultArray = (Object[]) result; return new StringSplitResult((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Performs element-wise binary subtraction (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Sub(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Sub.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Element-wise sum of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -4001,42 +4001,42 @@ public static Tensor Sum(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Sum.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// Swish function takes one input data (Tensor) and produces one output data (Tensor) of the same shape, /// where $Swish(x) = x * sigmoid(alpha * x)$. public static Tensor Swish(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.Swish.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Calculates the tangent of the given input tensor, element-wise. public static Tensor Tan(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Tan.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic tangent of the given input tensor element-wise. public static Tensor Tanh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Tanh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// TensorScatter is a generic tensor update operation, motivated by the requirements for KV cache updates for Attention /// ops commonly found in LLMs. It is a functional operation that models an in-place update to a KV cache buffer. - /// + /// /// The past and present cache tensors have the same shape (batch_size, D1, D2, ..., max_sequence_length, ..., Dn), with /// the sequence dimension (indicated by the `axis` attribute) being max_sequence_length, so the sizes of these tensors do /// not need to grow between iterations. The `update` tensor's shape only differs from the cache tensors in the sequence /// dimension: (batch_size, D1, D2, ..., sequence_length, ..., Dn), where sequence_length <= max_sequence_length. - /// + /// /// The optional `write_indices` input indicates the write index for each sample in the batch, assumed to be zero /// if not provided. When the `mode` attribute is set to "circular", the write index is modulo max_sequence_length. /// The operation can be described using the following pseudocode: - /// + /// /// ``` /// for prefix_idx in np.ndindex(past_cache.shape[:axis]): /// batch_idx = prefix_idx[0] @@ -4047,7 +4047,7 @@ public static Tensor Tanh(Tensor input) { /// update_idx = (*prefix_idx, sequence_idx) /// present_cache[cache_idx] = update[update_idx] /// ``` - /// + /// /// During the prefill phase of attention, only the first two inputs are needed. During the decode phase, `write_indices` /// is also needed so that the incoming key or value update can be appended after the last valid token for each sample /// in the batch. @@ -4055,14 +4055,14 @@ public static Tensor TensorScatter(Tensor past_cache, Tensor update Object result = OnnxInterpreter.interpret(OnnxOps.TensorScatter.class, List.of(past_cache, update, write_indices), List.of(mode, axis)); return (Tensor) result; } - - /// + + /// /// This transform extracts n-grams from the input sequence and save them as a vector. Input can /// be either a 1-D or 2-D tensor. For 1-D input, output is the n-gram representation of that input. /// For 2-D input, the output is also a 2-D tensor whose i-th row is the n-gram representation of the i-th input row. /// More specifically, if input shape is [C], the corresponding output shape would be [max(ngram_indexes) + 1]. /// If input shape is [N, C], this operator produces a [N, max(ngram_indexes) + 1]-tensor. - /// + /// /// In contrast to standard n-gram extraction, here, the indexes of extracting an n-gram from the original /// sequence are not necessarily consecutive numbers. The discontinuity between indexes are controlled by the number of skips. /// If the number of skips is 2, we should skip two tokens when scanning through the original sequence. @@ -4070,26 +4070,26 @@ public static Tensor TensorScatter(Tensor past_cache, Tensor update /// The associated 2-grams are [94, 12] and [17, 28] respectively indexed by [0, 3] and [1, 4]. /// If the number of skips becomes 0, the 2-grams generated are [94, 17], [17, 36], [36, 12], [12, 28] /// indexed by [0, 1], [1, 2], [2, 3], [3, 4], respectively. - /// + /// /// The output vector (denoted by Y) stores the count of each n-gram; /// Y[ngram_indexes[i]] indicates the times that the i-th n-gram is found. The attribute ngram_indexes is used to determine the mapping /// between index i and the corresponding n-gram's output coordinate. If pool_int64s is [94, 17, 17, 36], ngram_indexes is [1, 0], /// ngram_counts=[0, 0], then the Y[0] (first element in Y) and Y[1] (second element in Y) are the counts of [17, 36] and [94, 17], /// respectively. An n-gram which cannot be found in pool_strings/pool_int64s should be ignored and has no effect on the output. /// Note that we may consider all skips up to S when generating the n-grams. - /// + /// /// The examples used above are true if mode is "TF". If mode is "IDF", all the counts larger than 1 would be truncated to 1 and /// the i-th element in weights would be used to scale (by multiplication) the count of the i-th n-gram in pool. If mode is "TFIDF", /// this operator first computes the counts of all n-grams and then scale them by the associated values in the weights attribute. - /// + /// /// Only one of pool_strings and pool_int64s can be set. If pool_int64s is set, the input should be an integer tensor. /// If pool_strings is set, the input must be a string tensor. public static Tensor TfIdfVectorizer(Tensor X, long[] ngram_counts, long min_gram_length, Optional pool_strings, String mode, long max_gram_length, long max_skip_count, Optional pool_int64s, Optional weights, long[] ngram_indexes) { Object result = OnnxInterpreter.interpret(OnnxOps.TfIdfVectorizer.class, List.of(X), List.of(ngram_counts, min_gram_length, pool_strings, mode, max_gram_length, max_skip_count, pool_int64s, weights, ngram_indexes)); return (Tensor) result; } - - /// + + /// /// ThresholdedRelu takes one input data (Tensor) and produces one output data /// (Tensor) where the rectified linear function, y = x for x > alpha, y = 0 otherwise, /// is applied to the tensor elementwise. @@ -4097,7 +4097,7 @@ public static Tensor ThresholdedRelu(Tensor X, Optional alpha) Object result = OnnxInterpreter.interpret(OnnxOps.ThresholdedRelu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - + /// Constructs a tensor by tiling a given tensor. /// This is the same as function `tile` in Numpy, but no broadcast. /// For example A = [[1, 2], [3, 4]], B = [1, 2], tile(A, B) = [[1, 2, 1, 2], [3, 4, 3, 4]] @@ -4105,22 +4105,22 @@ public static Tensor Tile(Tensor input, Tensor repeats) { Object result = OnnxInterpreter.interpret(OnnxOps.Tile.class, List.of(input, repeats), List.of()); return (Tensor) result; } - + public record TopKResult(Tensor Values, Tensor Indices) { } - /// + /// /// Retrieve the top-K largest or smallest elements along a specified axis. Given an input tensor of /// shape [a_0, a_1, ..., a_{n-1}] and integer argument k, return two outputs: - /// + /// /// * Value tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}] /// which contains the values of the top k elements along the specified axis /// * Index tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}] which /// contains the indices of the top k elements (original indices from the input /// tensor). - /// + /// /// * If "largest" is 1 (the default value) then the k largest elements are returned. /// * If "sorted" is 1 (the default value) then the resulting k elements will be sorted. /// * If "sorted" is 0, order of returned 'Values' and 'Indices' are undefined. - /// + /// /// Given two equivalent values, this operator uses the indices along the axis as /// a tiebreaker. That is, the element with the lower index will appear first. public static TopKResult TopK(Tensor X, Tensor K, Optional largest, Optional sorted, Optional axis) { @@ -4128,8 +4128,8 @@ public static TopKResult TopK(Tensor X, Tensor K, Optional Object[] resultArray = (Object[]) result; return new TopKResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Returns a transpose of the input tensor. (Similar to `numpy.transpose`). /// The optional attribute `perm` must be a permutation of the dimensions of /// the input tensor. Axis `i` of the output tensor corresponds to the axis @@ -4144,17 +4144,17 @@ public static Tensor Transpose(Tensor data, Optional perm) { Object result = OnnxInterpreter.interpret(OnnxOps.Transpose.class, List.of(data), List.of(perm)); return (Tensor) result; } - - /// + + /// /// Tree Ensemble operator. Returns the regressed values for each input in a batch. /// Inputs have dimensions `[N, F]` where `N` is the input batch size and `F` is the number of input features. /// Outputs have dimensions `[N, num_targets]` where `N` is the batch size and `num_targets` is the number of targets, which is a configurable attribute. - /// + /// /// The encoding of this attribute is split along interior nodes and the leaves of the trees. Notably, attributes with the prefix `nodes_*` are associated with interior nodes, and attributes with the prefix `leaf_*` are associated with leaves. /// The attributes `nodes_*` must all have the same length and encode a sequence of tuples, as defined by taking all the `nodes_*` fields at a given position. - /// + /// /// All fields prefixed with `leaf_*` represent tree leaves, and similarly define tuples of leaves and must have identical length. - /// + /// /// This operator can be used to implement both the previous `TreeEnsembleRegressor` and `TreeEnsembleClassifier` nodes. /// The `TreeEnsembleRegressor` node maps directly to this node and requires changing how the nodes are represented. /// The `TreeEnsembleClassifier` node can be implemented by adding a `ArgMax` node after this node to determine the top class. @@ -4163,9 +4163,9 @@ public static Tensor TreeEnsemble(Tensor X, Optional aggregate_f Object result = OnnxInterpreter.interpret(OnnxOps.TreeEnsemble.class, List.of(X), List.of(aggregate_function, nodes_hitrates, nodes_featureids, nodes_falseleafs, post_transform, nodes_trueleafs, nodes_modes, nodes_falsenodeids, nodes_truenodeids, leaf_weights, leaf_targetids, tree_roots, n_targets, nodes_missing_value_tracks_true, membership_values, nodes_splits)); return (Tensor) result; } - + public record TreeEnsembleClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// This operator is DEPRECATED. Please use TreeEnsemble with provides similar functionality. /// In order to determine the top class, the ArgMax node can be applied to the output of TreeEnsemble. /// To encode class labels, use a LabelEncoder operator. @@ -4185,8 +4185,8 @@ public static TreeEnsembleClassifierResult TreeEnsembleClassifier(T Object[] resultArray = (Object[]) result; return new TreeEnsembleClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// This operator is DEPRECATED. Please use TreeEnsemble instead which provides the same /// functionality.
/// Tree Ensemble regressor. Returns the regressed values for each input in N.
@@ -4205,8 +4205,8 @@ public static Tensor TreeEnsembleRegressor(Tensor X, Optional) result; } - - /// + + /// /// Given a 2-D matrix or batches of 2-D matrices, returns the upper or lower triangular part of the tensor(s). /// The attribute "upper" determines whether the upper or lower part is retained. If set to true, /// the upper triangular matrix is retained. Lower triangular matrix is retained otherwise. @@ -4223,22 +4223,22 @@ public static Tensor Trilu(Tensor input, Optional> k, Opt Object result = OnnxInterpreter.interpret(OnnxOps.Trilu.class, List.of(input, k), List.of(upper)); return (Tensor) result; } - + public record UniqueResult(Tensor Y, Tensor indices, Tensor inverse_indices, Tensor counts) { } - /// + /// /// Find the unique elements of a tensor. When an optional attribute 'axis' is provided, unique subtensors sliced along the 'axis' are returned. /// Otherwise the input tensor is flattened and unique values of the flattened tensor are returned. - /// + /// /// This operator returns the unique values or sliced unique subtensors of the input tensor and three optional outputs. /// The first output tensor 'Y' contains all unique values or subtensors of the input. /// The second optional output tensor 'indices' contains indices of 'Y' elements' first occurrence in 'X'. /// The third optional output tensor 'inverse_indices' contains, for elements of 'X', its corresponding indices in 'Y'. /// The fourth optional output tensor 'counts' contains the count of each element of 'Y' in the input. - /// + /// /// Outputs are either sorted in ascending order or optionally in the order of the first occurrence of the values in the input. - /// + /// /// https://docs.scipy.org/doc/numpy/reference/generated/numpy.unique.html - /// + /// /// Example 1: /// ``` /// input_X = [2, 1, 1, 3, 4, 3] @@ -4249,7 +4249,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 1, 1, 2, 3, 2] /// output_counts = [1, 2, 2, 1] /// ``` - /// + /// /// Example 2: /// ``` /// input_X = [[1, 3], [2, 3]] @@ -4260,7 +4260,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 2, 1, 2] /// output_counts = [1, 1, 2] /// ``` - /// + /// /// Example 3: /// ``` /// input_X = [[1, 0, 0], [1, 0, 0], [2, 3, 4]] @@ -4271,7 +4271,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 0, 1] /// output_counts = [2, 1] /// ``` - /// + /// /// Example 4: /// ``` /// input_x = [[[1., 1.], [0., 1.], [2., 1.], [0., 1.]], @@ -4279,7 +4279,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// attribute_sorted = 1 /// attribute_axis = 1 /// ``` - /// + /// /// intermediate data are presented below for better understanding: /// there are 4 subtensors sliced along axis 1 of input_x (shape = (2, 4, 2)): /// ``` @@ -4288,37 +4288,37 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// [[2, 1], [2, 1]], /// [[0, 1], [0, 1]]. /// ``` - /// + /// /// there are 3 unique subtensors: /// ``` /// [[1, 1], [1, 1]], /// [[0, 1], [0, 1]], /// [[2, 1], [2, 1]]. /// ``` - /// + /// /// sorted unique subtensors: /// ``` /// B: [[0, 1], [0, 1]], /// [[1, 1], [1, 1]], /// [[2, 1], [2, 1]]. /// ``` - /// + /// /// output_Y is constructed from B: /// ``` /// [[[0. 1.], [1. 1.], [2. 1.]], /// [[0. 1.], [1. 1.], [2. 1.]]] /// ``` - /// + /// /// output_indices is to map from B to A: /// ``` /// [1, 0, 2] /// ``` - /// + /// /// output_inverse_indices is to map from A to B: /// ``` /// [1, 0, 2, 0] /// ``` - /// + /// /// output_counts: /// ``` /// [2, 1, 1] @@ -4328,14 +4328,14 @@ public static UniqueResult Unique(Tensor X, Optional sorted, Opt Object[] resultArray = (Object[]) result; return new UniqueResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2], (Tensor)resultArray[3]); } - - /// + + /// /// Insert single-dimensional entries to the shape of an input tensor (`data`). /// Takes one required input `axes` - which contains a list of dimension indices and this operator will insert a dimension of value `1` into the corresponding index of the output tensor (`expanded`). - /// + /// /// For example, given an input tensor (`data`) of shape [3, 4, 5], then /// Unsqueeze(data, axes=[0, 4]) outputs a tensor (`expanded`) containing same data as `data` but with shape [1, 3, 4, 5, 1]. - /// + /// /// The input `axes` should not contain any duplicate entries. It is an error if it contains duplicates. /// The rank of the output tensor (`output_rank`) is the rank of the input tensor (`data`) plus the number of values in `axes`. /// Each value in `axes` should be within the (inclusive) range [-output_rank , output_rank - 1]. @@ -4344,8 +4344,8 @@ public static Tensor Unsqueeze(Tensor data, Tensor axes) { Object result = OnnxInterpreter.interpret(OnnxOps.Unsqueeze.class, List.of(data, axes), List.of()); return (Tensor) result; } - - /// + + /// /// Upsample the input tensor. /// Each dimension value of the output tensor is: /// output_dimension = floor(input_dimension * scale). @@ -4353,30 +4353,30 @@ public static Tensor Upsample(Tensor X, Tensor scales, Optional Object result = OnnxInterpreter.interpret(OnnxOps.Upsample.class, List.of(X, scales), List.of(mode)); return (Tensor) result; } - - /// + + /// /// Return elements, either from X or Y, depending on condition. /// Where behaves like /// [numpy.where](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html) /// with three parameters. - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Where(Tensor condition, Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.Where.class, List.of(condition, X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `xor` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Xor(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Xor.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Creates a map from the input and the attributes.
/// The values are provided by the input tensor, while the keys are specified by the attributes. /// Must provide keys in either classlabels_strings or classlabels_int64s (but not both).
@@ -4385,5 +4385,5 @@ public static List> ZipMap(Tensor X, Optional c Object result = OnnxInterpreter.interpret(OnnxOps.ZipMap.class, List.of(X), List.of(classlabels_int64s, classlabels_strings)); return (List>) result; } - + } From 76bf5bb9a8f62aaac713e079106082c0a578f0da Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Tue, 14 Jul 2026 16:05:23 +0200 Subject: [PATCH 10/18] Fix white spaces in OnnxOps Signed-off-by: Ana-Maria Mihalceanu --- .../java/oracle/code/onnx/ir/OnnxOps.java | 13716 ++++++++-------- 1 file changed, 6858 insertions(+), 6858 deletions(-) diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOps.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOps.java index 20f8d723bea..e7bc3d30d90 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOps.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxOps.java @@ -35,78 +35,78 @@ @SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "unused", "SequencedCollectionMethodCanBeUsed"}) public final class OnnxOps extends ExplicitOnnxOps { - + private OnnxOps() {} - + @OpFactoryHelper.OpDeclaration(Abs.NAME) public static final class Abs extends OnnxOp { public static final String NAME = "Abs"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -114,40 +114,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Abs(ExternalizedOp def) { super(SCHEMA, def); } - + Abs(Abs that, CodeContext cc) { super(that, cc); } - + @Override public Abs transform(CodeContext cc, CodeTransformer ot) { return new Abs(this, cc); } - + Abs(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Abs Abs(CodeType resultType, Value X) { return new Abs(resultType, X); } @@ -155,72 +155,72 @@ public static Abs Abs(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(Acos.NAME) public static final class Acos extends OnnxOp { public static final String NAME = "Acos"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -228,40 +228,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Acos(ExternalizedOp def) { super(SCHEMA, def); } - + Acos(Acos that, CodeContext cc) { super(that, cc); } - + @Override public Acos transform(CodeContext cc, CodeTransformer ot) { return new Acos(this, cc); } - + Acos(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Acos Acos(CodeType resultType, Value input) { return new Acos(resultType, input); } @@ -269,72 +269,72 @@ public static Acos Acos(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Acosh.NAME) public static final class Acosh extends OnnxOp { public static final String NAME = "Acosh"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -342,40 +342,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Acosh(ExternalizedOp def) { super(SCHEMA, def); } - + Acosh(Acosh that, CodeContext cc) { super(that, cc); } - + @Override public Acosh transform(CodeContext cc, CodeTransformer ot) { return new Acosh(this, cc); } - + Acosh(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Acosh Acosh(CodeType resultType, Value input) { return new Acosh(resultType, input); } @@ -383,104 +383,104 @@ public static Acosh Acosh(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Adagrad.NAME) public static final class Adagrad extends OnnxOp { public static final String NAME = "Adagrad"; - + public enum Attribute implements OnnxAttribute { epsilon(Float.class, true, 1.0E-6f), decay_factor(Float.class, true, 0.0f), norm_coefficient(Float.class, true, 0.0f), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { R(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), T(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), inputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { outputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -488,63 +488,63 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Adagrad(ExternalizedOp def) { super(SCHEMA, def); } - + Adagrad(Adagrad that, CodeContext cc) { super(that, cc); } - + @Override public Adagrad transform(CodeContext cc, CodeTransformer ot) { return new Adagrad(this, cc); } - + Adagrad(CodeType resultType, Value R, Value T, List inputs, java.util.Optional epsilon, java.util.Optional decay_factor, java.util.Optional norm_coefficient) { super(SCHEMA, resultType, Set.of(), List.of(R, T, inputs), List.of(epsilon, decay_factor, norm_coefficient)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(R(), T(), inputs())); } - + public Value R() { return operands().get(0); } - + public Value T() { return operands().get(1); } - + public List inputs() { return operands().subList(2, operands().size()); } - + public java.util.Optional epsilon() { Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(epsilon); } - + public java.util.Optional decay_factor() { Float decay_factor = Attribute.decay_factor.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(decay_factor); } - + public java.util.Optional norm_coefficient() { Float norm_coefficient = Attribute.norm_coefficient.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(norm_coefficient); } - + } - + public static Adagrad Adagrad(CodeType resultType, Value R, Value T, List inputs, java.util.Optional epsilon, java.util.Optional decay_factor, java.util.Optional norm_coefficient) { return new Adagrad(resultType, R, T, inputs, epsilon, decay_factor, norm_coefficient); } @@ -552,7 +552,7 @@ public static Adagrad Adagrad(CodeType resultType, Value R, Value T, List @OpFactoryHelper.OpDeclaration(Adam.NAME) public static final class Adam extends OnnxOp { public static final String NAME = "Adam"; - + public enum Attribute implements OnnxAttribute { epsilon(Float.class, true, 1.0E-6f), norm_coefficient_post(Float.class, true, 0.0f), @@ -560,98 +560,98 @@ public enum Attribute implements OnnxAttribute { alpha(Float.class, true, 0.9f), beta(Float.class, true, 0.999f), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { R(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), T(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), inputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { outputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -659,73 +659,73 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Adam(ExternalizedOp def) { super(SCHEMA, def); } - + Adam(Adam that, CodeContext cc) { super(that, cc); } - + @Override public Adam transform(CodeContext cc, CodeTransformer ot) { return new Adam(this, cc); } - + Adam(CodeType resultType, Value R, Value T, List inputs, java.util.Optional epsilon, java.util.Optional norm_coefficient_post, java.util.Optional norm_coefficient, java.util.Optional alpha, java.util.Optional beta) { super(SCHEMA, resultType, Set.of(), List.of(R, T, inputs), List.of(epsilon, norm_coefficient_post, norm_coefficient, alpha, beta)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(R(), T(), inputs())); } - + public Value R() { return operands().get(0); } - + public Value T() { return operands().get(1); } - + public List inputs() { return operands().subList(2, operands().size()); } - + public java.util.Optional epsilon() { Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(epsilon); } - + public java.util.Optional norm_coefficient_post() { Float norm_coefficient_post = Attribute.norm_coefficient_post.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(norm_coefficient_post); } - + public java.util.Optional norm_coefficient() { Float norm_coefficient = Attribute.norm_coefficient.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(norm_coefficient); } - + public java.util.Optional alpha() { Float alpha = Attribute.alpha.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(alpha); } - + public java.util.Optional beta() { Float beta = Attribute.beta.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(beta); } - + } - + public static Adam Adam(CodeType resultType, Value R, Value T, List inputs, java.util.Optional epsilon, java.util.Optional norm_coefficient_post, java.util.Optional norm_coefficient, java.util.Optional alpha, java.util.Optional beta) { return new Adam(resultType, R, T, inputs, epsilon, norm_coefficient_post, norm_coefficient, alpha, beta); } @@ -733,73 +733,73 @@ public static Adam Adam(CodeType resultType, Value R, Value T, List input @OpFactoryHelper.OpDeclaration(Add.NAME) public static final class Add extends OnnxOp { public static final String NAME = "Add"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -807,44 +807,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Add(ExternalizedOp def) { super(SCHEMA, def); } - + Add(Add that, CodeContext cc) { super(that, cc); } - + @Override public Add transform(CodeContext cc, CodeTransformer ot) { return new Add(this, cc); } - + Add(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static Add Add(CodeType resultType, Value A, Value B) { return new Add(resultType, A, B); } @@ -852,100 +852,100 @@ public static Add Add(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(AffineGrid.NAME) public static final class AffineGrid extends OnnxOp { public static final String NAME = "AffineGrid"; - + public enum Attribute implements OnnxAttribute { align_corners(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { theta(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), size(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { grid(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -953,49 +953,49 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public AffineGrid(ExternalizedOp def) { super(SCHEMA, def); } - + AffineGrid(AffineGrid that, CodeContext cc) { super(that, cc); } - + @Override public AffineGrid transform(CodeContext cc, CodeTransformer ot) { return new AffineGrid(this, cc); } - + AffineGrid(CodeType resultType, Value theta, Value size, java.util.Optional align_corners) { super(SCHEMA, resultType, Set.of(), List.of(theta, size), List.of(align_corners)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(theta(), size())); } - + public Value theta() { return operands().get(0); } - + public Value size() { return operands().get(1); } - + public java.util.Optional align_corners() { Long align_corners = Attribute.align_corners.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(align_corners); } - + } - + public static AffineGrid AffineGrid(CodeType resultType, Value theta, Value size, java.util.Optional align_corners) { return new AffineGrid(resultType, theta, size, align_corners); } @@ -1003,74 +1003,74 @@ public static AffineGrid AffineGrid(CodeType resultType, Value theta, Value size @OpFactoryHelper.OpDeclaration(And.NAME) public static final class And extends OnnxOp { public static final String NAME = "And"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bool())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -1078,44 +1078,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public And(ExternalizedOp def) { super(SCHEMA, def); } - + And(And that, CodeContext cc) { super(that, cc); } - + @Override public And transform(CodeContext cc, CodeTransformer ot) { return new And(this, cc); } - + And(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static And And(CodeType resultType, Value A, Value B) { return new And(resultType, A, B); } @@ -1123,100 +1123,100 @@ public static And And(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(ArgMax.NAME) public static final class ArgMax extends OnnxOp { public static final String NAME = "ArgMax"; - + public enum Attribute implements OnnxAttribute { keepdims(Long.class, true, 1), select_last_index(Long.class, true, 0), axis(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -1224,55 +1224,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ArgMax(ExternalizedOp def) { super(SCHEMA, def); } - + ArgMax(ArgMax that, CodeContext cc) { super(that, cc); } - + @Override public ArgMax transform(CodeContext cc, CodeTransformer ot) { return new ArgMax(this, cc); } - + ArgMax(CodeType resultType, Value data, java.util.Optional keepdims, java.util.Optional select_last_index, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(data), List.of(keepdims, select_last_index, axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + public java.util.Optional select_last_index() { Long select_last_index = Attribute.select_last_index.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(select_last_index); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static ArgMax ArgMax(CodeType resultType, Value data, java.util.Optional keepdims, java.util.Optional select_last_index, java.util.Optional axis) { return new ArgMax(resultType, data, keepdims, select_last_index, axis); } @@ -1280,100 +1280,100 @@ public static ArgMax ArgMax(CodeType resultType, Value data, java.util.Optional< @OpFactoryHelper.OpDeclaration(ArgMin.NAME) public static final class ArgMin extends OnnxOp { public static final String NAME = "ArgMin"; - + public enum Attribute implements OnnxAttribute { keepdims(Long.class, true, 1), select_last_index(Long.class, true, 0), axis(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -1381,55 +1381,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ArgMin(ExternalizedOp def) { super(SCHEMA, def); } - + ArgMin(ArgMin that, CodeContext cc) { super(that, cc); } - + @Override public ArgMin transform(CodeContext cc, CodeTransformer ot) { return new ArgMin(this, cc); } - + ArgMin(CodeType resultType, Value data, java.util.Optional keepdims, java.util.Optional select_last_index, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(data), List.of(keepdims, select_last_index, axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + public java.util.Optional select_last_index() { Long select_last_index = Attribute.select_last_index.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(select_last_index); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static ArgMin ArgMin(CodeType resultType, Value data, java.util.Optional keepdims, java.util.Optional select_last_index, java.util.Optional axis) { return new ArgMin(resultType, data, keepdims, select_last_index, axis); } @@ -1437,73 +1437,73 @@ public static ArgMin ArgMin(CodeType resultType, Value data, java.util.Optional< @OpFactoryHelper.OpDeclaration(ArrayFeatureExtractor.NAME) public static final class ArrayFeatureExtractor extends OnnxOp { public static final String NAME = "ArrayFeatureExtractor"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.string())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), Y(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Z(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -1511,44 +1511,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ArrayFeatureExtractor(ExternalizedOp def) { super(SCHEMA, def); } - + ArrayFeatureExtractor(ArrayFeatureExtractor that, CodeContext cc) { super(that, cc); } - + @Override public ArrayFeatureExtractor transform(CodeContext cc, CodeTransformer ot) { return new ArrayFeatureExtractor(this, cc); } - + ArrayFeatureExtractor(CodeType resultType, Value X, Value Y) { super(SCHEMA, resultType, Set.of(), List.of(X, Y), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), Y())); } - + public Value X() { return operands().get(0); } - + public Value Y() { return operands().get(1); } - + } - + public static ArrayFeatureExtractor ArrayFeatureExtractor(CodeType resultType, Value X, Value Y) { return new ArrayFeatureExtractor(resultType, X, Y); } @@ -1556,72 +1556,72 @@ public static ArrayFeatureExtractor ArrayFeatureExtractor(CodeType resultType, V @OpFactoryHelper.OpDeclaration(Asin.NAME) public static final class Asin extends OnnxOp { public static final String NAME = "Asin"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -1629,40 +1629,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Asin(ExternalizedOp def) { super(SCHEMA, def); } - + Asin(Asin that, CodeContext cc) { super(that, cc); } - + @Override public Asin transform(CodeContext cc, CodeTransformer ot) { return new Asin(this, cc); } - + Asin(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Asin Asin(CodeType resultType, Value input) { return new Asin(resultType, input); } @@ -1670,72 +1670,72 @@ public static Asin Asin(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Asinh.NAME) public static final class Asinh extends OnnxOp { public static final String NAME = "Asinh"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -1743,40 +1743,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Asinh(ExternalizedOp def) { super(SCHEMA, def); } - + Asinh(Asinh that, CodeContext cc) { super(that, cc); } - + @Override public Asinh transform(CodeContext cc, CodeTransformer ot) { return new Asinh(this, cc); } - + Asinh(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Asinh Asinh(CodeType resultType, Value input) { return new Asinh(resultType, input); } @@ -1784,72 +1784,72 @@ public static Asinh Asinh(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Atan.NAME) public static final class Atan extends OnnxOp { public static final String NAME = "Atan"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -1857,40 +1857,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Atan(ExternalizedOp def) { super(SCHEMA, def); } - + Atan(Atan that, CodeContext cc) { super(that, cc); } - + @Override public Atan transform(CodeContext cc, CodeTransformer ot) { return new Atan(this, cc); } - + Atan(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Atan Atan(CodeType resultType, Value input) { return new Atan(resultType, input); } @@ -1898,72 +1898,72 @@ public static Atan Atan(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Atanh.NAME) public static final class Atanh extends OnnxOp { public static final String NAME = "Atanh"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -1971,40 +1971,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Atanh(ExternalizedOp def) { super(SCHEMA, def); } - + Atanh(Atanh that, CodeContext cc) { super(that, cc); } - + @Override public Atanh transform(CodeContext cc, CodeTransformer ot) { return new Atanh(this, cc); } - + Atanh(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Atanh Atanh(CodeType resultType, Value input) { return new Atanh(resultType, input); } @@ -2012,7 +2012,7 @@ public static Atanh Atanh(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Attention.NAME) public static final class Attention extends OnnxOp { public static final String NAME = "Attention"; - + public enum Attribute implements OnnxAttribute { qk_matmul_output_mode(Long.class, true, 0), softcap(Float.class, true, 0.0f), @@ -2022,50 +2022,50 @@ public enum Attribute implements OnnxAttribute { q_num_heads(Long.class, true, null), kv_num_heads(Long.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), U(new OnnxType.TypeVariable("U", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { Q(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), K(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), @@ -2075,52 +2075,52 @@ public enum InputParameter implements OnnxParameter { past_value(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), nonpad_kv_seqlen(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), present_key(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL), present_value(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), qk_matmul_output(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -2128,103 +2128,103 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Attention(ExternalizedOp def) { super(SCHEMA, def); } - + Attention(Attention that, CodeContext cc) { super(that, cc); } - + @Override public Attention transform(CodeContext cc, CodeTransformer ot) { return new Attention(this, cc); } - + Attention(CodeType resultType, Set optionalOutputs, Value Q, Value K, Value V, java.util.Optional attn_mask, java.util.Optional past_key, java.util.Optional past_value, java.util.Optional nonpad_kv_seqlen, java.util.Optional qk_matmul_output_mode, java.util.Optional softcap, java.util.Optional softmax_precision, java.util.Optional scale, java.util.Optional is_causal, java.util.Optional q_num_heads, java.util.Optional kv_num_heads) { super(SCHEMA, resultType, optionalOutputs, List.of(Q, K, V, attn_mask, past_key, past_value, nonpad_kv_seqlen), List.of(qk_matmul_output_mode, softcap, softmax_precision, scale, is_causal, q_num_heads, kv_num_heads)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(Q(), K(), V(), attn_mask(), past_key(), past_value(), nonpad_kv_seqlen())); } - + public Value Q() { return operands().get(0); } - + public Value K() { return operands().get(1); } - + public Value V() { return operands().get(2); } - + public java.util.Optional attn_mask() { int i = optionalInputArguments.indexOf(InputParameter.attn_mask); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional past_key() { int i = optionalInputArguments.indexOf(InputParameter.past_key); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional past_value() { int i = optionalInputArguments.indexOf(InputParameter.past_value); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional nonpad_kv_seqlen() { int i = optionalInputArguments.indexOf(InputParameter.nonpad_kv_seqlen); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional qk_matmul_output_mode() { Long qk_matmul_output_mode = Attribute.qk_matmul_output_mode.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(qk_matmul_output_mode); } - + public java.util.Optional softcap() { Float softcap = Attribute.softcap.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(softcap); } - + public java.util.Optional softmax_precision() { Long softmax_precision = Attribute.softmax_precision.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(softmax_precision); } - + public java.util.Optional scale() { Float scale = Attribute.scale.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(scale); } - + public java.util.Optional is_causal() { Long is_causal = Attribute.is_causal.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(is_causal); } - + public java.util.Optional q_num_heads() { Long q_num_heads = Attribute.q_num_heads.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(q_num_heads); } - + public java.util.Optional kv_num_heads() { Long kv_num_heads = Attribute.kv_num_heads.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(kv_num_heads); } - + } - + public static Attention Attention(CodeType resultType, Set optionalOutputs, Value Q, Value K, Value V, java.util.Optional attn_mask, java.util.Optional past_key, java.util.Optional past_value, java.util.Optional nonpad_kv_seqlen, java.util.Optional qk_matmul_output_mode, java.util.Optional softcap, java.util.Optional softmax_precision, java.util.Optional scale, java.util.Optional is_causal, java.util.Optional q_num_heads, java.util.Optional kv_num_heads) { return new Attention(resultType, optionalOutputs, Q, K, V, attn_mask, past_key, past_value, nonpad_kv_seqlen, qk_matmul_output_mode, softcap, softmax_precision, scale, is_causal, q_num_heads, kv_num_heads); } @@ -2232,7 +2232,7 @@ public static Attention Attention(CodeType resultType, Set t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -2337,75 +2337,75 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public AveragePool(ExternalizedOp def) { super(SCHEMA, def); } - + AveragePool(AveragePool that, CodeContext cc) { super(that, cc); } - + @Override public AveragePool transform(CodeContext cc, CodeTransformer ot) { return new AveragePool(this, cc); } - + AveragePool(CodeType resultType, Value X, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional count_include_pad, java.util.Optional ceil_mode, java.util.Optional strides, long[] kernel_shape) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(pads, dilations, auto_pad, count_include_pad, ceil_mode, strides, kernel_shape)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional pads() { long[] pads = Attribute.pads.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(pads).map(long[]::clone); } - + public java.util.Optional dilations() { long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(dilations).map(long[]::clone); } - + public java.util.Optional auto_pad() { String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(auto_pad); } - + public java.util.Optional count_include_pad() { Long count_include_pad = Attribute.count_include_pad.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(count_include_pad); } - + public java.util.Optional ceil_mode() { Long ceil_mode = Attribute.ceil_mode.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(ceil_mode); } - + public java.util.Optional strides() { long[] strides = Attribute.strides.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(strides).map(long[]::clone); } - + public long[] kernel_shape() { long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes); return kernel_shape.clone(); } - + } - + public static AveragePool AveragePool(CodeType resultType, Value X, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional count_include_pad, java.util.Optional ceil_mode, java.util.Optional strides, long[] kernel_shape) { return new AveragePool(resultType, X, pads, dilations, auto_pad, count_include_pad, ceil_mode, strides, kernel_shape); } @@ -2413,56 +2413,56 @@ public static AveragePool AveragePool(CodeType resultType, Value X, java.util.Op @OpFactoryHelper.OpDeclaration(BatchNormalization.NAME) public static final class BatchNormalization extends OnnxOp { public static final String NAME = "BatchNormalization"; - + public enum Attribute implements OnnxAttribute { epsilon(Float.class, true, 1.0E-5f), training_mode(Long.class, true, 0), momentum(Float.class, true, 0.9f), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), scale(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), @@ -2470,51 +2470,51 @@ public enum InputParameter implements OnnxParameter { input_mean(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), input_var(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), running_mean(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), running_var(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -2522,71 +2522,71 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public BatchNormalization(ExternalizedOp def) { super(SCHEMA, def); } - + BatchNormalization(BatchNormalization that, CodeContext cc) { super(that, cc); } - + @Override public BatchNormalization transform(CodeContext cc, CodeTransformer ot) { return new BatchNormalization(this, cc); } - + BatchNormalization(CodeType resultType, Set optionalOutputs, Value X, Value scale, Value B, Value input_mean, Value input_var, java.util.Optional epsilon, java.util.Optional training_mode, java.util.Optional momentum) { super(SCHEMA, resultType, optionalOutputs, List.of(X, scale, B, input_mean, input_var), List.of(epsilon, training_mode, momentum)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), scale(), B(), input_mean(), input_var())); } - + public Value X() { return operands().get(0); } - + public Value scale() { return operands().get(1); } - + public Value B() { return operands().get(2); } - + public Value input_mean() { return operands().get(3); } - + public Value input_var() { return operands().get(4); } - + public java.util.Optional epsilon() { Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(epsilon); } - + public java.util.Optional training_mode() { Long training_mode = Attribute.training_mode.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(training_mode); } - + public java.util.Optional momentum() { Float momentum = Attribute.momentum.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(momentum); } - + } - + public static BatchNormalization BatchNormalization(CodeType resultType, Set optionalOutputs, Value X, Value scale, Value B, Value input_mean, Value input_var, java.util.Optional epsilon, java.util.Optional training_mode, java.util.Optional momentum) { return new BatchNormalization(resultType, optionalOutputs, X, scale, B, input_mean, input_var, epsilon, training_mode, momentum); } @@ -2594,100 +2594,100 @@ public static BatchNormalization BatchNormalization(CodeType resultType, Set t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -2695,50 +2695,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Bernoulli(ExternalizedOp def) { super(SCHEMA, def); } - + Bernoulli(Bernoulli that, CodeContext cc) { super(that, cc); } - + @Override public Bernoulli transform(CodeContext cc, CodeTransformer ot) { return new Bernoulli(this, cc); } - + Bernoulli(CodeType resultType, Value input, java.util.Optional seed, java.util.Optional dtype) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(seed, dtype)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional seed() { Float seed = Attribute.seed.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(seed); } - + public java.util.Optional dtype() { Long dtype = Attribute.dtype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(dtype); } - + } - + public static Bernoulli Bernoulli(CodeType resultType, Value input, java.util.Optional seed, java.util.Optional dtype) { return new Bernoulli(resultType, input, seed, dtype); } @@ -2746,98 +2746,98 @@ public static Bernoulli Bernoulli(CodeType resultType, Value input, java.util.Op @OpFactoryHelper.OpDeclaration(Binarizer.NAME) public static final class Binarizer extends OnnxOp { public static final String NAME = "Binarizer"; - + public enum Attribute implements OnnxAttribute { threshold(Float.class, true, 0.0f), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -2845,45 +2845,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Binarizer(ExternalizedOp def) { super(SCHEMA, def); } - + Binarizer(Binarizer that, CodeContext cc) { super(that, cc); } - + @Override public Binarizer transform(CodeContext cc, CodeTransformer ot) { return new Binarizer(this, cc); } - + Binarizer(CodeType resultType, Value X, java.util.Optional threshold) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(threshold)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional threshold() { Float threshold = Attribute.threshold.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(threshold); } - + } - + public static Binarizer Binarizer(CodeType resultType, Value X, java.util.Optional threshold) { return new Binarizer(resultType, X, threshold); } @@ -2891,99 +2891,99 @@ public static Binarizer Binarizer(CodeType resultType, Value X, java.util.Option @OpFactoryHelper.OpDeclaration(BitCast.NAME) public static final class BitCast extends OnnxOp { public static final String NAME = "BitCast"; - + public enum Attribute implements OnnxAttribute { to(Long.class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -2991,45 +2991,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public BitCast(ExternalizedOp def) { super(SCHEMA, def); } - + BitCast(BitCast that, CodeContext cc) { super(that, cc); } - + @Override public BitCast transform(CodeContext cc, CodeTransformer ot) { return new BitCast(this, cc); } - + BitCast(CodeType resultType, Value input, long to) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(to)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public long to() { long to = Attribute.to.access(Long.class, onnxAttributes); return to; } - + } - + public static BitCast BitCast(CodeType resultType, Value input, long to) { return new BitCast(resultType, input, to); } @@ -3037,99 +3037,99 @@ public static BitCast BitCast(CodeType resultType, Value input, long to) { @OpFactoryHelper.OpDeclaration(BitShift.NAME) public static final class BitShift extends OnnxOp { public static final String NAME = "BitShift"; - + public enum Attribute implements OnnxAttribute { direction(String.class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Z(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -3137,49 +3137,49 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public BitShift(ExternalizedOp def) { super(SCHEMA, def); } - + BitShift(BitShift that, CodeContext cc) { super(that, cc); } - + @Override public BitShift transform(CodeContext cc, CodeTransformer ot) { return new BitShift(this, cc); } - + BitShift(CodeType resultType, Value X, Value Y, String direction) { super(SCHEMA, resultType, Set.of(), List.of(X, Y), List.of(direction)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), Y())); } - + public Value X() { return operands().get(0); } - + public Value Y() { return operands().get(1); } - + public String direction() { String direction = Attribute.direction.access(String.class, onnxAttributes); return direction; } - + } - + public static BitShift BitShift(CodeType resultType, Value X, Value Y, String direction) { return new BitShift(resultType, X, Y, direction); } @@ -3187,73 +3187,73 @@ public static BitShift BitShift(CodeType resultType, Value X, Value Y, String di @OpFactoryHelper.OpDeclaration(BitwiseAnd.NAME) public static final class BitwiseAnd extends OnnxOp { public static final String NAME = "BitwiseAnd"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -3261,44 +3261,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public BitwiseAnd(ExternalizedOp def) { super(SCHEMA, def); } - + BitwiseAnd(BitwiseAnd that, CodeContext cc) { super(that, cc); } - + @Override public BitwiseAnd transform(CodeContext cc, CodeTransformer ot) { return new BitwiseAnd(this, cc); } - + BitwiseAnd(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static BitwiseAnd BitwiseAnd(CodeType resultType, Value A, Value B) { return new BitwiseAnd(resultType, A, B); } @@ -3306,72 +3306,72 @@ public static BitwiseAnd BitwiseAnd(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(BitwiseNot.NAME) public static final class BitwiseNot extends OnnxOp { public static final String NAME = "BitwiseNot"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -3379,40 +3379,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public BitwiseNot(ExternalizedOp def) { super(SCHEMA, def); } - + BitwiseNot(BitwiseNot that, CodeContext cc) { super(that, cc); } - + @Override public BitwiseNot transform(CodeContext cc, CodeTransformer ot) { return new BitwiseNot(this, cc); } - + BitwiseNot(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static BitwiseNot BitwiseNot(CodeType resultType, Value X) { return new BitwiseNot(resultType, X); } @@ -3420,73 +3420,73 @@ public static BitwiseNot BitwiseNot(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(BitwiseOr.NAME) public static final class BitwiseOr extends OnnxOp { public static final String NAME = "BitwiseOr"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -3494,44 +3494,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public BitwiseOr(ExternalizedOp def) { super(SCHEMA, def); } - + BitwiseOr(BitwiseOr that, CodeContext cc) { super(that, cc); } - + @Override public BitwiseOr transform(CodeContext cc, CodeTransformer ot) { return new BitwiseOr(this, cc); } - + BitwiseOr(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static BitwiseOr BitwiseOr(CodeType resultType, Value A, Value B) { return new BitwiseOr(resultType, A, B); } @@ -3539,73 +3539,73 @@ public static BitwiseOr BitwiseOr(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(BitwiseXor.NAME) public static final class BitwiseXor extends OnnxOp { public static final String NAME = "BitwiseXor"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -3613,44 +3613,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public BitwiseXor(ExternalizedOp def) { super(SCHEMA, def); } - + BitwiseXor(BitwiseXor that, CodeContext cc) { super(that, cc); } - + @Override public BitwiseXor transform(CodeContext cc, CodeTransformer ot) { return new BitwiseXor(this, cc); } - + BitwiseXor(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static BitwiseXor BitwiseXor(CodeType resultType, Value A, Value B) { return new BitwiseXor(resultType, A, B); } @@ -3658,100 +3658,100 @@ public static BitwiseXor BitwiseXor(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(BlackmanWindow.NAME) public static final class BlackmanWindow extends OnnxOp { public static final String NAME = "BlackmanWindow"; - + public enum Attribute implements OnnxAttribute { periodic(Long.class, true, 1), output_datatype(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { size(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -3759,50 +3759,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public BlackmanWindow(ExternalizedOp def) { super(SCHEMA, def); } - + BlackmanWindow(BlackmanWindow that, CodeContext cc) { super(that, cc); } - + @Override public BlackmanWindow transform(CodeContext cc, CodeTransformer ot) { return new BlackmanWindow(this, cc); } - + BlackmanWindow(CodeType resultType, Value size, java.util.Optional periodic, java.util.Optional output_datatype) { super(SCHEMA, resultType, Set.of(), List.of(size), List.of(periodic, output_datatype)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(size())); } - + public Value size() { return operands().get(0); } - + public java.util.Optional periodic() { Long periodic = Attribute.periodic.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(periodic); } - + public java.util.Optional output_datatype() { Long output_datatype = Attribute.output_datatype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(output_datatype); } - + } - + public static BlackmanWindow BlackmanWindow(CodeType resultType, Value size, java.util.Optional periodic, java.util.Optional output_datatype) { return new BlackmanWindow(resultType, size, periodic, output_datatype); } @@ -3810,101 +3810,101 @@ public static BlackmanWindow BlackmanWindow(CodeType resultType, Value size, jav @OpFactoryHelper.OpDeclaration(Cast.NAME) public static final class Cast extends OnnxOp { public static final String NAME = "Cast"; - + public enum Attribute implements OnnxAttribute { saturate(Long.class, true, 1), to(Long.class, false, null), round_mode(String.class, true, "up"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -3912,55 +3912,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Cast(ExternalizedOp def) { super(SCHEMA, def); } - + Cast(Cast that, CodeContext cc) { super(that, cc); } - + @Override public Cast transform(CodeContext cc, CodeTransformer ot) { return new Cast(this, cc); } - + Cast(CodeType resultType, Value input, java.util.Optional saturate, long to, java.util.Optional round_mode) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(saturate, to, round_mode)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional saturate() { Long saturate = Attribute.saturate.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(saturate); } - + public long to() { long to = Attribute.to.access(Long.class, onnxAttributes); return to; } - + public java.util.Optional round_mode() { String round_mode = Attribute.round_mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(round_mode); } - + } - + public static Cast Cast(CodeType resultType, Value input, java.util.Optional saturate, long to, java.util.Optional round_mode) { return new Cast(resultType, input, saturate, to, round_mode); } @@ -3968,101 +3968,101 @@ public static Cast Cast(CodeType resultType, Value input, java.util.Optional t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), target_type(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -4070,54 +4070,54 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public CastLike(ExternalizedOp def) { super(SCHEMA, def); } - + CastLike(CastLike that, CodeContext cc) { super(that, cc); } - + @Override public CastLike transform(CodeContext cc, CodeTransformer ot) { return new CastLike(this, cc); } - + CastLike(CodeType resultType, Value input, Value target_type, java.util.Optional saturate, java.util.Optional round_mode) { super(SCHEMA, resultType, Set.of(), List.of(input, target_type), List.of(saturate, round_mode)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), target_type())); } - + public Value input() { return operands().get(0); } - + public Value target_type() { return operands().get(1); } - + public java.util.Optional saturate() { Long saturate = Attribute.saturate.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(saturate); } - + public java.util.Optional round_mode() { String round_mode = Attribute.round_mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(round_mode); } - + } - + public static CastLike CastLike(CodeType resultType, Value input, Value target_type, java.util.Optional saturate, java.util.Optional round_mode) { return new CastLike(resultType, input, target_type, saturate, round_mode); } @@ -4125,101 +4125,101 @@ public static CastLike CastLike(CodeType resultType, Value input, Value target_t @OpFactoryHelper.OpDeclaration(CastMap.NAME) public static final class CastMap extends OnnxOp { public static final String NAME = "CastMap"; - + public enum Attribute implements OnnxAttribute { map_form(String.class, true, "DENSE"), cast_to(String.class, true, "TO_FLOAT"), max_map(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.map(OnnxType.int64(), OnnxType.string()), OnnxType.map(OnnxType.int64(), OnnxType.float32())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -4227,55 +4227,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public CastMap(ExternalizedOp def) { super(SCHEMA, def); } - + CastMap(CastMap that, CodeContext cc) { super(that, cc); } - + @Override public CastMap transform(CodeContext cc, CodeTransformer ot) { return new CastMap(this, cc); } - + CastMap(CodeType resultType, Value X, java.util.Optional map_form, java.util.Optional cast_to, java.util.Optional max_map) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(map_form, cast_to, max_map)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional map_form() { String map_form = Attribute.map_form.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(map_form); } - + public java.util.Optional cast_to() { String cast_to = Attribute.cast_to.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(cast_to); } - + public java.util.Optional max_map() { Long max_map = Attribute.max_map.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(max_map); } - + } - + public static CastMap CastMap(CodeType resultType, Value X, java.util.Optional map_form, java.util.Optional cast_to, java.util.Optional max_map) { return new CastMap(resultType, X, map_form, cast_to, max_map); } @@ -4283,102 +4283,102 @@ public static CastMap CastMap(CodeType resultType, Value X, java.util.Optional t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -4386,60 +4386,60 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public CategoryMapper(ExternalizedOp def) { super(SCHEMA, def); } - + CategoryMapper(CategoryMapper that, CodeContext cc) { super(that, cc); } - + @Override public CategoryMapper transform(CodeContext cc, CodeTransformer ot) { return new CategoryMapper(this, cc); } - + CategoryMapper(CodeType resultType, Value X, java.util.Optional cats_int64s, java.util.Optional cats_strings, java.util.Optional default_int64, java.util.Optional default_string) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(cats_int64s, cats_strings, default_int64, default_string)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional cats_int64s() { long[] cats_int64s = Attribute.cats_int64s.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(cats_int64s).map(long[]::clone); } - + public java.util.Optional cats_strings() { String[] cats_strings = Attribute.cats_strings.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(cats_strings).map(String[]::clone); } - + public java.util.Optional default_int64() { Long default_int64 = Attribute.default_int64.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(default_int64); } - + public java.util.Optional default_string() { String default_string = Attribute.default_string.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(default_string); } - + } - + public static CategoryMapper CategoryMapper(CodeType resultType, Value X, java.util.Optional cats_int64s, java.util.Optional cats_strings, java.util.Optional default_int64, java.util.Optional default_string) { return new CategoryMapper(resultType, X, cats_int64s, cats_strings, default_int64, default_string); } @@ -4447,102 +4447,102 @@ public static CategoryMapper CategoryMapper(CodeType resultType, Value X, java.u @OpFactoryHelper.OpDeclaration(CausalConvWithState.NAME) public static final class CausalConvWithState extends OnnxOp { public static final String NAME = "CausalConvWithState"; - + public enum Attribute implements OnnxAttribute { activation(String.class, true, "none"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), weight(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), bias(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), past_state(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), present_state(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -4550,59 +4550,59 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public CausalConvWithState(ExternalizedOp def) { super(SCHEMA, def); } - + CausalConvWithState(CausalConvWithState that, CodeContext cc) { super(that, cc); } - + @Override public CausalConvWithState transform(CodeContext cc, CodeTransformer ot) { return new CausalConvWithState(this, cc); } - + CausalConvWithState(CodeType resultType, Value input, Value weight, java.util.Optional bias, java.util.Optional past_state, java.util.Optional activation) { super(SCHEMA, resultType, Set.of(), List.of(input, weight, bias, past_state), List.of(activation)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), weight(), bias(), past_state())); } - + public Value input() { return operands().get(0); } - + public Value weight() { return operands().get(1); } - + public java.util.Optional bias() { int i = optionalInputArguments.indexOf(InputParameter.bias); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional past_state() { int i = optionalInputArguments.indexOf(InputParameter.past_state); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional activation() { String activation = Attribute.activation.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(activation); } - + } - + public static CausalConvWithState CausalConvWithState(CodeType resultType, Value input, Value weight, java.util.Optional bias, java.util.Optional past_state, java.util.Optional activation) { return new CausalConvWithState(resultType, input, weight, bias, past_state, activation); } @@ -4610,72 +4610,72 @@ public static CausalConvWithState CausalConvWithState(CodeType resultType, Value @OpFactoryHelper.OpDeclaration(Ceil.NAME) public static final class Ceil extends OnnxOp { public static final String NAME = "Ceil"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -4683,40 +4683,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Ceil(ExternalizedOp def) { super(SCHEMA, def); } - + Ceil(Ceil that, CodeContext cc) { super(that, cc); } - + @Override public Ceil transform(CodeContext cc, CodeTransformer ot) { return new Ceil(this, cc); } - + Ceil(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Ceil Ceil(CodeType resultType, Value X) { return new Ceil(resultType, X); } @@ -4724,98 +4724,98 @@ public static Ceil Ceil(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(Celu.NAME) public static final class Celu extends OnnxOp { public static final String NAME = "Celu"; - + public enum Attribute implements OnnxAttribute { alpha(Float.class, true, 1.0f), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -4823,45 +4823,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Celu(ExternalizedOp def) { super(SCHEMA, def); } - + Celu(Celu that, CodeContext cc) { super(that, cc); } - + @Override public Celu transform(CodeContext cc, CodeTransformer ot) { return new Celu(this, cc); } - + Celu(CodeType resultType, Value X, java.util.Optional alpha) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional alpha() { Float alpha = Attribute.alpha.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(alpha); } - + } - + public static Celu Celu(CodeType resultType, Value X, java.util.Optional alpha) { return new Celu(resultType, X, alpha); } @@ -4869,100 +4869,100 @@ public static Celu Celu(CodeType resultType, Value X, java.util.Optional @OpFactoryHelper.OpDeclaration(CenterCropPad.NAME) public static final class CenterCropPad extends OnnxOp { public static final String NAME = "CenterCropPad"; - + public enum Attribute implements OnnxAttribute { axes(long[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input_data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), shape(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output_data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -4970,49 +4970,49 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public CenterCropPad(ExternalizedOp def) { super(SCHEMA, def); } - + CenterCropPad(CenterCropPad that, CodeContext cc) { super(that, cc); } - + @Override public CenterCropPad transform(CodeContext cc, CodeTransformer ot) { return new CenterCropPad(this, cc); } - + CenterCropPad(CodeType resultType, Value input_data, Value shape, java.util.Optional axes) { super(SCHEMA, resultType, Set.of(), List.of(input_data, shape), List.of(axes)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input_data(), shape())); } - + public Value input_data() { return operands().get(0); } - + public Value shape() { return operands().get(1); } - + public java.util.Optional axes() { long[] axes = Attribute.axes.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(axes).map(long[]::clone); } - + } - + public static CenterCropPad CenterCropPad(CodeType resultType, Value input_data, Value shape, java.util.Optional axes) { return new CenterCropPad(resultType, input_data, shape, axes); } @@ -5020,74 +5020,74 @@ public static CenterCropPad CenterCropPad(CodeType resultType, Value input_data, @OpFactoryHelper.OpDeclaration(Clip.NAME) public static final class Clip extends OnnxOp { public static final String NAME = "Clip"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), min(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), max(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -5095,50 +5095,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Clip(ExternalizedOp def) { super(SCHEMA, def); } - + Clip(Clip that, CodeContext cc) { super(that, cc); } - + @Override public Clip transform(CodeContext cc, CodeTransformer ot) { return new Clip(this, cc); } - + Clip(CodeType resultType, Value input, java.util.Optional min, java.util.Optional max) { super(SCHEMA, resultType, Set.of(), List.of(input, min, max), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), min(), max())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional min() { int i = optionalInputArguments.indexOf(InputParameter.min); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional max() { int i = optionalInputArguments.indexOf(InputParameter.max); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + } - + public static Clip Clip(CodeType resultType, Value input, java.util.Optional min, java.util.Optional max) { return new Clip(resultType, input, min, max); } @@ -5146,102 +5146,102 @@ public static Clip Clip(CodeType resultType, Value input, java.util.Optional t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), image_shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), block_shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -5249,63 +5249,63 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Col2Im(ExternalizedOp def) { super(SCHEMA, def); } - + Col2Im(Col2Im that, CodeContext cc) { super(that, cc); } - + @Override public Col2Im transform(CodeContext cc, CodeTransformer ot) { return new Col2Im(this, cc); } - + Col2Im(CodeType resultType, Value input, Value image_shape, Value block_shape, java.util.Optional pads, java.util.Optional dilations, java.util.Optional strides) { super(SCHEMA, resultType, Set.of(), List.of(input, image_shape, block_shape), List.of(pads, dilations, strides)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), image_shape(), block_shape())); } - + public Value input() { return operands().get(0); } - + public Value image_shape() { return operands().get(1); } - + public Value block_shape() { return operands().get(2); } - + public java.util.Optional pads() { long[] pads = Attribute.pads.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(pads).map(long[]::clone); } - + public java.util.Optional dilations() { long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(dilations).map(long[]::clone); } - + public java.util.Optional strides() { long[] strides = Attribute.strides.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(strides).map(long[]::clone); } - + } - + public static Col2Im Col2Im(CodeType resultType, Value input, Value image_shape, Value block_shape, java.util.Optional pads, java.util.Optional dilations, java.util.Optional strides) { return new Col2Im(resultType, input, image_shape, block_shape, pads, dilations, strides); } @@ -5313,100 +5313,100 @@ public static Col2Im Col2Im(CodeType resultType, Value input, Value image_shape, @OpFactoryHelper.OpDeclaration(Compress.NAME) public static final class Compress extends OnnxOp { public static final String NAME = "Compress"; - + public enum Attribute implements OnnxAttribute { axis(Long.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), condition(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -5414,49 +5414,49 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Compress(ExternalizedOp def) { super(SCHEMA, def); } - + Compress(Compress that, CodeContext cc) { super(that, cc); } - + @Override public Compress transform(CodeContext cc, CodeTransformer ot) { return new Compress(this, cc); } - + Compress(CodeType resultType, Value input, Value condition, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(input, condition), List.of(axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), condition())); } - + public Value input() { return operands().get(0); } - + public Value condition() { return operands().get(1); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static Compress Compress(CodeType resultType, Value input, Value condition, java.util.Optional axis) { return new Compress(resultType, input, condition, axis); } @@ -5464,98 +5464,98 @@ public static Compress Compress(CodeType resultType, Value input, Value conditio @OpFactoryHelper.OpDeclaration(Concat.NAME) public static final class Concat extends OnnxOp { public static final String NAME = "Concat"; - + public enum Attribute implements OnnxAttribute { axis(Long.class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { inputs(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { concat_result(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -5563,45 +5563,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Concat(ExternalizedOp def) { super(SCHEMA, def); } - + Concat(Concat that, CodeContext cc) { super(that, cc); } - + @Override public Concat transform(CodeContext cc, CodeTransformer ot) { return new Concat(this, cc); } - + Concat(CodeType resultType, List inputs, long axis) { super(SCHEMA, resultType, Set.of(), List.of(inputs), List.of(axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(inputs())); } - + public List inputs() { return operands(); } - + public long axis() { long axis = Attribute.axis.access(Long.class, onnxAttributes); return axis; } - + } - + public static Concat Concat(CodeType resultType, List inputs, long axis) { return new Concat(resultType, inputs, axis); } @@ -5609,100 +5609,100 @@ public static Concat Concat(CodeType resultType, List inputs, long axis) @OpFactoryHelper.OpDeclaration(ConcatFromSequence.NAME) public static final class ConcatFromSequence extends OnnxOp { public static final String NAME = "ConcatFromSequence"; - + public enum Attribute implements OnnxAttribute { axis(Long.class, false, null), new_axis(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { concat_result(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -5710,50 +5710,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ConcatFromSequence(ExternalizedOp def) { super(SCHEMA, def); } - + ConcatFromSequence(ConcatFromSequence that, CodeContext cc) { super(that, cc); } - + @Override public ConcatFromSequence transform(CodeContext cc, CodeTransformer ot) { return new ConcatFromSequence(this, cc); } - + ConcatFromSequence(CodeType resultType, Value input_sequence, long axis, java.util.Optional new_axis) { super(SCHEMA, resultType, Set.of(), List.of(input_sequence), List.of(axis, new_axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input_sequence())); } - + public Value input_sequence() { return operands().get(0); } - + public long axis() { long axis = Attribute.axis.access(Long.class, onnxAttributes); return axis; } - + public java.util.Optional new_axis() { Long new_axis = Attribute.new_axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(new_axis); } - + } - + public static ConcatFromSequence ConcatFromSequence(CodeType resultType, Value input_sequence, long axis, java.util.Optional new_axis) { return new ConcatFromSequence(resultType, input_sequence, axis, new_axis); } @@ -5761,7 +5761,7 @@ public static ConcatFromSequence ConcatFromSequence(CodeType resultType, Value i @OpFactoryHelper.OpDeclaration(Constant.NAME) public static final class Constant extends OnnxOp { public static final String NAME = "Constant"; - + public enum Attribute implements OnnxAttribute { value_int(Long.class, true, null), value_floats(float[].class, true, null), @@ -5772,73 +5772,73 @@ public enum Attribute implements OnnxAttribute { sparse_value(byte[].class, true, null), value(Tensor.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter.None { } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -5846,76 +5846,76 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Constant(ExternalizedOp def) { super(SCHEMA, def); } - + Constant(Constant that, CodeContext cc) { super(that, cc); } - + @Override public Constant transform(CodeContext cc, CodeTransformer ot) { return new Constant(this, cc); } - + Constant(CodeType resultType, java.util.Optional value_int, java.util.Optional value_floats, java.util.Optional value_strings, java.util.Optional value_float, java.util.Optional value_string, java.util.Optional value_ints, java.util.Optional sparse_value, java.util.Optional value) { super(SCHEMA, resultType, Set.of(), List.of(), List.of(value_int, value_floats, value_strings, value_float, value_string, value_ints, sparse_value, value)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of()); } - + public java.util.Optional value_int() { Long value_int = Attribute.value_int.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(value_int); } - + public java.util.Optional value_floats() { float[] value_floats = Attribute.value_floats.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(value_floats).map(float[]::clone); } - + public java.util.Optional value_strings() { String[] value_strings = Attribute.value_strings.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(value_strings).map(String[]::clone); } - + public java.util.Optional value_float() { Float value_float = Attribute.value_float.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(value_float); } - + public java.util.Optional value_string() { String value_string = Attribute.value_string.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(value_string); } - + public java.util.Optional value_ints() { long[] value_ints = Attribute.value_ints.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(value_ints).map(long[]::clone); } - + public java.util.Optional sparse_value() { byte[] sparse_value = Attribute.sparse_value.access(byte[].class, onnxAttributes); return java.util.Optional.ofNullable(sparse_value).map(byte[]::clone); } - + public java.util.Optional value() { Tensor value = Attribute.value.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(value); } - + } - + public static Constant Constant(CodeType resultType, java.util.Optional value_int, java.util.Optional value_floats, java.util.Optional value_strings, java.util.Optional value_float, java.util.Optional value_string, java.util.Optional value_ints, java.util.Optional sparse_value, java.util.Optional value) { return new Constant(resultType, value_int, value_floats, value_strings, value_float, value_string, value_ints, sparse_value, value); } @@ -5923,99 +5923,99 @@ public static Constant Constant(CodeType resultType, java.util.Optional va @OpFactoryHelper.OpDeclaration(ConstantOfShape.NAME) public static final class ConstantOfShape extends OnnxOp { public static final String NAME = "ConstantOfShape"; - + public enum Attribute implements OnnxAttribute { value(Tensor.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -6023,45 +6023,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ConstantOfShape(ExternalizedOp def) { super(SCHEMA, def); } - + ConstantOfShape(ConstantOfShape that, CodeContext cc) { super(that, cc); } - + @Override public ConstantOfShape transform(CodeContext cc, CodeTransformer ot) { return new ConstantOfShape(this, cc); } - + ConstantOfShape(CodeType resultType, Value input, java.util.Optional value) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(value)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional value() { Tensor value = Attribute.value.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(value); } - + } - + public static ConstantOfShape ConstantOfShape(CodeType resultType, Value input, java.util.Optional value) { return new ConstantOfShape(resultType, input, value); } @@ -6069,7 +6069,7 @@ public static ConstantOfShape ConstantOfShape(CodeType resultType, Value input, @OpFactoryHelper.OpDeclaration(Conv.NAME) public static final class Conv extends OnnxOp { public static final String NAME = "Conv"; - + public enum Attribute implements OnnxAttribute { pads(long[].class, true, null), dilations(long[].class, true, null), @@ -6078,96 +6078,96 @@ public enum Attribute implements OnnxAttribute { group(Long.class, true, 1), kernel_shape(long[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -6175,79 +6175,79 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Conv(ExternalizedOp def) { super(SCHEMA, def); } - + Conv(Conv that, CodeContext cc) { super(that, cc); } - + @Override public Conv transform(CodeContext cc, CodeTransformer ot) { return new Conv(this, cc); } - + Conv(CodeType resultType, Value X, Value W, java.util.Optional B, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional strides, java.util.Optional group, java.util.Optional kernel_shape) { super(SCHEMA, resultType, Set.of(), List.of(X, W, B), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), W(), B())); } - + public Value X() { return operands().get(0); } - + public Value W() { return operands().get(1); } - + public java.util.Optional B() { int i = optionalInputArguments.indexOf(InputParameter.B); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional pads() { long[] pads = Attribute.pads.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(pads).map(long[]::clone); } - + public java.util.Optional dilations() { long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(dilations).map(long[]::clone); } - + public java.util.Optional auto_pad() { String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(auto_pad); } - + public java.util.Optional strides() { long[] strides = Attribute.strides.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(strides).map(long[]::clone); } - + public java.util.Optional group() { Long group = Attribute.group.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(group); } - + public java.util.Optional kernel_shape() { long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(kernel_shape).map(long[]::clone); } - + } - + public static Conv Conv(CodeType resultType, Value X, Value W, java.util.Optional B, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional strides, java.util.Optional group, java.util.Optional kernel_shape) { return new Conv(resultType, X, W, B, pads, dilations, auto_pad, strides, group, kernel_shape); } @@ -6255,7 +6255,7 @@ public static Conv Conv(CodeType resultType, Value X, Value W, java.util.Optiona @OpFactoryHelper.OpDeclaration(ConvInteger.NAME) public static final class ConvInteger extends OnnxOp { public static final String NAME = "ConvInteger"; - + public enum Attribute implements OnnxAttribute { pads(long[].class, true, null), dilations(long[].class, true, null), @@ -6264,99 +6264,99 @@ public enum Attribute implements OnnxAttribute { group(Long.class, true, 1), kernel_shape(long[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { x(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), w(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), x_zero_point(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL), w_zero_point(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -6364,84 +6364,84 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ConvInteger(ExternalizedOp def) { super(SCHEMA, def); } - + ConvInteger(ConvInteger that, CodeContext cc) { super(that, cc); } - + @Override public ConvInteger transform(CodeContext cc, CodeTransformer ot) { return new ConvInteger(this, cc); } - + ConvInteger(CodeType resultType, Value x, Value w, java.util.Optional x_zero_point, java.util.Optional w_zero_point, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional strides, java.util.Optional group, java.util.Optional kernel_shape) { super(SCHEMA, resultType, Set.of(), List.of(x, w, x_zero_point, w_zero_point), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(x(), w(), x_zero_point(), w_zero_point())); } - + public Value x() { return operands().get(0); } - + public Value w() { return operands().get(1); } - + public java.util.Optional x_zero_point() { int i = optionalInputArguments.indexOf(InputParameter.x_zero_point); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional w_zero_point() { int i = optionalInputArguments.indexOf(InputParameter.w_zero_point); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional pads() { long[] pads = Attribute.pads.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(pads).map(long[]::clone); } - + public java.util.Optional dilations() { long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(dilations).map(long[]::clone); } - + public java.util.Optional auto_pad() { String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(auto_pad); } - + public java.util.Optional strides() { long[] strides = Attribute.strides.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(strides).map(long[]::clone); } - + public java.util.Optional group() { Long group = Attribute.group.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(group); } - + public java.util.Optional kernel_shape() { long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(kernel_shape).map(long[]::clone); } - + } - + public static ConvInteger ConvInteger(CodeType resultType, Value x, Value w, java.util.Optional x_zero_point, java.util.Optional w_zero_point, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional strides, java.util.Optional group, java.util.Optional kernel_shape) { return new ConvInteger(resultType, x, w, x_zero_point, w_zero_point, pads, dilations, auto_pad, strides, group, kernel_shape); } @@ -6449,7 +6449,7 @@ public static ConvInteger ConvInteger(CodeType resultType, Value x, Value w, jav @OpFactoryHelper.OpDeclaration(ConvTranspose.NAME) public static final class ConvTranspose extends OnnxOp { public static final String NAME = "ConvTranspose"; - + public enum Attribute implements OnnxAttribute { output_shape(long[].class, true, null), pads(long[].class, true, null), @@ -6460,96 +6460,96 @@ public enum Attribute implements OnnxAttribute { kernel_shape(long[].class, true, null), output_padding(long[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -6557,89 +6557,89 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ConvTranspose(ExternalizedOp def) { super(SCHEMA, def); } - + ConvTranspose(ConvTranspose that, CodeContext cc) { super(that, cc); } - + @Override public ConvTranspose transform(CodeContext cc, CodeTransformer ot) { return new ConvTranspose(this, cc); } - + ConvTranspose(CodeType resultType, Value X, Value W, java.util.Optional B, java.util.Optional output_shape, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional strides, java.util.Optional group, java.util.Optional kernel_shape, java.util.Optional output_padding) { super(SCHEMA, resultType, Set.of(), List.of(X, W, B), List.of(output_shape, pads, dilations, auto_pad, strides, group, kernel_shape, output_padding)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), W(), B())); } - + public Value X() { return operands().get(0); } - + public Value W() { return operands().get(1); } - + public java.util.Optional B() { int i = optionalInputArguments.indexOf(InputParameter.B); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional output_shape() { long[] output_shape = Attribute.output_shape.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(output_shape).map(long[]::clone); } - + public java.util.Optional pads() { long[] pads = Attribute.pads.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(pads).map(long[]::clone); } - + public java.util.Optional dilations() { long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(dilations).map(long[]::clone); } - + public java.util.Optional auto_pad() { String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(auto_pad); } - + public java.util.Optional strides() { long[] strides = Attribute.strides.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(strides).map(long[]::clone); } - + public java.util.Optional group() { Long group = Attribute.group.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(group); } - + public java.util.Optional kernel_shape() { long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(kernel_shape).map(long[]::clone); } - + public java.util.Optional output_padding() { long[] output_padding = Attribute.output_padding.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(output_padding).map(long[]::clone); } - + } - + public static ConvTranspose ConvTranspose(CodeType resultType, Value X, Value W, java.util.Optional B, java.util.Optional output_shape, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional strides, java.util.Optional group, java.util.Optional kernel_shape, java.util.Optional output_padding) { return new ConvTranspose(resultType, X, W, B, output_shape, pads, dilations, auto_pad, strides, group, kernel_shape, output_padding); } @@ -6647,72 +6647,72 @@ public static ConvTranspose ConvTranspose(CodeType resultType, Value X, Value W, @OpFactoryHelper.OpDeclaration(Cos.NAME) public static final class Cos extends OnnxOp { public static final String NAME = "Cos"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -6720,40 +6720,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Cos(ExternalizedOp def) { super(SCHEMA, def); } - + Cos(Cos that, CodeContext cc) { super(that, cc); } - + @Override public Cos transform(CodeContext cc, CodeTransformer ot) { return new Cos(this, cc); } - + Cos(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Cos Cos(CodeType resultType, Value input) { return new Cos(resultType, input); } @@ -6761,72 +6761,72 @@ public static Cos Cos(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Cosh.NAME) public static final class Cosh extends OnnxOp { public static final String NAME = "Cosh"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -6834,40 +6834,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Cosh(ExternalizedOp def) { super(SCHEMA, def); } - + Cosh(Cosh that, CodeContext cc) { super(that, cc); } - + @Override public Cosh transform(CodeContext cc, CodeTransformer ot) { return new Cosh(this, cc); } - + Cosh(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Cosh Cosh(CodeType resultType, Value input) { return new Cosh(resultType, input); } @@ -6875,101 +6875,101 @@ public static Cosh Cosh(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(CumProd.NAME) public static final class CumProd extends OnnxOp { public static final String NAME = "CumProd"; - + public enum Attribute implements OnnxAttribute { exclusive(Long.class, true, 0), reverse(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { x(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axis(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -6977,54 +6977,54 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public CumProd(ExternalizedOp def) { super(SCHEMA, def); } - + CumProd(CumProd that, CodeContext cc) { super(that, cc); } - + @Override public CumProd transform(CodeContext cc, CodeTransformer ot) { return new CumProd(this, cc); } - + CumProd(CodeType resultType, Value x, Value axis, java.util.Optional exclusive, java.util.Optional reverse) { super(SCHEMA, resultType, Set.of(), List.of(x, axis), List.of(exclusive, reverse)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(x(), axis())); } - + public Value x() { return operands().get(0); } - + public Value axis() { return operands().get(1); } - + public java.util.Optional exclusive() { Long exclusive = Attribute.exclusive.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(exclusive); } - + public java.util.Optional reverse() { Long reverse = Attribute.reverse.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(reverse); } - + } - + public static CumProd CumProd(CodeType resultType, Value x, Value axis, java.util.Optional exclusive, java.util.Optional reverse) { return new CumProd(resultType, x, axis, exclusive, reverse); } @@ -7032,101 +7032,101 @@ public static CumProd CumProd(CodeType resultType, Value x, Value axis, java.uti @OpFactoryHelper.OpDeclaration(CumSum.NAME) public static final class CumSum extends OnnxOp { public static final String NAME = "CumSum"; - + public enum Attribute implements OnnxAttribute { exclusive(Long.class, true, 0), reverse(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { x(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axis(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -7134,54 +7134,54 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public CumSum(ExternalizedOp def) { super(SCHEMA, def); } - + CumSum(CumSum that, CodeContext cc) { super(that, cc); } - + @Override public CumSum transform(CodeContext cc, CodeTransformer ot) { return new CumSum(this, cc); } - + CumSum(CodeType resultType, Value x, Value axis, java.util.Optional exclusive, java.util.Optional reverse) { super(SCHEMA, resultType, Set.of(), List.of(x, axis), List.of(exclusive, reverse)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(x(), axis())); } - + public Value x() { return operands().get(0); } - + public Value axis() { return operands().get(1); } - + public java.util.Optional exclusive() { Long exclusive = Attribute.exclusive.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(exclusive); } - + public java.util.Optional reverse() { Long reverse = Attribute.reverse.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(reverse); } - + } - + public static CumSum CumSum(CodeType resultType, Value x, Value axis, java.util.Optional exclusive, java.util.Optional reverse) { return new CumSum(resultType, x, axis, exclusive, reverse); } @@ -7189,102 +7189,102 @@ public static CumSum CumSum(CodeType resultType, Value x, Value axis, java.util. @OpFactoryHelper.OpDeclaration(DFT.NAME) public static final class DFT extends OnnxOp { public static final String NAME = "DFT"; - + public enum Attribute implements OnnxAttribute { inverse(Long.class, true, 0), onesided(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), dft_length(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), axis(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -7292,60 +7292,60 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public DFT(ExternalizedOp def) { super(SCHEMA, def); } - + DFT(DFT that, CodeContext cc) { super(that, cc); } - + @Override public DFT transform(CodeContext cc, CodeTransformer ot) { return new DFT(this, cc); } - + DFT(CodeType resultType, Value input, java.util.Optional dft_length, java.util.Optional axis, java.util.Optional inverse, java.util.Optional onesided) { super(SCHEMA, resultType, Set.of(), List.of(input, dft_length, axis), List.of(inverse, onesided)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), dft_length(), axis())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional dft_length() { int i = optionalInputArguments.indexOf(InputParameter.dft_length); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional axis() { int i = optionalInputArguments.indexOf(InputParameter.axis); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional inverse() { Long inverse = Attribute.inverse.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(inverse); } - + public java.util.Optional onesided() { Long onesided = Attribute.onesided.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(onesided); } - + } - + public static DFT DFT(CodeType resultType, Value input, java.util.Optional dft_length, java.util.Optional axis, java.util.Optional inverse, java.util.Optional onesided) { return new DFT(resultType, input, dft_length, axis, inverse, onesided); } @@ -7353,7 +7353,7 @@ public static DFT DFT(CodeType resultType, Value input, java.util.Optional t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), @@ -7411,49 +7411,49 @@ public enum InputParameter implements OnnxParameter { B(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), mask(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -7461,88 +7461,88 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public DeformConv(ExternalizedOp def) { super(SCHEMA, def); } - + DeformConv(DeformConv that, CodeContext cc) { super(that, cc); } - + @Override public DeformConv transform(CodeContext cc, CodeTransformer ot) { return new DeformConv(this, cc); } - + DeformConv(CodeType resultType, Value X, Value W, Value offset, java.util.Optional B, java.util.Optional mask, java.util.Optional pads, java.util.Optional dilations, java.util.Optional strides, java.util.Optional offset_group, java.util.Optional group, java.util.Optional kernel_shape) { super(SCHEMA, resultType, Set.of(), List.of(X, W, offset, B, mask), List.of(pads, dilations, strides, offset_group, group, kernel_shape)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), W(), offset(), B(), mask())); } - + public Value X() { return operands().get(0); } - + public Value W() { return operands().get(1); } - + public Value offset() { return operands().get(2); } - + public java.util.Optional B() { int i = optionalInputArguments.indexOf(InputParameter.B); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional mask() { int i = optionalInputArguments.indexOf(InputParameter.mask); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional pads() { long[] pads = Attribute.pads.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(pads).map(long[]::clone); } - + public java.util.Optional dilations() { long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(dilations).map(long[]::clone); } - + public java.util.Optional strides() { long[] strides = Attribute.strides.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(strides).map(long[]::clone); } - + public java.util.Optional offset_group() { Long offset_group = Attribute.offset_group.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(offset_group); } - + public java.util.Optional group() { Long group = Attribute.group.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(group); } - + public java.util.Optional kernel_shape() { long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(kernel_shape).map(long[]::clone); } - + } - + public static DeformConv DeformConv(CodeType resultType, Value X, Value W, Value offset, java.util.Optional B, java.util.Optional mask, java.util.Optional pads, java.util.Optional dilations, java.util.Optional strides, java.util.Optional offset_group, java.util.Optional group, java.util.Optional kernel_shape) { return new DeformConv(resultType, X, W, offset, B, mask, pads, dilations, strides, offset_group, group, kernel_shape); } @@ -7550,99 +7550,99 @@ public static DeformConv DeformConv(CodeType resultType, Value X, Value W, Value @OpFactoryHelper.OpDeclaration(DepthToSpace.NAME) public static final class DepthToSpace extends OnnxOp { public static final String NAME = "DepthToSpace"; - + public enum Attribute implements OnnxAttribute { mode(String.class, true, "DCR"), blocksize(Long.class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -7650,50 +7650,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public DepthToSpace(ExternalizedOp def) { super(SCHEMA, def); } - + DepthToSpace(DepthToSpace that, CodeContext cc) { super(that, cc); } - + @Override public DepthToSpace transform(CodeContext cc, CodeTransformer ot) { return new DepthToSpace(this, cc); } - + DepthToSpace(CodeType resultType, Value input, java.util.Optional mode, long blocksize) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(mode, blocksize)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional mode() { String mode = Attribute.mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(mode); } - + public long blocksize() { long blocksize = Attribute.blocksize.access(Long.class, onnxAttributes); return blocksize; } - + } - + public static DepthToSpace DepthToSpace(CodeType resultType, Value input, java.util.Optional mode, long blocksize) { return new DepthToSpace(resultType, input, mode, blocksize); } @@ -7701,104 +7701,104 @@ public static DepthToSpace DepthToSpace(CodeType resultType, Value input, java.u @OpFactoryHelper.OpDeclaration(DequantizeLinear.NAME) public static final class DequantizeLinear extends OnnxOp { public static final String NAME = "DequantizeLinear"; - + public enum Attribute implements OnnxAttribute { output_dtype(Long.class, true, 0), axis(Long.class, true, 1), block_size(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float8e8m0())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { x(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), x_scale(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), x_zero_point(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -7806,64 +7806,64 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public DequantizeLinear(ExternalizedOp def) { super(SCHEMA, def); } - + DequantizeLinear(DequantizeLinear that, CodeContext cc) { super(that, cc); } - + @Override public DequantizeLinear transform(CodeContext cc, CodeTransformer ot) { return new DequantizeLinear(this, cc); } - + DequantizeLinear(CodeType resultType, Value x, Value x_scale, java.util.Optional x_zero_point, java.util.Optional output_dtype, java.util.Optional axis, java.util.Optional block_size) { super(SCHEMA, resultType, Set.of(), List.of(x, x_scale, x_zero_point), List.of(output_dtype, axis, block_size)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(x(), x_scale(), x_zero_point())); } - + public Value x() { return operands().get(0); } - + public Value x_scale() { return operands().get(1); } - + public java.util.Optional x_zero_point() { int i = optionalInputArguments.indexOf(InputParameter.x_zero_point); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional output_dtype() { Long output_dtype = Attribute.output_dtype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(output_dtype); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + public java.util.Optional block_size() { Long block_size = Attribute.block_size.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(block_size); } - + } - + public static DequantizeLinear DequantizeLinear(CodeType resultType, Value x, Value x_scale, java.util.Optional x_zero_point, java.util.Optional output_dtype, java.util.Optional axis, java.util.Optional block_size) { return new DequantizeLinear(resultType, x, x_scale, x_zero_point, output_dtype, axis, block_size); } @@ -7871,72 +7871,72 @@ public static DequantizeLinear DequantizeLinear(CodeType resultType, Value x, Va @OpFactoryHelper.OpDeclaration(Det.NAME) public static final class Det extends OnnxOp { public static final String NAME = "Det"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -7944,40 +7944,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Det(ExternalizedOp def) { super(SCHEMA, def); } - + Det(Det that, CodeContext cc) { super(that, cc); } - + @Override public Det transform(CodeContext cc, CodeTransformer ot) { return new Det(this, cc); } - + Det(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Det Det(CodeType resultType, Value X) { return new Det(resultType, X); } @@ -7985,100 +7985,100 @@ public static Det Det(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(DictVectorizer.NAME) public static final class DictVectorizer extends OnnxOp { public static final String NAME = "DictVectorizer"; - + public enum Attribute implements OnnxAttribute { string_vocabulary(String[].class, true, null), int64_vocabulary(long[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.map(OnnxType.string(), OnnxType.int64()), OnnxType.map(OnnxType.int64(), OnnxType.string()), OnnxType.map(OnnxType.int64(), OnnxType.float32()), OnnxType.map(OnnxType.int64(), OnnxType.float64()), OnnxType.map(OnnxType.string(), OnnxType.float32()), OnnxType.map(OnnxType.string(), OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -8086,50 +8086,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public DictVectorizer(ExternalizedOp def) { super(SCHEMA, def); } - + DictVectorizer(DictVectorizer that, CodeContext cc) { super(that, cc); } - + @Override public DictVectorizer transform(CodeContext cc, CodeTransformer ot) { return new DictVectorizer(this, cc); } - + DictVectorizer(CodeType resultType, Value X, java.util.Optional string_vocabulary, java.util.Optional int64_vocabulary) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(string_vocabulary, int64_vocabulary)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional string_vocabulary() { String[] string_vocabulary = Attribute.string_vocabulary.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(string_vocabulary).map(String[]::clone); } - + public java.util.Optional int64_vocabulary() { long[] int64_vocabulary = Attribute.int64_vocabulary.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(int64_vocabulary).map(long[]::clone); } - + } - + public static DictVectorizer DictVectorizer(CodeType resultType, Value X, java.util.Optional string_vocabulary, java.util.Optional int64_vocabulary) { return new DictVectorizer(resultType, X, string_vocabulary, int64_vocabulary); } @@ -8137,73 +8137,73 @@ public static DictVectorizer DictVectorizer(CodeType resultType, Value X, java.u @OpFactoryHelper.OpDeclaration(Div.NAME) public static final class Div extends OnnxOp { public static final String NAME = "Div"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -8211,44 +8211,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Div(ExternalizedOp def) { super(SCHEMA, def); } - + Div(Div that, CodeContext cc) { super(that, cc); } - + @Override public Div transform(CodeContext cc, CodeTransformer ot) { return new Div(this, cc); } - + Div(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static Div Div(CodeType resultType, Value A, Value B) { return new Div(resultType, A, B); } @@ -8256,103 +8256,103 @@ public static Div Div(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(Dropout.NAME) public static final class Dropout extends OnnxOp { public static final String NAME = "Dropout"; - + public enum Attribute implements OnnxAttribute { seed(Long.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ratio(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL), training_mode(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), mask(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -8360,55 +8360,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Dropout(ExternalizedOp def) { super(SCHEMA, def); } - + Dropout(Dropout that, CodeContext cc) { super(that, cc); } - + @Override public Dropout transform(CodeContext cc, CodeTransformer ot) { return new Dropout(this, cc); } - + Dropout(CodeType resultType, Set optionalOutputs, Value data, java.util.Optional ratio, java.util.Optional training_mode, java.util.Optional seed) { super(SCHEMA, resultType, optionalOutputs, List.of(data, ratio, training_mode), List.of(seed)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), ratio(), training_mode())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional ratio() { int i = optionalInputArguments.indexOf(InputParameter.ratio); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional training_mode() { int i = optionalInputArguments.indexOf(InputParameter.training_mode); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional seed() { Long seed = Attribute.seed.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(seed); } - + } - + public static Dropout Dropout(CodeType resultType, Set optionalOutputs, Value data, java.util.Optional ratio, java.util.Optional training_mode, java.util.Optional seed) { return new Dropout(resultType, optionalOutputs, data, ratio, training_mode, seed); } @@ -8416,75 +8416,75 @@ public static Dropout Dropout(CodeType resultType, Set @OpFactoryHelper.OpDeclaration(DynamicQuantizeLinear.NAME) public static final class DynamicQuantizeLinear extends OnnxOp { public static final String NAME = "DynamicQuantizeLinear"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { x(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), y_scale(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), y_zero_point(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -8492,40 +8492,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public DynamicQuantizeLinear(ExternalizedOp def) { super(SCHEMA, def); } - + DynamicQuantizeLinear(DynamicQuantizeLinear that, CodeContext cc) { super(that, cc); } - + @Override public DynamicQuantizeLinear transform(CodeContext cc, CodeTransformer ot) { return new DynamicQuantizeLinear(this, cc); } - + DynamicQuantizeLinear(CodeType resultType, Value x) { super(SCHEMA, resultType, Set.of(), List.of(x), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(x())); } - + public Value x() { return operands().get(0); } - + } - + public static DynamicQuantizeLinear DynamicQuantizeLinear(CodeType resultType, Value x) { return new DynamicQuantizeLinear(resultType, x); } @@ -8533,98 +8533,98 @@ public static DynamicQuantizeLinear DynamicQuantizeLinear(CodeType resultType, V @OpFactoryHelper.OpDeclaration(Einsum.NAME) public static final class Einsum extends OnnxOp { public static final String NAME = "Einsum"; - + public enum Attribute implements OnnxAttribute { equation(String.class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { Inputs(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -8632,45 +8632,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Einsum(ExternalizedOp def) { super(SCHEMA, def); } - + Einsum(Einsum that, CodeContext cc) { super(that, cc); } - + @Override public Einsum transform(CodeContext cc, CodeTransformer ot) { return new Einsum(this, cc); } - + Einsum(CodeType resultType, List Inputs, String equation) { super(SCHEMA, resultType, Set.of(), List.of(Inputs), List.of(equation)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(Inputs())); } - + public List Inputs() { return operands(); } - + public String equation() { String equation = Attribute.equation.access(String.class, onnxAttributes); return equation; } - + } - + public static Einsum Einsum(CodeType resultType, List Inputs, String equation) { return new Einsum(resultType, Inputs, equation); } @@ -8678,98 +8678,98 @@ public static Einsum Einsum(CodeType resultType, List Inputs, String equa @OpFactoryHelper.OpDeclaration(Elu.NAME) public static final class Elu extends OnnxOp { public static final String NAME = "Elu"; - + public enum Attribute implements OnnxAttribute { alpha(Float.class, true, 1.0f), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -8777,45 +8777,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Elu(ExternalizedOp def) { super(SCHEMA, def); } - + Elu(Elu that, CodeContext cc) { super(that, cc); } - + @Override public Elu transform(CodeContext cc, CodeTransformer ot) { return new Elu(this, cc); } - + Elu(CodeType resultType, Value X, java.util.Optional alpha) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional alpha() { Float alpha = Attribute.alpha.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(alpha); } - + } - + public static Elu Elu(CodeType resultType, Value X, java.util.Optional alpha) { return new Elu(resultType, X, alpha); } @@ -8823,74 +8823,74 @@ public static Elu Elu(CodeType resultType, Value X, java.util.Optional al @OpFactoryHelper.OpDeclaration(Equal.NAME) public static final class Equal extends OnnxOp { public static final String NAME = "Equal"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.string())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -8898,44 +8898,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Equal(ExternalizedOp def) { super(SCHEMA, def); } - + Equal(Equal that, CodeContext cc) { super(that, cc); } - + @Override public Equal transform(CodeContext cc, CodeTransformer ot) { return new Equal(this, cc); } - + Equal(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static Equal Equal(CodeType resultType, Value A, Value B) { return new Equal(resultType, A, B); } @@ -8943,72 +8943,72 @@ public static Equal Equal(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(Erf.NAME) public static final class Erf extends OnnxOp { public static final String NAME = "Erf"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -9016,40 +9016,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Erf(ExternalizedOp def) { super(SCHEMA, def); } - + Erf(Erf that, CodeContext cc) { super(that, cc); } - + @Override public Erf transform(CodeContext cc, CodeTransformer ot) { return new Erf(this, cc); } - + Erf(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Erf Erf(CodeType resultType, Value input) { return new Erf(resultType, input); } @@ -9057,72 +9057,72 @@ public static Erf Erf(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Exp.NAME) public static final class Exp extends OnnxOp { public static final String NAME = "Exp"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -9130,40 +9130,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Exp(ExternalizedOp def) { super(SCHEMA, def); } - + Exp(Exp that, CodeContext cc) { super(that, cc); } - + @Override public Exp transform(CodeContext cc, CodeTransformer ot) { return new Exp(this, cc); } - + Exp(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Exp Exp(CodeType resultType, Value input) { return new Exp(resultType, input); } @@ -9171,73 +9171,73 @@ public static Exp Exp(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Expand.NAME) public static final class Expand extends OnnxOp { public static final String NAME = "Expand"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -9245,44 +9245,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Expand(ExternalizedOp def) { super(SCHEMA, def); } - + Expand(Expand that, CodeContext cc) { super(that, cc); } - + @Override public Expand transform(CodeContext cc, CodeTransformer ot) { return new Expand(this, cc); } - + Expand(CodeType resultType, Value input, Value shape) { super(SCHEMA, resultType, Set.of(), List.of(input, shape), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), shape())); } - + public Value input() { return operands().get(0); } - + public Value shape() { return operands().get(1); } - + } - + public static Expand Expand(CodeType resultType, Value input, Value shape) { return new Expand(resultType, input, shape); } @@ -9290,100 +9290,100 @@ public static Expand Expand(CodeType resultType, Value input, Value shape) { @OpFactoryHelper.OpDeclaration(EyeLike.NAME) public static final class EyeLike extends OnnxOp { public static final String NAME = "EyeLike"; - + public enum Attribute implements OnnxAttribute { dtype(Long.class, true, null), k(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -9391,50 +9391,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public EyeLike(ExternalizedOp def) { super(SCHEMA, def); } - + EyeLike(EyeLike that, CodeContext cc) { super(that, cc); } - + @Override public EyeLike transform(CodeContext cc, CodeTransformer ot) { return new EyeLike(this, cc); } - + EyeLike(CodeType resultType, Value input, java.util.Optional dtype, java.util.Optional k) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(dtype, k)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional dtype() { Long dtype = Attribute.dtype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(dtype); } - + public java.util.Optional k() { Long k = Attribute.k.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(k); } - + } - + public static EyeLike EyeLike(CodeType resultType, Value input, java.util.Optional dtype, java.util.Optional k) { return new EyeLike(resultType, input, dtype, k); } @@ -9442,98 +9442,98 @@ public static EyeLike EyeLike(CodeType resultType, Value input, java.util.Option @OpFactoryHelper.OpDeclaration(FeatureVectorizer.NAME) public static final class FeatureVectorizer extends OnnxOp { public static final String NAME = "FeatureVectorizer"; - + public enum Attribute implements OnnxAttribute { inputdimensions(long[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -9541,45 +9541,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public FeatureVectorizer(ExternalizedOp def) { super(SCHEMA, def); } - + FeatureVectorizer(FeatureVectorizer that, CodeContext cc) { super(that, cc); } - + @Override public FeatureVectorizer transform(CodeContext cc, CodeTransformer ot) { return new FeatureVectorizer(this, cc); } - + FeatureVectorizer(CodeType resultType, List X, java.util.Optional inputdimensions) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(inputdimensions)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public List X() { return operands(); } - + public java.util.Optional inputdimensions() { long[] inputdimensions = Attribute.inputdimensions.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(inputdimensions).map(long[]::clone); } - + } - + public static FeatureVectorizer FeatureVectorizer(CodeType resultType, List X, java.util.Optional inputdimensions) { return new FeatureVectorizer(resultType, X, inputdimensions); } @@ -9587,98 +9587,98 @@ public static FeatureVectorizer FeatureVectorizer(CodeType resultType, List t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -9686,45 +9686,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Flatten(ExternalizedOp def) { super(SCHEMA, def); } - + Flatten(Flatten that, CodeContext cc) { super(that, cc); } - + @Override public Flatten transform(CodeContext cc, CodeTransformer ot) { return new Flatten(this, cc); } - + Flatten(CodeType resultType, Value input, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static Flatten Flatten(CodeType resultType, Value input, java.util.Optional axis) { return new Flatten(resultType, input, axis); } @@ -9732,72 +9732,72 @@ public static Flatten Flatten(CodeType resultType, Value input, java.util.Option @OpFactoryHelper.OpDeclaration(Floor.NAME) public static final class Floor extends OnnxOp { public static final String NAME = "Floor"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -9805,40 +9805,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Floor(ExternalizedOp def) { super(SCHEMA, def); } - + Floor(Floor that, CodeContext cc) { super(that, cc); } - + @Override public Floor transform(CodeContext cc, CodeTransformer ot) { return new Floor(this, cc); } - + Floor(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Floor Floor(CodeType resultType, Value X) { return new Floor(resultType, X); } @@ -9846,7 +9846,7 @@ public static Floor Floor(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(GRU.NAME) public static final class GRU extends OnnxOp { public static final String NAME = "GRU"; - + public enum Attribute implements OnnxAttribute { layout(Long.class, true, 0), activation_alpha(float[].class, true, null), @@ -9857,49 +9857,49 @@ public enum Attribute implements OnnxAttribute { clip(Float.class, true, null), direction(String.class, true, "forward"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), @@ -9908,50 +9908,50 @@ public enum InputParameter implements OnnxParameter { sequence_lens(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL), initial_h(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), Y_h(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -9959,103 +9959,103 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public GRU(ExternalizedOp def) { super(SCHEMA, def); } - + GRU(GRU that, CodeContext cc) { super(that, cc); } - + @Override public GRU transform(CodeContext cc, CodeTransformer ot) { return new GRU(this, cc); } - + GRU(CodeType resultType, Set optionalOutputs, Value X, Value W, Value R, java.util.Optional B, java.util.Optional sequence_lens, java.util.Optional initial_h, java.util.Optional layout, java.util.Optional activation_alpha, java.util.Optional hidden_size, java.util.Optional activation_beta, java.util.Optional activations, java.util.Optional linear_before_reset, java.util.Optional clip, java.util.Optional direction) { super(SCHEMA, resultType, optionalOutputs, List.of(X, W, R, B, sequence_lens, initial_h), List.of(layout, activation_alpha, hidden_size, activation_beta, activations, linear_before_reset, clip, direction)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), W(), R(), B(), sequence_lens(), initial_h())); } - + public Value X() { return operands().get(0); } - + public Value W() { return operands().get(1); } - + public Value R() { return operands().get(2); } - + public java.util.Optional B() { int i = optionalInputArguments.indexOf(InputParameter.B); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional sequence_lens() { int i = optionalInputArguments.indexOf(InputParameter.sequence_lens); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional initial_h() { int i = optionalInputArguments.indexOf(InputParameter.initial_h); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional layout() { Long layout = Attribute.layout.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(layout); } - + public java.util.Optional activation_alpha() { float[] activation_alpha = Attribute.activation_alpha.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(activation_alpha).map(float[]::clone); } - + public java.util.Optional hidden_size() { Long hidden_size = Attribute.hidden_size.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(hidden_size); } - + public java.util.Optional activation_beta() { float[] activation_beta = Attribute.activation_beta.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(activation_beta).map(float[]::clone); } - + public java.util.Optional activations() { String[] activations = Attribute.activations.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(activations).map(String[]::clone); } - + public java.util.Optional linear_before_reset() { Long linear_before_reset = Attribute.linear_before_reset.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(linear_before_reset); } - + public java.util.Optional clip() { Float clip = Attribute.clip.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(clip); } - + public java.util.Optional direction() { String direction = Attribute.direction.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(direction); } - + } - + public static GRU GRU(CodeType resultType, Set optionalOutputs, Value X, Value W, Value R, java.util.Optional B, java.util.Optional sequence_lens, java.util.Optional initial_h, java.util.Optional layout, java.util.Optional activation_alpha, java.util.Optional hidden_size, java.util.Optional activation_beta, java.util.Optional activations, java.util.Optional linear_before_reset, java.util.Optional clip, java.util.Optional direction) { return new GRU(resultType, optionalOutputs, X, W, R, B, sequence_lens, initial_h, layout, activation_alpha, hidden_size, activation_beta, activations, linear_before_reset, clip, direction); } @@ -10063,100 +10063,100 @@ public static GRU GRU(CodeType resultType, Set optionalOutp @OpFactoryHelper.OpDeclaration(Gather.NAME) public static final class Gather extends OnnxOp { public static final String NAME = "Gather"; - + public enum Attribute implements OnnxAttribute { axis(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), indices(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -10164,49 +10164,49 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Gather(ExternalizedOp def) { super(SCHEMA, def); } - + Gather(Gather that, CodeContext cc) { super(that, cc); } - + @Override public Gather transform(CodeContext cc, CodeTransformer ot) { return new Gather(this, cc); } - + Gather(CodeType resultType, Value data, Value indices, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(data, indices), List.of(axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), indices())); } - + public Value data() { return operands().get(0); } - + public Value indices() { return operands().get(1); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static Gather Gather(CodeType resultType, Value data, Value indices, java.util.Optional axis) { return new Gather(resultType, data, indices, axis); } @@ -10214,100 +10214,100 @@ public static Gather Gather(CodeType resultType, Value data, Value indices, java @OpFactoryHelper.OpDeclaration(GatherElements.NAME) public static final class GatherElements extends OnnxOp { public static final String NAME = "GatherElements"; - + public enum Attribute implements OnnxAttribute { axis(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), indices(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -10315,49 +10315,49 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public GatherElements(ExternalizedOp def) { super(SCHEMA, def); } - + GatherElements(GatherElements that, CodeContext cc) { super(that, cc); } - + @Override public GatherElements transform(CodeContext cc, CodeTransformer ot) { return new GatherElements(this, cc); } - + GatherElements(CodeType resultType, Value data, Value indices, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(data, indices), List.of(axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), indices())); } - + public Value data() { return operands().get(0); } - + public Value indices() { return operands().get(1); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static GatherElements GatherElements(CodeType resultType, Value data, Value indices, java.util.Optional axis) { return new GatherElements(resultType, data, indices, axis); } @@ -10365,99 +10365,99 @@ public static GatherElements GatherElements(CodeType resultType, Value data, Val @OpFactoryHelper.OpDeclaration(GatherND.NAME) public static final class GatherND extends OnnxOp { public static final String NAME = "GatherND"; - + public enum Attribute implements OnnxAttribute { batch_dims(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), indices(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -10465,49 +10465,49 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public GatherND(ExternalizedOp def) { super(SCHEMA, def); } - + GatherND(GatherND that, CodeContext cc) { super(that, cc); } - + @Override public GatherND transform(CodeContext cc, CodeTransformer ot) { return new GatherND(this, cc); } - + GatherND(CodeType resultType, Value data, Value indices, java.util.Optional batch_dims) { super(SCHEMA, resultType, Set.of(), List.of(data, indices), List.of(batch_dims)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), indices())); } - + public Value data() { return operands().get(0); } - + public Value indices() { return operands().get(1); } - + public java.util.Optional batch_dims() { Long batch_dims = Attribute.batch_dims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(batch_dims); } - + } - + public static GatherND GatherND(CodeType resultType, Value data, Value indices, java.util.Optional batch_dims) { return new GatherND(resultType, data, indices, batch_dims); } @@ -10515,98 +10515,98 @@ public static GatherND GatherND(CodeType resultType, Value data, Value indices, @OpFactoryHelper.OpDeclaration(Gelu.NAME) public static final class Gelu extends OnnxOp { public static final String NAME = "Gelu"; - + public enum Attribute implements OnnxAttribute { approximate(String.class, true, "none"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -10614,45 +10614,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Gelu(ExternalizedOp def) { super(SCHEMA, def); } - + Gelu(Gelu that, CodeContext cc) { super(that, cc); } - + @Override public Gelu transform(CodeContext cc, CodeTransformer ot) { return new Gelu(this, cc); } - + Gelu(CodeType resultType, Value X, java.util.Optional approximate) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(approximate)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional approximate() { String approximate = Attribute.approximate.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(approximate); } - + } - + public static Gelu Gelu(CodeType resultType, Value X, java.util.Optional approximate) { return new Gelu(resultType, X, approximate); } @@ -10660,103 +10660,103 @@ public static Gelu Gelu(CodeType resultType, Value X, java.util.Optional @OpFactoryHelper.OpDeclaration(Gemm.NAME) public static final class Gemm extends OnnxOp { public static final String NAME = "Gemm"; - + public enum Attribute implements OnnxAttribute { alpha(Float.class, true, 1.0f), transB(Long.class, true, 0), beta(Float.class, true, 1.0f), transA(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), C(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -10764,69 +10764,69 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Gemm(ExternalizedOp def) { super(SCHEMA, def); } - + Gemm(Gemm that, CodeContext cc) { super(that, cc); } - + @Override public Gemm transform(CodeContext cc, CodeTransformer ot) { return new Gemm(this, cc); } - + Gemm(CodeType resultType, Value A, Value B, java.util.Optional C, java.util.Optional alpha, java.util.Optional transB, java.util.Optional beta, java.util.Optional transA) { super(SCHEMA, resultType, Set.of(), List.of(A, B, C), List.of(alpha, transB, beta, transA)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B(), C())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + public java.util.Optional C() { int i = optionalInputArguments.indexOf(InputParameter.C); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional alpha() { Float alpha = Attribute.alpha.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(alpha); } - + public java.util.Optional transB() { Long transB = Attribute.transB.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(transB); } - + public java.util.Optional beta() { Float beta = Attribute.beta.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(beta); } - + public java.util.Optional transA() { Long transA = Attribute.transA.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(transA); } - + } - + public static Gemm Gemm(CodeType resultType, Value A, Value B, java.util.Optional C, java.util.Optional alpha, java.util.Optional transB, java.util.Optional beta, java.util.Optional transA) { return new Gemm(resultType, A, B, C, alpha, transB, beta, transA); } @@ -10834,72 +10834,72 @@ public static Gemm Gemm(CodeType resultType, Value A, Value B, java.util.Optiona @OpFactoryHelper.OpDeclaration(GlobalAveragePool.NAME) public static final class GlobalAveragePool extends OnnxOp { public static final String NAME = "GlobalAveragePool"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -10907,40 +10907,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public GlobalAveragePool(ExternalizedOp def) { super(SCHEMA, def); } - + GlobalAveragePool(GlobalAveragePool that, CodeContext cc) { super(that, cc); } - + @Override public GlobalAveragePool transform(CodeContext cc, CodeTransformer ot) { return new GlobalAveragePool(this, cc); } - + GlobalAveragePool(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static GlobalAveragePool GlobalAveragePool(CodeType resultType, Value X) { return new GlobalAveragePool(resultType, X); } @@ -10948,98 +10948,98 @@ public static GlobalAveragePool GlobalAveragePool(CodeType resultType, Value X) @OpFactoryHelper.OpDeclaration(GlobalLpPool.NAME) public static final class GlobalLpPool extends OnnxOp { public static final String NAME = "GlobalLpPool"; - + public enum Attribute implements OnnxAttribute { p(Long.class, true, 2), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -11047,45 +11047,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public GlobalLpPool(ExternalizedOp def) { super(SCHEMA, def); } - + GlobalLpPool(GlobalLpPool that, CodeContext cc) { super(that, cc); } - + @Override public GlobalLpPool transform(CodeContext cc, CodeTransformer ot) { return new GlobalLpPool(this, cc); } - + GlobalLpPool(CodeType resultType, Value X, java.util.Optional p) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(p)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional p() { Long p = Attribute.p.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(p); } - + } - + public static GlobalLpPool GlobalLpPool(CodeType resultType, Value X, java.util.Optional p) { return new GlobalLpPool(resultType, X, p); } @@ -11093,72 +11093,72 @@ public static GlobalLpPool GlobalLpPool(CodeType resultType, Value X, java.util. @OpFactoryHelper.OpDeclaration(GlobalMaxPool.NAME) public static final class GlobalMaxPool extends OnnxOp { public static final String NAME = "GlobalMaxPool"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -11166,40 +11166,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public GlobalMaxPool(ExternalizedOp def) { super(SCHEMA, def); } - + GlobalMaxPool(GlobalMaxPool that, CodeContext cc) { super(that, cc); } - + @Override public GlobalMaxPool transform(CodeContext cc, CodeTransformer ot) { return new GlobalMaxPool(this, cc); } - + GlobalMaxPool(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static GlobalMaxPool GlobalMaxPool(CodeType resultType, Value X) { return new GlobalMaxPool(resultType, X); } @@ -11207,101 +11207,101 @@ public static GlobalMaxPool GlobalMaxPool(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(Gradient.NAME) public static final class Gradient extends OnnxOp { public static final String NAME = "Gradient"; - + public enum Attribute implements OnnxAttribute { y(String.class, false, null), zs(String[].class, true, null), xs(String[].class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { Inputs(TypeConstraint.T1.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Outputs(TypeConstraint.T2.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -11309,55 +11309,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Gradient(ExternalizedOp def) { super(SCHEMA, def); } - + Gradient(Gradient that, CodeContext cc) { super(that, cc); } - + @Override public Gradient transform(CodeContext cc, CodeTransformer ot) { return new Gradient(this, cc); } - + Gradient(CodeType resultType, List Inputs, String y, java.util.Optional zs, String[] xs) { super(SCHEMA, resultType, Set.of(), List.of(Inputs), List.of(y, zs, xs)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(Inputs())); } - + public List Inputs() { return operands(); } - + public String y() { String y = Attribute.y.access(String.class, onnxAttributes); return y; } - + public java.util.Optional zs() { String[] zs = Attribute.zs.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(zs).map(String[]::clone); } - + public String[] xs() { String[] xs = Attribute.xs.access(String[].class, onnxAttributes); return xs.clone(); } - + } - + public static Gradient Gradient(CodeType resultType, List Inputs, String y, java.util.Optional zs, String[] xs) { return new Gradient(resultType, Inputs, y, zs, xs); } @@ -11365,74 +11365,74 @@ public static Gradient Gradient(CodeType resultType, List Inputs, String @OpFactoryHelper.OpDeclaration(Greater.NAME) public static final class Greater extends OnnxOp { public static final String NAME = "Greater"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -11440,44 +11440,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Greater(ExternalizedOp def) { super(SCHEMA, def); } - + Greater(Greater that, CodeContext cc) { super(that, cc); } - + @Override public Greater transform(CodeContext cc, CodeTransformer ot) { return new Greater(this, cc); } - + Greater(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static Greater Greater(CodeType resultType, Value A, Value B) { return new Greater(resultType, A, B); } @@ -11485,74 +11485,74 @@ public static Greater Greater(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(GreaterOrEqual.NAME) public static final class GreaterOrEqual extends OnnxOp { public static final String NAME = "GreaterOrEqual"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -11560,44 +11560,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public GreaterOrEqual(ExternalizedOp def) { super(SCHEMA, def); } - + GreaterOrEqual(GreaterOrEqual that, CodeContext cc) { super(that, cc); } - + @Override public GreaterOrEqual transform(CodeContext cc, CodeTransformer ot) { return new GreaterOrEqual(this, cc); } - + GreaterOrEqual(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static GreaterOrEqual GreaterOrEqual(CodeType resultType, Value A, Value B) { return new GreaterOrEqual(resultType, A, B); } @@ -11605,102 +11605,102 @@ public static GreaterOrEqual GreaterOrEqual(CodeType resultType, Value A, Value @OpFactoryHelper.OpDeclaration(GridSample.NAME) public static final class GridSample extends OnnxOp { public static final String NAME = "GridSample"; - + public enum Attribute implements OnnxAttribute { mode(String.class, true, "linear"), align_corners(Long.class, true, 0), padding_mode(String.class, true, "zeros"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), grid(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -11708,59 +11708,59 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public GridSample(ExternalizedOp def) { super(SCHEMA, def); } - + GridSample(GridSample that, CodeContext cc) { super(that, cc); } - + @Override public GridSample transform(CodeContext cc, CodeTransformer ot) { return new GridSample(this, cc); } - + GridSample(CodeType resultType, Value X, Value grid, java.util.Optional mode, java.util.Optional align_corners, java.util.Optional padding_mode) { super(SCHEMA, resultType, Set.of(), List.of(X, grid), List.of(mode, align_corners, padding_mode)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), grid())); } - + public Value X() { return operands().get(0); } - + public Value grid() { return operands().get(1); } - + public java.util.Optional mode() { String mode = Attribute.mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(mode); } - + public java.util.Optional align_corners() { Long align_corners = Attribute.align_corners.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(align_corners); } - + public java.util.Optional padding_mode() { String padding_mode = Attribute.padding_mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(padding_mode); } - + } - + public static GridSample GridSample(CodeType resultType, Value X, Value grid, java.util.Optional mode, java.util.Optional align_corners, java.util.Optional padding_mode) { return new GridSample(resultType, X, grid, mode, align_corners, padding_mode); } @@ -11768,102 +11768,102 @@ public static GridSample GridSample(CodeType resultType, Value X, Value grid, ja @OpFactoryHelper.OpDeclaration(GroupNormalization.NAME) public static final class GroupNormalization extends OnnxOp { public static final String NAME = "GroupNormalization"; - + public enum Attribute implements OnnxAttribute { epsilon(Float.class, true, 1.0E-5f), stash_type(Long.class, true, 1), num_groups(Long.class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), scale(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), bias(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -11871,63 +11871,63 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public GroupNormalization(ExternalizedOp def) { super(SCHEMA, def); } - + GroupNormalization(GroupNormalization that, CodeContext cc) { super(that, cc); } - + @Override public GroupNormalization transform(CodeContext cc, CodeTransformer ot) { return new GroupNormalization(this, cc); } - + GroupNormalization(CodeType resultType, Value X, Value scale, Value bias, java.util.Optional epsilon, java.util.Optional stash_type, long num_groups) { super(SCHEMA, resultType, Set.of(), List.of(X, scale, bias), List.of(epsilon, stash_type, num_groups)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), scale(), bias())); } - + public Value X() { return operands().get(0); } - + public Value scale() { return operands().get(1); } - + public Value bias() { return operands().get(2); } - + public java.util.Optional epsilon() { Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(epsilon); } - + public java.util.Optional stash_type() { Long stash_type = Attribute.stash_type.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(stash_type); } - + public long num_groups() { long num_groups = Attribute.num_groups.access(Long.class, onnxAttributes); return num_groups; } - + } - + public static GroupNormalization GroupNormalization(CodeType resultType, Value X, Value scale, Value bias, java.util.Optional epsilon, java.util.Optional stash_type, long num_groups) { return new GroupNormalization(resultType, X, scale, bias, epsilon, stash_type, num_groups); } @@ -11935,100 +11935,100 @@ public static GroupNormalization GroupNormalization(CodeType resultType, Value X @OpFactoryHelper.OpDeclaration(HammingWindow.NAME) public static final class HammingWindow extends OnnxOp { public static final String NAME = "HammingWindow"; - + public enum Attribute implements OnnxAttribute { periodic(Long.class, true, 1), output_datatype(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { size(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -12036,50 +12036,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public HammingWindow(ExternalizedOp def) { super(SCHEMA, def); } - + HammingWindow(HammingWindow that, CodeContext cc) { super(that, cc); } - + @Override public HammingWindow transform(CodeContext cc, CodeTransformer ot) { return new HammingWindow(this, cc); } - + HammingWindow(CodeType resultType, Value size, java.util.Optional periodic, java.util.Optional output_datatype) { super(SCHEMA, resultType, Set.of(), List.of(size), List.of(periodic, output_datatype)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(size())); } - + public Value size() { return operands().get(0); } - + public java.util.Optional periodic() { Long periodic = Attribute.periodic.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(periodic); } - + public java.util.Optional output_datatype() { Long output_datatype = Attribute.output_datatype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(output_datatype); } - + } - + public static HammingWindow HammingWindow(CodeType resultType, Value size, java.util.Optional periodic, java.util.Optional output_datatype) { return new HammingWindow(resultType, size, periodic, output_datatype); } @@ -12087,100 +12087,100 @@ public static HammingWindow HammingWindow(CodeType resultType, Value size, java. @OpFactoryHelper.OpDeclaration(HannWindow.NAME) public static final class HannWindow extends OnnxOp { public static final String NAME = "HannWindow"; - + public enum Attribute implements OnnxAttribute { periodic(Long.class, true, 1), output_datatype(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { size(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -12188,50 +12188,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public HannWindow(ExternalizedOp def) { super(SCHEMA, def); } - + HannWindow(HannWindow that, CodeContext cc) { super(that, cc); } - + @Override public HannWindow transform(CodeContext cc, CodeTransformer ot) { return new HannWindow(this, cc); } - + HannWindow(CodeType resultType, Value size, java.util.Optional periodic, java.util.Optional output_datatype) { super(SCHEMA, resultType, Set.of(), List.of(size), List.of(periodic, output_datatype)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(size())); } - + public Value size() { return operands().get(0); } - + public java.util.Optional periodic() { Long periodic = Attribute.periodic.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(periodic); } - + public java.util.Optional output_datatype() { Long output_datatype = Attribute.output_datatype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(output_datatype); } - + } - + public static HannWindow HannWindow(CodeType resultType, Value size, java.util.Optional periodic, java.util.Optional output_datatype) { return new HannWindow(resultType, size, periodic, output_datatype); } @@ -12239,99 +12239,99 @@ public static HannWindow HannWindow(CodeType resultType, Value size, java.util.O @OpFactoryHelper.OpDeclaration(HardSigmoid.NAME) public static final class HardSigmoid extends OnnxOp { public static final String NAME = "HardSigmoid"; - + public enum Attribute implements OnnxAttribute { alpha(Float.class, true, 0.2f), beta(Float.class, true, 0.5f), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -12339,50 +12339,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public HardSigmoid(ExternalizedOp def) { super(SCHEMA, def); } - + HardSigmoid(HardSigmoid that, CodeContext cc) { super(that, cc); } - + @Override public HardSigmoid transform(CodeContext cc, CodeTransformer ot) { return new HardSigmoid(this, cc); } - + HardSigmoid(CodeType resultType, Value X, java.util.Optional alpha, java.util.Optional beta) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha, beta)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional alpha() { Float alpha = Attribute.alpha.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(alpha); } - + public java.util.Optional beta() { Float beta = Attribute.beta.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(beta); } - + } - + public static HardSigmoid HardSigmoid(CodeType resultType, Value X, java.util.Optional alpha, java.util.Optional beta) { return new HardSigmoid(resultType, X, alpha, beta); } @@ -12390,72 +12390,72 @@ public static HardSigmoid HardSigmoid(CodeType resultType, Value X, java.util.Op @OpFactoryHelper.OpDeclaration(HardSwish.NAME) public static final class HardSwish extends OnnxOp { public static final String NAME = "HardSwish"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -12463,40 +12463,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public HardSwish(ExternalizedOp def) { super(SCHEMA, def); } - + HardSwish(HardSwish that, CodeContext cc) { super(that, cc); } - + @Override public HardSwish transform(CodeContext cc, CodeTransformer ot) { return new HardSwish(this, cc); } - + HardSwish(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static HardSwish HardSwish(CodeType resultType, Value X) { return new HardSwish(resultType, X); } @@ -12504,98 +12504,98 @@ public static HardSwish HardSwish(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(Hardmax.NAME) public static final class Hardmax extends OnnxOp { public static final String NAME = "Hardmax"; - + public enum Attribute implements OnnxAttribute { axis(Long.class, true, -1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -12603,45 +12603,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Hardmax(ExternalizedOp def) { super(SCHEMA, def); } - + Hardmax(Hardmax that, CodeContext cc) { super(that, cc); } - + @Override public Hardmax transform(CodeContext cc, CodeTransformer ot) { return new Hardmax(this, cc); } - + Hardmax(CodeType resultType, Value input, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static Hardmax Hardmax(CodeType resultType, Value input, java.util.Optional axis) { return new Hardmax(resultType, input, axis); } @@ -12649,72 +12649,72 @@ public static Hardmax Hardmax(CodeType resultType, Value input, java.util.Option @OpFactoryHelper.OpDeclaration(Identity.NAME) public static final class Identity extends OnnxOp { public static final String NAME = "Identity"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { V(new OnnxType.TypeVariable("V", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2()), OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128())), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.string()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.bool()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))), OnnxType.optional(OnnxType.tensor(OnnxType.uint8())), OnnxType.optional(OnnxType.tensor(OnnxType.uint16())), OnnxType.optional(OnnxType.tensor(OnnxType.uint32())), OnnxType.optional(OnnxType.tensor(OnnxType.uint64())), OnnxType.optional(OnnxType.tensor(OnnxType.int8())), OnnxType.optional(OnnxType.tensor(OnnxType.int16())), OnnxType.optional(OnnxType.tensor(OnnxType.int32())), OnnxType.optional(OnnxType.tensor(OnnxType.int64())), OnnxType.optional(OnnxType.tensor(OnnxType.float16())), OnnxType.optional(OnnxType.tensor(OnnxType.float32())), OnnxType.optional(OnnxType.tensor(OnnxType.float64())), OnnxType.optional(OnnxType.tensor(OnnxType.string())), OnnxType.optional(OnnxType.tensor(OnnxType.bool())), OnnxType.optional(OnnxType.tensor(OnnxType.complex64())), OnnxType.optional(OnnxType.tensor(OnnxType.complex128()))))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.V.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.V.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -12722,40 +12722,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Identity(ExternalizedOp def) { super(SCHEMA, def); } - + Identity(Identity that, CodeContext cc) { super(that, cc); } - + @Override public Identity transform(CodeContext cc, CodeTransformer ot) { return new Identity(this, cc); } - + Identity(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Identity Identity(CodeType resultType, Value input) { return new Identity(resultType, input); } @@ -12763,99 +12763,99 @@ public static Identity Identity(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(ImageDecoder.NAME) public static final class ImageDecoder extends OnnxOp { public static final String NAME = "ImageDecoder"; - + public enum Attribute implements OnnxAttribute { pixel_format(String.class, true, "RGB"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { encoded_stream(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { image(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -12863,45 +12863,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ImageDecoder(ExternalizedOp def) { super(SCHEMA, def); } - + ImageDecoder(ImageDecoder that, CodeContext cc) { super(that, cc); } - + @Override public ImageDecoder transform(CodeContext cc, CodeTransformer ot) { return new ImageDecoder(this, cc); } - + ImageDecoder(CodeType resultType, Value encoded_stream, java.util.Optional pixel_format) { super(SCHEMA, resultType, Set.of(), List.of(encoded_stream), List.of(pixel_format)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(encoded_stream())); } - + public Value encoded_stream() { return operands().get(0); } - + public java.util.Optional pixel_format() { String pixel_format = Attribute.pixel_format.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(pixel_format); } - + } - + public static ImageDecoder ImageDecoder(CodeType resultType, Value encoded_stream, java.util.Optional pixel_format) { return new ImageDecoder(resultType, encoded_stream, pixel_format); } @@ -12909,101 +12909,101 @@ public static ImageDecoder ImageDecoder(CodeType resultType, Value encoded_strea @OpFactoryHelper.OpDeclaration(Imputer.NAME) public static final class Imputer extends OnnxOp { public static final String NAME = "Imputer"; - + public enum Attribute implements OnnxAttribute { replaced_value_int64(Long.class, true, 0), replaced_value_float(Float.class, true, 0.0f), imputed_value_int64s(long[].class, true, null), imputed_value_floats(float[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -13011,60 +13011,60 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Imputer(ExternalizedOp def) { super(SCHEMA, def); } - + Imputer(Imputer that, CodeContext cc) { super(that, cc); } - + @Override public Imputer transform(CodeContext cc, CodeTransformer ot) { return new Imputer(this, cc); } - + Imputer(CodeType resultType, Value X, java.util.Optional replaced_value_int64, java.util.Optional replaced_value_float, java.util.Optional imputed_value_int64s, java.util.Optional imputed_value_floats) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(replaced_value_int64, replaced_value_float, imputed_value_int64s, imputed_value_floats)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional replaced_value_int64() { Long replaced_value_int64 = Attribute.replaced_value_int64.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(replaced_value_int64); } - + public java.util.Optional replaced_value_float() { Float replaced_value_float = Attribute.replaced_value_float.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(replaced_value_float); } - + public java.util.Optional imputed_value_int64s() { long[] imputed_value_int64s = Attribute.imputed_value_int64s.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(imputed_value_int64s).map(long[]::clone); } - + public java.util.Optional imputed_value_floats() { float[] imputed_value_floats = Attribute.imputed_value_floats.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(imputed_value_floats).map(float[]::clone); } - + } - + public static Imputer Imputer(CodeType resultType, Value X, java.util.Optional replaced_value_int64, java.util.Optional replaced_value_float, java.util.Optional imputed_value_int64s, java.util.Optional imputed_value_floats) { return new Imputer(resultType, X, replaced_value_int64, replaced_value_float, imputed_value_int64s, imputed_value_floats); } @@ -13072,100 +13072,100 @@ public static Imputer Imputer(CodeType resultType, Value X, java.util.Optional t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), scale(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -13173,53 +13173,53 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public InstanceNormalization(ExternalizedOp def) { super(SCHEMA, def); } - + InstanceNormalization(InstanceNormalization that, CodeContext cc) { super(that, cc); } - + @Override public InstanceNormalization transform(CodeContext cc, CodeTransformer ot) { return new InstanceNormalization(this, cc); } - + InstanceNormalization(CodeType resultType, Value input, Value scale, Value B, java.util.Optional epsilon) { super(SCHEMA, resultType, Set.of(), List.of(input, scale, B), List.of(epsilon)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), scale(), B())); } - + public Value input() { return operands().get(0); } - + public Value scale() { return operands().get(1); } - + public Value B() { return operands().get(2); } - + public java.util.Optional epsilon() { Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(epsilon); } - + } - + public static InstanceNormalization InstanceNormalization(CodeType resultType, Value input, Value scale, Value B, java.util.Optional epsilon) { return new InstanceNormalization(resultType, input, scale, B, epsilon); } @@ -13227,100 +13227,100 @@ public static InstanceNormalization InstanceNormalization(CodeType resultType, V @OpFactoryHelper.OpDeclaration(IsInf.NAME) public static final class IsInf extends OnnxOp { public static final String NAME = "IsInf"; - + public enum Attribute implements OnnxAttribute { detect_negative(Long.class, true, 1), detect_positive(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -13328,50 +13328,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public IsInf(ExternalizedOp def) { super(SCHEMA, def); } - + IsInf(IsInf that, CodeContext cc) { super(that, cc); } - + @Override public IsInf transform(CodeContext cc, CodeTransformer ot) { return new IsInf(this, cc); } - + IsInf(CodeType resultType, Value X, java.util.Optional detect_negative, java.util.Optional detect_positive) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(detect_negative, detect_positive)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional detect_negative() { Long detect_negative = Attribute.detect_negative.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(detect_negative); } - + public java.util.Optional detect_positive() { Long detect_positive = Attribute.detect_positive.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(detect_positive); } - + } - + public static IsInf IsInf(CodeType resultType, Value X, java.util.Optional detect_negative, java.util.Optional detect_positive) { return new IsInf(resultType, X, detect_negative, detect_positive); } @@ -13379,73 +13379,73 @@ public static IsInf IsInf(CodeType resultType, Value X, java.util.Optional @OpFactoryHelper.OpDeclaration(IsNaN.NAME) public static final class IsNaN extends OnnxOp { public static final String NAME = "IsNaN"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -13453,40 +13453,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public IsNaN(ExternalizedOp def) { super(SCHEMA, def); } - + IsNaN(IsNaN that, CodeContext cc) { super(that, cc); } - + @Override public IsNaN transform(CodeContext cc, CodeTransformer ot) { return new IsNaN(this, cc); } - + IsNaN(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static IsNaN IsNaN(CodeType resultType, Value X) { return new IsNaN(resultType, X); } @@ -13494,101 +13494,101 @@ public static IsNaN IsNaN(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(LRN.NAME) public static final class LRN extends OnnxOp { public static final String NAME = "LRN"; - + public enum Attribute implements OnnxAttribute { size(Long.class, false, null), alpha(Float.class, true, 1.0E-4f), bias(Float.class, true, 1.0f), beta(Float.class, true, 0.75f), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -13596,60 +13596,60 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LRN(ExternalizedOp def) { super(SCHEMA, def); } - + LRN(LRN that, CodeContext cc) { super(that, cc); } - + @Override public LRN transform(CodeContext cc, CodeTransformer ot) { return new LRN(this, cc); } - + LRN(CodeType resultType, Value X, long size, java.util.Optional alpha, java.util.Optional bias, java.util.Optional beta) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(size, alpha, bias, beta)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public long size() { long size = Attribute.size.access(Long.class, onnxAttributes); return size; } - + public java.util.Optional alpha() { Float alpha = Attribute.alpha.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(alpha); } - + public java.util.Optional bias() { Float bias = Attribute.bias.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(bias); } - + public java.util.Optional beta() { Float beta = Attribute.beta.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(beta); } - + } - + public static LRN LRN(CodeType resultType, Value X, long size, java.util.Optional alpha, java.util.Optional bias, java.util.Optional beta) { return new LRN(resultType, X, size, alpha, bias, beta); } @@ -13657,7 +13657,7 @@ public static LRN LRN(CodeType resultType, Value X, long size, java.util.Optiona @OpFactoryHelper.OpDeclaration(LSTM.NAME) public static final class LSTM extends OnnxOp { public static final String NAME = "LSTM"; - + public enum Attribute implements OnnxAttribute { layout(Long.class, true, 0), input_forget(Long.class, true, 0), @@ -13668,49 +13668,49 @@ public enum Attribute implements OnnxAttribute { clip(Float.class, true, null), direction(String.class, true, "forward"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), @@ -13721,51 +13721,51 @@ public enum InputParameter implements OnnxParameter { initial_c(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), P(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), Y_h(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), Y_c(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -13773,113 +13773,113 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LSTM(ExternalizedOp def) { super(SCHEMA, def); } - + LSTM(LSTM that, CodeContext cc) { super(that, cc); } - + @Override public LSTM transform(CodeContext cc, CodeTransformer ot) { return new LSTM(this, cc); } - + LSTM(CodeType resultType, Set optionalOutputs, Value X, Value W, Value R, java.util.Optional B, java.util.Optional sequence_lens, java.util.Optional initial_h, java.util.Optional initial_c, java.util.Optional P, java.util.Optional layout, java.util.Optional input_forget, java.util.Optional activation_alpha, java.util.Optional hidden_size, java.util.Optional activation_beta, java.util.Optional activations, java.util.Optional clip, java.util.Optional direction) { super(SCHEMA, resultType, optionalOutputs, List.of(X, W, R, B, sequence_lens, initial_h, initial_c, P), List.of(layout, input_forget, activation_alpha, hidden_size, activation_beta, activations, clip, direction)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), W(), R(), B(), sequence_lens(), initial_h(), initial_c(), P())); } - + public Value X() { return operands().get(0); } - + public Value W() { return operands().get(1); } - + public Value R() { return operands().get(2); } - + public java.util.Optional B() { int i = optionalInputArguments.indexOf(InputParameter.B); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional sequence_lens() { int i = optionalInputArguments.indexOf(InputParameter.sequence_lens); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional initial_h() { int i = optionalInputArguments.indexOf(InputParameter.initial_h); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional initial_c() { int i = optionalInputArguments.indexOf(InputParameter.initial_c); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional P() { int i = optionalInputArguments.indexOf(InputParameter.P); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional layout() { Long layout = Attribute.layout.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(layout); } - + public java.util.Optional input_forget() { Long input_forget = Attribute.input_forget.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(input_forget); } - + public java.util.Optional activation_alpha() { float[] activation_alpha = Attribute.activation_alpha.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(activation_alpha).map(float[]::clone); } - + public java.util.Optional hidden_size() { Long hidden_size = Attribute.hidden_size.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(hidden_size); } - + public java.util.Optional activation_beta() { float[] activation_beta = Attribute.activation_beta.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(activation_beta).map(float[]::clone); } - + public java.util.Optional activations() { String[] activations = Attribute.activations.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(activations).map(String[]::clone); } - + public java.util.Optional clip() { Float clip = Attribute.clip.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(clip); } - + public java.util.Optional direction() { String direction = Attribute.direction.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(direction); } - + } - + public static LSTM LSTM(CodeType resultType, Set optionalOutputs, Value X, Value W, Value R, java.util.Optional B, java.util.Optional sequence_lens, java.util.Optional initial_h, java.util.Optional initial_c, java.util.Optional P, java.util.Optional layout, java.util.Optional input_forget, java.util.Optional activation_alpha, java.util.Optional hidden_size, java.util.Optional activation_beta, java.util.Optional activations, java.util.Optional clip, java.util.Optional direction) { return new LSTM(resultType, optionalOutputs, X, W, R, B, sequence_lens, initial_h, initial_c, P, layout, input_forget, activation_alpha, hidden_size, activation_beta, activations, clip, direction); } @@ -13887,7 +13887,7 @@ public static LSTM LSTM(CodeType resultType, Set optionalO @OpFactoryHelper.OpDeclaration(LabelEncoder.NAME) public static final class LabelEncoder extends OnnxOp { public static final String NAME = "LabelEncoder"; - + public enum Attribute implements OnnxAttribute { values_strings(String[].class, true, null), keys_int64s(long[].class, true, null), @@ -13902,95 +13902,95 @@ public enum Attribute implements OnnxAttribute { default_string(String.class, true, "_Unused"), values_floats(float[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -13998,100 +13998,100 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LabelEncoder(ExternalizedOp def) { super(SCHEMA, def); } - + LabelEncoder(LabelEncoder that, CodeContext cc) { super(that, cc); } - + @Override public LabelEncoder transform(CodeContext cc, CodeTransformer ot) { return new LabelEncoder(this, cc); } - + LabelEncoder(CodeType resultType, Value X, java.util.Optional values_strings, java.util.Optional keys_int64s, java.util.Optional keys_tensor, java.util.Optional keys_strings, java.util.Optional default_float, java.util.Optional keys_floats, java.util.Optional default_tensor, java.util.Optional default_int64, java.util.Optional values_tensor, java.util.Optional values_int64s, java.util.Optional default_string, java.util.Optional values_floats) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(values_strings, keys_int64s, keys_tensor, keys_strings, default_float, keys_floats, default_tensor, default_int64, values_tensor, values_int64s, default_string, values_floats)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional values_strings() { String[] values_strings = Attribute.values_strings.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(values_strings).map(String[]::clone); } - + public java.util.Optional keys_int64s() { long[] keys_int64s = Attribute.keys_int64s.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(keys_int64s).map(long[]::clone); } - + public java.util.Optional keys_tensor() { Tensor keys_tensor = Attribute.keys_tensor.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(keys_tensor); } - + public java.util.Optional keys_strings() { String[] keys_strings = Attribute.keys_strings.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(keys_strings).map(String[]::clone); } - + public java.util.Optional default_float() { Float default_float = Attribute.default_float.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(default_float); } - + public java.util.Optional keys_floats() { float[] keys_floats = Attribute.keys_floats.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(keys_floats).map(float[]::clone); } - + public java.util.Optional default_tensor() { Tensor default_tensor = Attribute.default_tensor.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(default_tensor); } - + public java.util.Optional default_int64() { Long default_int64 = Attribute.default_int64.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(default_int64); } - + public java.util.Optional values_tensor() { Tensor values_tensor = Attribute.values_tensor.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(values_tensor); } - + public java.util.Optional values_int64s() { long[] values_int64s = Attribute.values_int64s.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(values_int64s).map(long[]::clone); } - + public java.util.Optional default_string() { String default_string = Attribute.default_string.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(default_string); } - + public java.util.Optional values_floats() { float[] values_floats = Attribute.values_floats.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(values_floats).map(float[]::clone); } - + } - + public static LabelEncoder LabelEncoder(CodeType resultType, Value X, java.util.Optional values_strings, java.util.Optional keys_int64s, java.util.Optional keys_tensor, java.util.Optional keys_strings, java.util.Optional default_float, java.util.Optional keys_floats, java.util.Optional default_tensor, java.util.Optional default_int64, java.util.Optional values_tensor, java.util.Optional values_int64s, java.util.Optional default_string, java.util.Optional values_floats) { return new LabelEncoder(resultType, X, values_strings, keys_int64s, keys_tensor, keys_strings, default_float, keys_floats, default_tensor, default_int64, values_tensor, values_int64s, default_string, values_floats); } @@ -14099,105 +14099,105 @@ public static LabelEncoder LabelEncoder(CodeType resultType, Value X, java.util. @OpFactoryHelper.OpDeclaration(LayerNormalization.NAME) public static final class LayerNormalization extends OnnxOp { public static final String NAME = "LayerNormalization"; - + public enum Attribute implements OnnxAttribute { epsilon(Float.class, true, 1.0E-5f), stash_type(Long.class, true, 1), axis(Long.class, true, -1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), U(new OnnxType.TypeVariable("U", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), Scale(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), Mean(TypeConstraint.U.typeVariable(), Quantifier.OPTIONAL), InvStdDev(TypeConstraint.U.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -14205,64 +14205,64 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LayerNormalization(ExternalizedOp def) { super(SCHEMA, def); } - + LayerNormalization(LayerNormalization that, CodeContext cc) { super(that, cc); } - + @Override public LayerNormalization transform(CodeContext cc, CodeTransformer ot) { return new LayerNormalization(this, cc); } - + LayerNormalization(CodeType resultType, Set optionalOutputs, Value X, Value Scale, java.util.Optional B, java.util.Optional epsilon, java.util.Optional stash_type, java.util.Optional axis) { super(SCHEMA, resultType, optionalOutputs, List.of(X, Scale, B), List.of(epsilon, stash_type, axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), Scale(), B())); } - + public Value X() { return operands().get(0); } - + public Value Scale() { return operands().get(1); } - + public java.util.Optional B() { int i = optionalInputArguments.indexOf(InputParameter.B); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional epsilon() { Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(epsilon); } - + public java.util.Optional stash_type() { Long stash_type = Attribute.stash_type.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(stash_type); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static LayerNormalization LayerNormalization(CodeType resultType, Set optionalOutputs, Value X, Value Scale, java.util.Optional B, java.util.Optional epsilon, java.util.Optional stash_type, java.util.Optional axis) { return new LayerNormalization(resultType, optionalOutputs, X, Scale, B, epsilon, stash_type, axis); } @@ -14270,98 +14270,98 @@ public static LayerNormalization LayerNormalization(CodeType resultType, Set t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -14369,45 +14369,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LeakyRelu(ExternalizedOp def) { super(SCHEMA, def); } - + LeakyRelu(LeakyRelu that, CodeContext cc) { super(that, cc); } - + @Override public LeakyRelu transform(CodeContext cc, CodeTransformer ot) { return new LeakyRelu(this, cc); } - + LeakyRelu(CodeType resultType, Value X, java.util.Optional alpha) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional alpha() { Float alpha = Attribute.alpha.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(alpha); } - + } - + public static LeakyRelu LeakyRelu(CodeType resultType, Value X, java.util.Optional alpha) { return new LeakyRelu(resultType, X, alpha); } @@ -14415,74 +14415,74 @@ public static LeakyRelu LeakyRelu(CodeType resultType, Value X, java.util.Option @OpFactoryHelper.OpDeclaration(Less.NAME) public static final class Less extends OnnxOp { public static final String NAME = "Less"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -14490,44 +14490,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Less(ExternalizedOp def) { super(SCHEMA, def); } - + Less(Less that, CodeContext cc) { super(that, cc); } - + @Override public Less transform(CodeContext cc, CodeTransformer ot) { return new Less(this, cc); } - + Less(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static Less Less(CodeType resultType, Value A, Value B) { return new Less(resultType, A, B); } @@ -14535,74 +14535,74 @@ public static Less Less(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(LessOrEqual.NAME) public static final class LessOrEqual extends OnnxOp { public static final String NAME = "LessOrEqual"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -14610,44 +14610,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LessOrEqual(ExternalizedOp def) { super(SCHEMA, def); } - + LessOrEqual(LessOrEqual that, CodeContext cc) { super(that, cc); } - + @Override public LessOrEqual transform(CodeContext cc, CodeTransformer ot) { return new LessOrEqual(this, cc); } - + LessOrEqual(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static LessOrEqual LessOrEqual(CodeType resultType, Value A, Value B) { return new LessOrEqual(resultType, A, B); } @@ -14655,7 +14655,7 @@ public static LessOrEqual LessOrEqual(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(LinearAttention.NAME) public static final class LinearAttention extends OnnxOp { public static final String NAME = "LinearAttention"; - + public enum Attribute implements OnnxAttribute { chunk_size(Long.class, true, 64), update_rule(String.class, true, "gated_delta"), @@ -14663,49 +14663,49 @@ public enum Attribute implements OnnxAttribute { q_num_heads(Long.class, false, null), kv_num_heads(Long.class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float32())))), S(new OnnxType.TypeVariable("S", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { query(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), key(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), @@ -14714,50 +14714,50 @@ public enum InputParameter implements OnnxParameter { decay(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), beta(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), present_state(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -14765,88 +14765,88 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LinearAttention(ExternalizedOp def) { super(SCHEMA, def); } - + LinearAttention(LinearAttention that, CodeContext cc) { super(that, cc); } - + @Override public LinearAttention transform(CodeContext cc, CodeTransformer ot) { return new LinearAttention(this, cc); } - + LinearAttention(CodeType resultType, Value query, Value key, Value value, java.util.Optional past_state, java.util.Optional decay, java.util.Optional beta, java.util.Optional chunk_size, java.util.Optional update_rule, java.util.Optional scale, long q_num_heads, long kv_num_heads) { super(SCHEMA, resultType, Set.of(), List.of(query, key, value, past_state, decay, beta), List.of(chunk_size, update_rule, scale, q_num_heads, kv_num_heads)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(query(), key(), value(), past_state(), decay(), beta())); } - + public Value query() { return operands().get(0); } - + public Value key() { return operands().get(1); } - + public Value value() { return operands().get(2); } - + public java.util.Optional past_state() { int i = optionalInputArguments.indexOf(InputParameter.past_state); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional decay() { int i = optionalInputArguments.indexOf(InputParameter.decay); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional beta() { int i = optionalInputArguments.indexOf(InputParameter.beta); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional chunk_size() { Long chunk_size = Attribute.chunk_size.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(chunk_size); } - + public java.util.Optional update_rule() { String update_rule = Attribute.update_rule.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(update_rule); } - + public java.util.Optional scale() { Float scale = Attribute.scale.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(scale); } - + public long q_num_heads() { long q_num_heads = Attribute.q_num_heads.access(Long.class, onnxAttributes); return q_num_heads; } - + public long kv_num_heads() { long kv_num_heads = Attribute.kv_num_heads.access(Long.class, onnxAttributes); return kv_num_heads; } - + } - + public static LinearAttention LinearAttention(CodeType resultType, Value query, Value key, Value value, java.util.Optional past_state, java.util.Optional decay, java.util.Optional beta, java.util.Optional chunk_size, java.util.Optional update_rule, java.util.Optional scale, long q_num_heads, long kv_num_heads) { return new LinearAttention(resultType, query, key, value, past_state, decay, beta, chunk_size, update_rule, scale, q_num_heads, kv_num_heads); } @@ -14854,7 +14854,7 @@ public static LinearAttention LinearAttention(CodeType resultType, Value query, @OpFactoryHelper.OpDeclaration(LinearClassifier.NAME) public static final class LinearClassifier extends OnnxOp { public static final String NAME = "LinearClassifier"; - + public enum Attribute implements OnnxAttribute { classlabels_ints(long[].class, true, null), post_transform(String.class, true, "NONE"), @@ -14863,96 +14863,96 @@ public enum Attribute implements OnnxAttribute { intercepts(float[].class, true, null), classlabels_strings(String[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), Z(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -14960,70 +14960,70 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LinearClassifier(ExternalizedOp def) { super(SCHEMA, def); } - + LinearClassifier(LinearClassifier that, CodeContext cc) { super(that, cc); } - + @Override public LinearClassifier transform(CodeContext cc, CodeTransformer ot) { return new LinearClassifier(this, cc); } - + LinearClassifier(CodeType resultType, Value X, java.util.Optional classlabels_ints, java.util.Optional post_transform, float[] coefficients, java.util.Optional multi_class, java.util.Optional intercepts, java.util.Optional classlabels_strings) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(classlabels_ints, post_transform, coefficients, multi_class, intercepts, classlabels_strings)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional classlabels_ints() { long[] classlabels_ints = Attribute.classlabels_ints.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(classlabels_ints).map(long[]::clone); } - + public java.util.Optional post_transform() { String post_transform = Attribute.post_transform.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(post_transform); } - + public float[] coefficients() { float[] coefficients = Attribute.coefficients.access(float[].class, onnxAttributes); return coefficients.clone(); } - + public java.util.Optional multi_class() { Long multi_class = Attribute.multi_class.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(multi_class); } - + public java.util.Optional intercepts() { float[] intercepts = Attribute.intercepts.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(intercepts).map(float[]::clone); } - + public java.util.Optional classlabels_strings() { String[] classlabels_strings = Attribute.classlabels_strings.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(classlabels_strings).map(String[]::clone); } - + } - + public static LinearClassifier LinearClassifier(CodeType resultType, Value X, java.util.Optional classlabels_ints, java.util.Optional post_transform, float[] coefficients, java.util.Optional multi_class, java.util.Optional intercepts, java.util.Optional classlabels_strings) { return new LinearClassifier(resultType, X, classlabels_ints, post_transform, coefficients, multi_class, intercepts, classlabels_strings); } @@ -15031,101 +15031,101 @@ public static LinearClassifier LinearClassifier(CodeType resultType, Value X, ja @OpFactoryHelper.OpDeclaration(LinearRegressor.NAME) public static final class LinearRegressor extends OnnxOp { public static final String NAME = "LinearRegressor"; - + public enum Attribute implements OnnxAttribute { post_transform(String.class, true, "NONE"), coefficients(float[].class, true, null), targets(Long.class, true, 1), intercepts(float[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -15133,60 +15133,60 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LinearRegressor(ExternalizedOp def) { super(SCHEMA, def); } - + LinearRegressor(LinearRegressor that, CodeContext cc) { super(that, cc); } - + @Override public LinearRegressor transform(CodeContext cc, CodeTransformer ot) { return new LinearRegressor(this, cc); } - + LinearRegressor(CodeType resultType, Value X, java.util.Optional post_transform, java.util.Optional coefficients, java.util.Optional targets, java.util.Optional intercepts) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(post_transform, coefficients, targets, intercepts)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional post_transform() { String post_transform = Attribute.post_transform.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(post_transform); } - + public java.util.Optional coefficients() { float[] coefficients = Attribute.coefficients.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(coefficients).map(float[]::clone); } - + public java.util.Optional targets() { Long targets = Attribute.targets.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(targets); } - + public java.util.Optional intercepts() { float[] intercepts = Attribute.intercepts.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(intercepts).map(float[]::clone); } - + } - + public static LinearRegressor LinearRegressor(CodeType resultType, Value X, java.util.Optional post_transform, java.util.Optional coefficients, java.util.Optional targets, java.util.Optional intercepts) { return new LinearRegressor(resultType, X, post_transform, coefficients, targets, intercepts); } @@ -15194,72 +15194,72 @@ public static LinearRegressor LinearRegressor(CodeType resultType, Value X, java @OpFactoryHelper.OpDeclaration(Log.NAME) public static final class Log extends OnnxOp { public static final String NAME = "Log"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -15267,40 +15267,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Log(ExternalizedOp def) { super(SCHEMA, def); } - + Log(Log that, CodeContext cc) { super(that, cc); } - + @Override public Log transform(CodeContext cc, CodeTransformer ot) { return new Log(this, cc); } - + Log(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Log Log(CodeType resultType, Value input) { return new Log(resultType, input); } @@ -15308,98 +15308,98 @@ public static Log Log(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(LogSoftmax.NAME) public static final class LogSoftmax extends OnnxOp { public static final String NAME = "LogSoftmax"; - + public enum Attribute implements OnnxAttribute { axis(Long.class, true, -1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -15407,45 +15407,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LogSoftmax(ExternalizedOp def) { super(SCHEMA, def); } - + LogSoftmax(LogSoftmax that, CodeContext cc) { super(that, cc); } - + @Override public LogSoftmax transform(CodeContext cc, CodeTransformer ot) { return new LogSoftmax(this, cc); } - + LogSoftmax(CodeType resultType, Value input, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static LogSoftmax LogSoftmax(CodeType resultType, Value input, java.util.Optional axis) { return new LogSoftmax(resultType, input, axis); } @@ -15453,99 +15453,99 @@ public static LogSoftmax LogSoftmax(CodeType resultType, Value input, java.util. @OpFactoryHelper.OpDeclaration(LpNormalization.NAME) public static final class LpNormalization extends OnnxOp { public static final String NAME = "LpNormalization"; - + public enum Attribute implements OnnxAttribute { p(Long.class, true, 2), axis(Long.class, true, -1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -15553,50 +15553,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LpNormalization(ExternalizedOp def) { super(SCHEMA, def); } - + LpNormalization(LpNormalization that, CodeContext cc) { super(that, cc); } - + @Override public LpNormalization transform(CodeContext cc, CodeTransformer ot) { return new LpNormalization(this, cc); } - + LpNormalization(CodeType resultType, Value input, java.util.Optional p, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(p, axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional p() { Long p = Attribute.p.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(p); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static LpNormalization LpNormalization(CodeType resultType, Value input, java.util.Optional p, java.util.Optional axis) { return new LpNormalization(resultType, input, p, axis); } @@ -15604,7 +15604,7 @@ public static LpNormalization LpNormalization(CodeType resultType, Value input, @OpFactoryHelper.OpDeclaration(LpPool.NAME) public static final class LpPool extends OnnxOp { public static final String NAME = "LpPool"; - + public enum Attribute implements OnnxAttribute { p(Long.class, true, 2), pads(long[].class, true, null), @@ -15614,94 +15614,94 @@ public enum Attribute implements OnnxAttribute { strides(long[].class, true, null), kernel_shape(long[].class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -15709,75 +15709,75 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public LpPool(ExternalizedOp def) { super(SCHEMA, def); } - + LpPool(LpPool that, CodeContext cc) { super(that, cc); } - + @Override public LpPool transform(CodeContext cc, CodeTransformer ot) { return new LpPool(this, cc); } - + LpPool(CodeType resultType, Value X, java.util.Optional p, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional ceil_mode, java.util.Optional strides, long[] kernel_shape) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(p, pads, dilations, auto_pad, ceil_mode, strides, kernel_shape)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional p() { Long p = Attribute.p.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(p); } - + public java.util.Optional pads() { long[] pads = Attribute.pads.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(pads).map(long[]::clone); } - + public java.util.Optional dilations() { long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(dilations).map(long[]::clone); } - + public java.util.Optional auto_pad() { String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(auto_pad); } - + public java.util.Optional ceil_mode() { Long ceil_mode = Attribute.ceil_mode.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(ceil_mode); } - + public java.util.Optional strides() { long[] strides = Attribute.strides.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(strides).map(long[]::clone); } - + public long[] kernel_shape() { long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes); return kernel_shape.clone(); } - + } - + public static LpPool LpPool(CodeType resultType, Value X, java.util.Optional p, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional ceil_mode, java.util.Optional strides, long[] kernel_shape) { return new LpPool(resultType, X, p, pads, dilations, auto_pad, ceil_mode, strides, kernel_shape); } @@ -15785,73 +15785,73 @@ public static LpPool LpPool(CodeType resultType, Value X, java.util.Optional onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static MatMul MatMul(CodeType resultType, Value A, Value B) { return new MatMul(resultType, A, B); } @@ -15904,77 +15904,77 @@ public static MatMul MatMul(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(MatMulInteger.NAME) public static final class MatMulInteger extends OnnxOp { public static final String NAME = "MatMulInteger"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), a_zero_point(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL), b_zero_point(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -15982,54 +15982,54 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public MatMulInteger(ExternalizedOp def) { super(SCHEMA, def); } - + MatMulInteger(MatMulInteger that, CodeContext cc) { super(that, cc); } - + @Override public MatMulInteger transform(CodeContext cc, CodeTransformer ot) { return new MatMulInteger(this, cc); } - + MatMulInteger(CodeType resultType, Value A, Value B, java.util.Optional a_zero_point, java.util.Optional b_zero_point) { super(SCHEMA, resultType, Set.of(), List.of(A, B, a_zero_point, b_zero_point), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B(), a_zero_point(), b_zero_point())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + public java.util.Optional a_zero_point() { int i = optionalInputArguments.indexOf(InputParameter.a_zero_point); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional b_zero_point() { int i = optionalInputArguments.indexOf(InputParameter.b_zero_point); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + } - + public static MatMulInteger MatMulInteger(CodeType resultType, Value A, Value B, java.util.Optional a_zero_point, java.util.Optional b_zero_point) { return new MatMulInteger(resultType, A, B, a_zero_point, b_zero_point); } @@ -16037,72 +16037,72 @@ public static MatMulInteger MatMulInteger(CodeType resultType, Value A, Value B, @OpFactoryHelper.OpDeclaration(Max.NAME) public static final class Max extends OnnxOp { public static final String NAME = "Max"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data_0(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { max(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -16110,40 +16110,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Max(ExternalizedOp def) { super(SCHEMA, def); } - + Max(Max that, CodeContext cc) { super(that, cc); } - + @Override public Max transform(CodeContext cc, CodeTransformer ot) { return new Max(this, cc); } - + Max(CodeType resultType, List data_0) { super(SCHEMA, resultType, Set.of(), List.of(data_0), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data_0())); } - + public List data_0() { return operands(); } - + } - + public static Max Max(CodeType resultType, List data_0) { return new Max(resultType, data_0); } @@ -16151,7 +16151,7 @@ public static Max Max(CodeType resultType, List data_0) { @OpFactoryHelper.OpDeclaration(MaxPool.NAME) public static final class MaxPool extends OnnxOp { public static final String NAME = "MaxPool"; - + public enum Attribute implements OnnxAttribute { pads(long[].class, true, null), dilations(long[].class, true, null), @@ -16161,96 +16161,96 @@ public enum Attribute implements OnnxAttribute { strides(long[].class, true, null), kernel_shape(long[].class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))), I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), Indices(TypeConstraint.I.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -16258,75 +16258,75 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public MaxPool(ExternalizedOp def) { super(SCHEMA, def); } - + MaxPool(MaxPool that, CodeContext cc) { super(that, cc); } - + @Override public MaxPool transform(CodeContext cc, CodeTransformer ot) { return new MaxPool(this, cc); } - + MaxPool(CodeType resultType, Set optionalOutputs, Value X, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional ceil_mode, java.util.Optional storage_order, java.util.Optional strides, long[] kernel_shape) { super(SCHEMA, resultType, optionalOutputs, List.of(X), List.of(pads, dilations, auto_pad, ceil_mode, storage_order, strides, kernel_shape)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional pads() { long[] pads = Attribute.pads.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(pads).map(long[]::clone); } - + public java.util.Optional dilations() { long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(dilations).map(long[]::clone); } - + public java.util.Optional auto_pad() { String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(auto_pad); } - + public java.util.Optional ceil_mode() { Long ceil_mode = Attribute.ceil_mode.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(ceil_mode); } - + public java.util.Optional storage_order() { Long storage_order = Attribute.storage_order.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(storage_order); } - + public java.util.Optional strides() { long[] strides = Attribute.strides.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(strides).map(long[]::clone); } - + public long[] kernel_shape() { long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes); return kernel_shape.clone(); } - + } - + public static MaxPool MaxPool(CodeType resultType, Set optionalOutputs, Value X, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional ceil_mode, java.util.Optional storage_order, java.util.Optional strides, long[] kernel_shape) { return new MaxPool(resultType, optionalOutputs, X, pads, dilations, auto_pad, ceil_mode, storage_order, strides, kernel_shape); } @@ -16334,100 +16334,100 @@ public static MaxPool MaxPool(CodeType resultType, Set @OpFactoryHelper.OpDeclaration(MaxRoiPool.NAME) public static final class MaxRoiPool extends OnnxOp { public static final String NAME = "MaxRoiPool"; - + public enum Attribute implements OnnxAttribute { spatial_scale(Float.class, true, 1.0f), pooled_shape(long[].class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), rois(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -16435,54 +16435,54 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public MaxRoiPool(ExternalizedOp def) { super(SCHEMA, def); } - + MaxRoiPool(MaxRoiPool that, CodeContext cc) { super(that, cc); } - + @Override public MaxRoiPool transform(CodeContext cc, CodeTransformer ot) { return new MaxRoiPool(this, cc); } - + MaxRoiPool(CodeType resultType, Value X, Value rois, java.util.Optional spatial_scale, long[] pooled_shape) { super(SCHEMA, resultType, Set.of(), List.of(X, rois), List.of(spatial_scale, pooled_shape)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), rois())); } - + public Value X() { return operands().get(0); } - + public Value rois() { return operands().get(1); } - + public java.util.Optional spatial_scale() { Float spatial_scale = Attribute.spatial_scale.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(spatial_scale); } - + public long[] pooled_shape() { long[] pooled_shape = Attribute.pooled_shape.access(long[].class, onnxAttributes); return pooled_shape.clone(); } - + } - + public static MaxRoiPool MaxRoiPool(CodeType resultType, Value X, Value rois, java.util.Optional spatial_scale, long[] pooled_shape) { return new MaxRoiPool(resultType, X, rois, spatial_scale, pooled_shape); } @@ -16490,103 +16490,103 @@ public static MaxRoiPool MaxRoiPool(CodeType resultType, Value X, Value rois, ja @OpFactoryHelper.OpDeclaration(MaxUnpool.NAME) public static final class MaxUnpool extends OnnxOp { public static final String NAME = "MaxUnpool"; - + public enum Attribute implements OnnxAttribute { pads(long[].class, true, null), strides(long[].class, true, null), kernel_shape(long[].class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), I(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), output_shape(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -16594,64 +16594,64 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public MaxUnpool(ExternalizedOp def) { super(SCHEMA, def); } - + MaxUnpool(MaxUnpool that, CodeContext cc) { super(that, cc); } - + @Override public MaxUnpool transform(CodeContext cc, CodeTransformer ot) { return new MaxUnpool(this, cc); } - + MaxUnpool(CodeType resultType, Value X, Value I, java.util.Optional output_shape, java.util.Optional pads, java.util.Optional strides, long[] kernel_shape) { super(SCHEMA, resultType, Set.of(), List.of(X, I, output_shape), List.of(pads, strides, kernel_shape)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), I(), output_shape())); } - + public Value X() { return operands().get(0); } - + public Value I() { return operands().get(1); } - + public java.util.Optional output_shape() { int i = optionalInputArguments.indexOf(InputParameter.output_shape); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional pads() { long[] pads = Attribute.pads.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(pads).map(long[]::clone); } - + public java.util.Optional strides() { long[] strides = Attribute.strides.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(strides).map(long[]::clone); } - + public long[] kernel_shape() { long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes); return kernel_shape.clone(); } - + } - + public static MaxUnpool MaxUnpool(CodeType resultType, Value X, Value I, java.util.Optional output_shape, java.util.Optional pads, java.util.Optional strides, long[] kernel_shape) { return new MaxUnpool(resultType, X, I, output_shape, pads, strides, kernel_shape); } @@ -16659,72 +16659,72 @@ public static MaxUnpool MaxUnpool(CodeType resultType, Value X, Value I, java.ut @OpFactoryHelper.OpDeclaration(Mean.NAME) public static final class Mean extends OnnxOp { public static final String NAME = "Mean"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data_0(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { mean(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -16732,40 +16732,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Mean(ExternalizedOp def) { super(SCHEMA, def); } - + Mean(Mean that, CodeContext cc) { super(that, cc); } - + @Override public Mean transform(CodeContext cc, CodeTransformer ot) { return new Mean(this, cc); } - + Mean(CodeType resultType, List data_0) { super(SCHEMA, resultType, Set.of(), List.of(data_0), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data_0())); } - + public List data_0() { return operands(); } - + } - + public static Mean Mean(CodeType resultType, List data_0) { return new Mean(resultType, data_0); } @@ -16773,98 +16773,98 @@ public static Mean Mean(CodeType resultType, List data_0) { @OpFactoryHelper.OpDeclaration(MeanVarianceNormalization.NAME) public static final class MeanVarianceNormalization extends OnnxOp { public static final String NAME = "MeanVarianceNormalization"; - + public enum Attribute implements OnnxAttribute { axes(long[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -16872,45 +16872,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public MeanVarianceNormalization(ExternalizedOp def) { super(SCHEMA, def); } - + MeanVarianceNormalization(MeanVarianceNormalization that, CodeContext cc) { super(that, cc); } - + @Override public MeanVarianceNormalization transform(CodeContext cc, CodeTransformer ot) { return new MeanVarianceNormalization(this, cc); } - + MeanVarianceNormalization(CodeType resultType, Value X, java.util.Optional axes) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(axes)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional axes() { long[] axes = Attribute.axes.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(axes).map(long[]::clone); } - + } - + public static MeanVarianceNormalization MeanVarianceNormalization(CodeType resultType, Value X, java.util.Optional axes) { return new MeanVarianceNormalization(resultType, X, axes); } @@ -16918,54 +16918,54 @@ public static MeanVarianceNormalization MeanVarianceNormalization(CodeType resul @OpFactoryHelper.OpDeclaration(MelWeightMatrix.NAME) public static final class MelWeightMatrix extends OnnxOp { public static final String NAME = "MelWeightMatrix"; - + public enum Attribute implements OnnxAttribute { output_datatype(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { num_mel_bins(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), dft_length(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), @@ -16973,49 +16973,49 @@ public enum InputParameter implements OnnxParameter { lower_edge_hertz(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), upper_edge_hertz(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -17023,61 +17023,61 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public MelWeightMatrix(ExternalizedOp def) { super(SCHEMA, def); } - + MelWeightMatrix(MelWeightMatrix that, CodeContext cc) { super(that, cc); } - + @Override public MelWeightMatrix transform(CodeContext cc, CodeTransformer ot) { return new MelWeightMatrix(this, cc); } - + MelWeightMatrix(CodeType resultType, Value num_mel_bins, Value dft_length, Value sample_rate, Value lower_edge_hertz, Value upper_edge_hertz, java.util.Optional output_datatype) { super(SCHEMA, resultType, Set.of(), List.of(num_mel_bins, dft_length, sample_rate, lower_edge_hertz, upper_edge_hertz), List.of(output_datatype)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(num_mel_bins(), dft_length(), sample_rate(), lower_edge_hertz(), upper_edge_hertz())); } - + public Value num_mel_bins() { return operands().get(0); } - + public Value dft_length() { return operands().get(1); } - + public Value sample_rate() { return operands().get(2); } - + public Value lower_edge_hertz() { return operands().get(3); } - + public Value upper_edge_hertz() { return operands().get(4); } - + public java.util.Optional output_datatype() { Long output_datatype = Attribute.output_datatype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(output_datatype); } - + } - + public static MelWeightMatrix MelWeightMatrix(CodeType resultType, Value num_mel_bins, Value dft_length, Value sample_rate, Value lower_edge_hertz, Value upper_edge_hertz, java.util.Optional output_datatype) { return new MelWeightMatrix(resultType, num_mel_bins, dft_length, sample_rate, lower_edge_hertz, upper_edge_hertz, output_datatype); } @@ -17085,72 +17085,72 @@ public static MelWeightMatrix MelWeightMatrix(CodeType resultType, Value num_mel @OpFactoryHelper.OpDeclaration(Min.NAME) public static final class Min extends OnnxOp { public static final String NAME = "Min"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data_0(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { min(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -17158,40 +17158,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Min(ExternalizedOp def) { super(SCHEMA, def); } - + Min(Min that, CodeContext cc) { super(that, cc); } - + @Override public Min transform(CodeContext cc, CodeTransformer ot) { return new Min(this, cc); } - + Min(CodeType resultType, List data_0) { super(SCHEMA, resultType, Set.of(), List.of(data_0), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data_0())); } - + public List data_0() { return operands(); } - + } - + public static Min Min(CodeType resultType, List data_0) { return new Min(resultType, data_0); } @@ -17199,72 +17199,72 @@ public static Min Min(CodeType resultType, List data_0) { @OpFactoryHelper.OpDeclaration(Mish.NAME) public static final class Mish extends OnnxOp { public static final String NAME = "Mish"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -17272,40 +17272,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Mish(ExternalizedOp def) { super(SCHEMA, def); } - + Mish(Mish that, CodeContext cc) { super(that, cc); } - + @Override public Mish transform(CodeContext cc, CodeTransformer ot) { return new Mish(this, cc); } - + Mish(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Mish Mish(CodeType resultType, Value X) { return new Mish(resultType, X); } @@ -17313,99 +17313,99 @@ public static Mish Mish(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(Mod.NAME) public static final class Mod extends OnnxOp { public static final String NAME = "Mod"; - + public enum Attribute implements OnnxAttribute { fmod(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -17413,49 +17413,49 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Mod(ExternalizedOp def) { super(SCHEMA, def); } - + Mod(Mod that, CodeContext cc) { super(that, cc); } - + @Override public Mod transform(CodeContext cc, CodeTransformer ot) { return new Mod(this, cc); } - + Mod(CodeType resultType, Value A, Value B, java.util.Optional fmod) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of(fmod)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + public java.util.Optional fmod() { Long fmod = Attribute.fmod.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(fmod); } - + } - + public static Mod Mod(CodeType resultType, Value A, Value B, java.util.Optional fmod) { return new Mod(resultType, A, B, fmod); } @@ -17463,105 +17463,105 @@ public static Mod Mod(CodeType resultType, Value A, Value B, java.util.Optional< @OpFactoryHelper.OpDeclaration(Momentum.NAME) public static final class Momentum extends OnnxOp { public static final String NAME = "Momentum"; - + public enum Attribute implements OnnxAttribute { mode(String.class, false, null), norm_coefficient(Float.class, false, null), alpha(Float.class, false, null), beta(Float.class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { R(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), T(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), inputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { outputs(TypeConstraint.T3.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -17569,68 +17569,68 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Momentum(ExternalizedOp def) { super(SCHEMA, def); } - + Momentum(Momentum that, CodeContext cc) { super(that, cc); } - + @Override public Momentum transform(CodeContext cc, CodeTransformer ot) { return new Momentum(this, cc); } - + Momentum(CodeType resultType, Value R, Value T, List inputs, String mode, float norm_coefficient, float alpha, float beta) { super(SCHEMA, resultType, Set.of(), List.of(R, T, inputs), List.of(mode, norm_coefficient, alpha, beta)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(R(), T(), inputs())); } - + public Value R() { return operands().get(0); } - + public Value T() { return operands().get(1); } - + public List inputs() { return operands().subList(2, operands().size()); } - + public String mode() { String mode = Attribute.mode.access(String.class, onnxAttributes); return mode; } - + public float norm_coefficient() { float norm_coefficient = Attribute.norm_coefficient.access(Float.class, onnxAttributes); return norm_coefficient; } - + public float alpha() { float alpha = Attribute.alpha.access(Float.class, onnxAttributes); return alpha; } - + public float beta() { float beta = Attribute.beta.access(Float.class, onnxAttributes); return beta; } - + } - + public static Momentum Momentum(CodeType resultType, Value R, Value T, List inputs, String mode, float norm_coefficient, float alpha, float beta) { return new Momentum(resultType, R, T, inputs, mode, norm_coefficient, alpha, beta); } @@ -17638,73 +17638,73 @@ public static Momentum Momentum(CodeType resultType, Value R, Value T, List onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static Mul Mul(CodeType resultType, Value A, Value B) { return new Mul(resultType, A, B); } @@ -17757,101 +17757,101 @@ public static Mul Mul(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(Multinomial.NAME) public static final class Multinomial extends OnnxOp { public static final String NAME = "Multinomial"; - + public enum Attribute implements OnnxAttribute { seed(Float.class, true, null), sample_size(Long.class, true, 1), dtype(Long.class, true, 6), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -17859,55 +17859,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Multinomial(ExternalizedOp def) { super(SCHEMA, def); } - + Multinomial(Multinomial that, CodeContext cc) { super(that, cc); } - + @Override public Multinomial transform(CodeContext cc, CodeTransformer ot) { return new Multinomial(this, cc); } - + Multinomial(CodeType resultType, Value input, java.util.Optional seed, java.util.Optional sample_size, java.util.Optional dtype) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(seed, sample_size, dtype)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional seed() { Float seed = Attribute.seed.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(seed); } - + public java.util.Optional sample_size() { Long sample_size = Attribute.sample_size.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(sample_size); } - + public java.util.Optional dtype() { Long dtype = Attribute.dtype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(dtype); } - + } - + public static Multinomial Multinomial(CodeType resultType, Value input, java.util.Optional seed, java.util.Optional sample_size, java.util.Optional dtype) { return new Multinomial(resultType, input, seed, sample_size, dtype); } @@ -17915,72 +17915,72 @@ public static Multinomial Multinomial(CodeType resultType, Value input, java.uti @OpFactoryHelper.OpDeclaration(Neg.NAME) public static final class Neg extends OnnxOp { public static final String NAME = "Neg"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -17988,40 +17988,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Neg(ExternalizedOp def) { super(SCHEMA, def); } - + Neg(Neg that, CodeContext cc) { super(that, cc); } - + @Override public Neg transform(CodeContext cc, CodeTransformer ot) { return new Neg(this, cc); } - + Neg(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Neg Neg(CodeType resultType, Value X) { return new Neg(resultType, X); } @@ -18029,102 +18029,102 @@ public static Neg Neg(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(NegativeLogLikelihoodLoss.NAME) public static final class NegativeLogLikelihoodLoss extends OnnxOp { public static final String NAME = "NegativeLogLikelihoodLoss"; - + public enum Attribute implements OnnxAttribute { ignore_index(Long.class, true, null), reduction(String.class, true, "mean"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), target(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED), weight(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { loss(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -18132,59 +18132,59 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public NegativeLogLikelihoodLoss(ExternalizedOp def) { super(SCHEMA, def); } - + NegativeLogLikelihoodLoss(NegativeLogLikelihoodLoss that, CodeContext cc) { super(that, cc); } - + @Override public NegativeLogLikelihoodLoss transform(CodeContext cc, CodeTransformer ot) { return new NegativeLogLikelihoodLoss(this, cc); } - + NegativeLogLikelihoodLoss(CodeType resultType, Value input, Value target, java.util.Optional weight, java.util.Optional ignore_index, java.util.Optional reduction) { super(SCHEMA, resultType, Set.of(), List.of(input, target, weight), List.of(ignore_index, reduction)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), target(), weight())); } - + public Value input() { return operands().get(0); } - + public Value target() { return operands().get(1); } - + public java.util.Optional weight() { int i = optionalInputArguments.indexOf(InputParameter.weight); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional ignore_index() { Long ignore_index = Attribute.ignore_index.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(ignore_index); } - + public java.util.Optional reduction() { String reduction = Attribute.reduction.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(reduction); } - + } - + public static NegativeLogLikelihoodLoss NegativeLogLikelihoodLoss(CodeType resultType, Value input, Value target, java.util.Optional weight, java.util.Optional ignore_index, java.util.Optional reduction) { return new NegativeLogLikelihoodLoss(resultType, input, target, weight, ignore_index, reduction); } @@ -18192,37 +18192,37 @@ public static NegativeLogLikelihoodLoss NegativeLogLikelihoodLoss(CodeType resul @OpFactoryHelper.OpDeclaration(NonMaxSuppression.NAME) public static final class NonMaxSuppression extends OnnxOp { public static final String NAME = "NonMaxSuppression"; - + public enum Attribute implements OnnxAttribute { center_point_box(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint.None { } - + public enum InputParameter implements OnnxParameter { boxes(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), scores(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), @@ -18230,49 +18230,49 @@ public enum InputParameter implements OnnxParameter { iou_threshold(OnnxType.tensor(OnnxType.float32()), Quantifier.OPTIONAL), score_threshold(OnnxType.tensor(OnnxType.float32()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { selected_indices(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -18280,64 +18280,64 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public NonMaxSuppression(ExternalizedOp def) { super(SCHEMA, def); } - + NonMaxSuppression(NonMaxSuppression that, CodeContext cc) { super(that, cc); } - + @Override public NonMaxSuppression transform(CodeContext cc, CodeTransformer ot) { return new NonMaxSuppression(this, cc); } - + NonMaxSuppression(CodeType resultType, Value boxes, Value scores, java.util.Optional max_output_boxes_per_class, java.util.Optional iou_threshold, java.util.Optional score_threshold, java.util.Optional center_point_box) { super(SCHEMA, resultType, Set.of(), List.of(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold), List.of(center_point_box)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(boxes(), scores(), max_output_boxes_per_class(), iou_threshold(), score_threshold())); } - + public Value boxes() { return operands().get(0); } - + public Value scores() { return operands().get(1); } - + public java.util.Optional max_output_boxes_per_class() { int i = optionalInputArguments.indexOf(InputParameter.max_output_boxes_per_class); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional iou_threshold() { int i = optionalInputArguments.indexOf(InputParameter.iou_threshold); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional score_threshold() { int i = optionalInputArguments.indexOf(InputParameter.score_threshold); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional center_point_box() { Long center_point_box = Attribute.center_point_box.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(center_point_box); } - + } - + public static NonMaxSuppression NonMaxSuppression(CodeType resultType, Value boxes, Value scores, java.util.Optional max_output_boxes_per_class, java.util.Optional iou_threshold, java.util.Optional score_threshold, java.util.Optional center_point_box) { return new NonMaxSuppression(resultType, boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold, center_point_box); } @@ -18345,72 +18345,72 @@ public static NonMaxSuppression NonMaxSuppression(CodeType resultType, Value box @OpFactoryHelper.OpDeclaration(NonZero.NAME) public static final class NonZero extends OnnxOp { public static final String NAME = "NonZero"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -18418,40 +18418,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public NonZero(ExternalizedOp def) { super(SCHEMA, def); } - + NonZero(NonZero that, CodeContext cc) { super(that, cc); } - + @Override public NonZero transform(CodeContext cc, CodeTransformer ot) { return new NonZero(this, cc); } - + NonZero(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static NonZero NonZero(CodeType resultType, Value X) { return new NonZero(resultType, X); } @@ -18459,98 +18459,98 @@ public static NonZero NonZero(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(Normalizer.NAME) public static final class Normalizer extends OnnxOp { public static final String NAME = "Normalizer"; - + public enum Attribute implements OnnxAttribute { norm(String.class, true, "MAX"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -18558,45 +18558,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Normalizer(ExternalizedOp def) { super(SCHEMA, def); } - + Normalizer(Normalizer that, CodeContext cc) { super(that, cc); } - + @Override public Normalizer transform(CodeContext cc, CodeTransformer ot) { return new Normalizer(this, cc); } - + Normalizer(CodeType resultType, Value X, java.util.Optional norm) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(norm)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional norm() { String norm = Attribute.norm.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(norm); } - + } - + public static Normalizer Normalizer(CodeType resultType, Value X, java.util.Optional norm) { return new Normalizer(resultType, X, norm); } @@ -18604,72 +18604,72 @@ public static Normalizer Normalizer(CodeType resultType, Value X, java.util.Opti @OpFactoryHelper.OpDeclaration(Not.NAME) public static final class Not extends OnnxOp { public static final String NAME = "Not"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -18677,40 +18677,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Not(ExternalizedOp def) { super(SCHEMA, def); } - + Not(Not that, CodeContext cc) { super(that, cc); } - + @Override public Not transform(CodeContext cc, CodeTransformer ot) { return new Not(this, cc); } - + Not(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Not Not(CodeType resultType, Value X) { return new Not(resultType, X); } @@ -18718,102 +18718,102 @@ public static Not Not(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(OneHot.NAME) public static final class OneHot extends OnnxOp { public static final String NAME = "OneHot"; - + public enum Attribute implements OnnxAttribute { axis(Long.class, true, -1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { indices(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), depth(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), values(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -18821,53 +18821,53 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public OneHot(ExternalizedOp def) { super(SCHEMA, def); } - + OneHot(OneHot that, CodeContext cc) { super(that, cc); } - + @Override public OneHot transform(CodeContext cc, CodeTransformer ot) { return new OneHot(this, cc); } - + OneHot(CodeType resultType, Value indices, Value depth, Value values, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(indices, depth, values), List.of(axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(indices(), depth(), values())); } - + public Value indices() { return operands().get(0); } - + public Value depth() { return operands().get(1); } - + public Value values() { return operands().get(2); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static OneHot OneHot(CodeType resultType, Value indices, Value depth, Value values, java.util.Optional axis) { return new OneHot(resultType, indices, depth, values, axis); } @@ -18875,100 +18875,100 @@ public static OneHot OneHot(CodeType resultType, Value indices, Value depth, Val @OpFactoryHelper.OpDeclaration(OneHotEncoder.NAME) public static final class OneHotEncoder extends OnnxOp { public static final String NAME = "OneHotEncoder"; - + public enum Attribute implements OnnxAttribute { cats_strings(String[].class, true, null), cats_int64s(long[].class, true, null), zeros(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -18976,55 +18976,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public OneHotEncoder(ExternalizedOp def) { super(SCHEMA, def); } - + OneHotEncoder(OneHotEncoder that, CodeContext cc) { super(that, cc); } - + @Override public OneHotEncoder transform(CodeContext cc, CodeTransformer ot) { return new OneHotEncoder(this, cc); } - + OneHotEncoder(CodeType resultType, Value X, java.util.Optional cats_strings, java.util.Optional cats_int64s, java.util.Optional zeros) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(cats_strings, cats_int64s, zeros)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional cats_strings() { String[] cats_strings = Attribute.cats_strings.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(cats_strings).map(String[]::clone); } - + public java.util.Optional cats_int64s() { long[] cats_int64s = Attribute.cats_int64s.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(cats_int64s).map(long[]::clone); } - + public java.util.Optional zeros() { Long zeros = Attribute.zeros.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(zeros); } - + } - + public static OneHotEncoder OneHotEncoder(CodeType resultType, Value X, java.util.Optional cats_strings, java.util.Optional cats_int64s, java.util.Optional zeros) { return new OneHotEncoder(resultType, X, cats_strings, cats_int64s, zeros); } @@ -19032,99 +19032,99 @@ public static OneHotEncoder OneHotEncoder(CodeType resultType, Value X, java.uti @OpFactoryHelper.OpDeclaration(Optional.NAME) public static final class Optional extends OnnxOp { public static final String NAME = "Optional"; - + public enum Attribute implements OnnxAttribute { type(Object.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { V(new OnnxType.TypeVariable("V", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), O(new OnnxType.TypeVariable("O", List.of(OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.string()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.bool()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))), OnnxType.optional(OnnxType.tensor(OnnxType.uint8())), OnnxType.optional(OnnxType.tensor(OnnxType.uint16())), OnnxType.optional(OnnxType.tensor(OnnxType.uint32())), OnnxType.optional(OnnxType.tensor(OnnxType.uint64())), OnnxType.optional(OnnxType.tensor(OnnxType.int8())), OnnxType.optional(OnnxType.tensor(OnnxType.int16())), OnnxType.optional(OnnxType.tensor(OnnxType.int32())), OnnxType.optional(OnnxType.tensor(OnnxType.int64())), OnnxType.optional(OnnxType.tensor(OnnxType.float16())), OnnxType.optional(OnnxType.tensor(OnnxType.float32())), OnnxType.optional(OnnxType.tensor(OnnxType.float64())), OnnxType.optional(OnnxType.tensor(OnnxType.string())), OnnxType.optional(OnnxType.tensor(OnnxType.bool())), OnnxType.optional(OnnxType.tensor(OnnxType.complex64())), OnnxType.optional(OnnxType.tensor(OnnxType.complex128()))))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.V.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.O.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -19132,46 +19132,46 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Optional(ExternalizedOp def) { super(SCHEMA, def); } - + Optional(Optional that, CodeContext cc) { super(that, cc); } - + @Override public Optional transform(CodeContext cc, CodeTransformer ot) { return new Optional(this, cc); } - + Optional(CodeType resultType, java.util.Optional input, java.util.Optional type) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(type)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public java.util.Optional input() { int i = optionalInputArguments.indexOf(InputParameter.input); return i != -1 ? java.util.Optional.of(operands().get(0 + i)) : java.util.Optional.empty(); } - + public java.util.Optional type() { Object type = Attribute.type.access(Object.class, onnxAttributes); return java.util.Optional.ofNullable(type); } - + } - + public static Optional Optional(CodeType resultType, java.util.Optional input, java.util.Optional type) { return new Optional(resultType, input, type); } @@ -19179,73 +19179,73 @@ public static Optional Optional(CodeType resultType, java.util.Optional i @OpFactoryHelper.OpDeclaration(OptionalGetElement.NAME) public static final class OptionalGetElement extends OnnxOp { public static final String NAME = "OptionalGetElement"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { O(new OnnxType.TypeVariable("O", List.of(OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.string()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.bool()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))), OnnxType.optional(OnnxType.tensor(OnnxType.uint8())), OnnxType.optional(OnnxType.tensor(OnnxType.uint16())), OnnxType.optional(OnnxType.tensor(OnnxType.uint32())), OnnxType.optional(OnnxType.tensor(OnnxType.uint64())), OnnxType.optional(OnnxType.tensor(OnnxType.int8())), OnnxType.optional(OnnxType.tensor(OnnxType.int16())), OnnxType.optional(OnnxType.tensor(OnnxType.int32())), OnnxType.optional(OnnxType.tensor(OnnxType.int64())), OnnxType.optional(OnnxType.tensor(OnnxType.float16())), OnnxType.optional(OnnxType.tensor(OnnxType.float32())), OnnxType.optional(OnnxType.tensor(OnnxType.float64())), OnnxType.optional(OnnxType.tensor(OnnxType.string())), OnnxType.optional(OnnxType.tensor(OnnxType.bool())), OnnxType.optional(OnnxType.tensor(OnnxType.complex64())), OnnxType.optional(OnnxType.tensor(OnnxType.complex128())), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), V(new OnnxType.TypeVariable("V", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.O.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.V.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -19253,40 +19253,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public OptionalGetElement(ExternalizedOp def) { super(SCHEMA, def); } - + OptionalGetElement(OptionalGetElement that, CodeContext cc) { super(that, cc); } - + @Override public OptionalGetElement transform(CodeContext cc, CodeTransformer ot) { return new OptionalGetElement(this, cc); } - + OptionalGetElement(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static OptionalGetElement OptionalGetElement(CodeType resultType, Value input) { return new OptionalGetElement(resultType, input); } @@ -19294,73 +19294,73 @@ public static OptionalGetElement OptionalGetElement(CodeType resultType, Value i @OpFactoryHelper.OpDeclaration(OptionalHasElement.NAME) public static final class OptionalHasElement extends OnnxOp { public static final String NAME = "OptionalHasElement"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { O(new OnnxType.TypeVariable("O", List.of(OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.uint64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int8()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.int64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float16()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float32()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.float64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.string()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.bool()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex64()))), OnnxType.optional(OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))), OnnxType.optional(OnnxType.tensor(OnnxType.uint8())), OnnxType.optional(OnnxType.tensor(OnnxType.uint16())), OnnxType.optional(OnnxType.tensor(OnnxType.uint32())), OnnxType.optional(OnnxType.tensor(OnnxType.uint64())), OnnxType.optional(OnnxType.tensor(OnnxType.int8())), OnnxType.optional(OnnxType.tensor(OnnxType.int16())), OnnxType.optional(OnnxType.tensor(OnnxType.int32())), OnnxType.optional(OnnxType.tensor(OnnxType.int64())), OnnxType.optional(OnnxType.tensor(OnnxType.float16())), OnnxType.optional(OnnxType.tensor(OnnxType.float32())), OnnxType.optional(OnnxType.tensor(OnnxType.float64())), OnnxType.optional(OnnxType.tensor(OnnxType.string())), OnnxType.optional(OnnxType.tensor(OnnxType.bool())), OnnxType.optional(OnnxType.tensor(OnnxType.complex64())), OnnxType.optional(OnnxType.tensor(OnnxType.complex128())), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), B(new OnnxType.TypeVariable("B", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.O.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.B.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -19368,41 +19368,41 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public OptionalHasElement(ExternalizedOp def) { super(SCHEMA, def); } - + OptionalHasElement(OptionalHasElement that, CodeContext cc) { super(that, cc); } - + @Override public OptionalHasElement transform(CodeContext cc, CodeTransformer ot) { return new OptionalHasElement(this, cc); } - + OptionalHasElement(CodeType resultType, java.util.Optional input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public java.util.Optional input() { int i = optionalInputArguments.indexOf(InputParameter.input); return i != -1 ? java.util.Optional.of(operands().get(0 + i)) : java.util.Optional.empty(); } - + } - + public static OptionalHasElement OptionalHasElement(CodeType resultType, java.util.Optional input) { return new OptionalHasElement(resultType, input); } @@ -19410,74 +19410,74 @@ public static OptionalHasElement OptionalHasElement(CodeType resultType, java.ut @OpFactoryHelper.OpDeclaration(Or.NAME) public static final class Or extends OnnxOp { public static final String NAME = "Or"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bool())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -19485,44 +19485,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Or(ExternalizedOp def) { super(SCHEMA, def); } - + Or(Or that, CodeContext cc) { super(that, cc); } - + @Override public Or transform(CodeContext cc, CodeTransformer ot) { return new Or(this, cc); } - + Or(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static Or Or(CodeType resultType, Value A, Value B) { return new Or(resultType, A, B); } @@ -19530,73 +19530,73 @@ public static Or Or(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(PRelu.NAME) public static final class PRelu extends OnnxOp { public static final String NAME = "PRelu"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), slope(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -19604,44 +19604,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public PRelu(ExternalizedOp def) { super(SCHEMA, def); } - + PRelu(PRelu that, CodeContext cc) { super(that, cc); } - + @Override public PRelu transform(CodeContext cc, CodeTransformer ot) { return new PRelu(this, cc); } - + PRelu(CodeType resultType, Value X, Value slope) { super(SCHEMA, resultType, Set.of(), List.of(X, slope), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), slope())); } - + public Value X() { return operands().get(0); } - + public Value slope() { return operands().get(1); } - + } - + public static PRelu PRelu(CodeType resultType, Value X, Value slope) { return new PRelu(resultType, X, slope); } @@ -19649,102 +19649,102 @@ public static PRelu PRelu(CodeType resultType, Value X, Value slope) { @OpFactoryHelper.OpDeclaration(Pad.NAME) public static final class Pad extends OnnxOp { public static final String NAME = "Pad"; - + public enum Attribute implements OnnxAttribute { mode(String.class, true, "constant"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), pads(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), constant_value(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), axes(TypeConstraint.Tind.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -19752,59 +19752,59 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Pad(ExternalizedOp def) { super(SCHEMA, def); } - + Pad(Pad that, CodeContext cc) { super(that, cc); } - + @Override public Pad transform(CodeContext cc, CodeTransformer ot) { return new Pad(this, cc); } - + Pad(CodeType resultType, Value data, Value pads, java.util.Optional constant_value, java.util.Optional axes, java.util.Optional mode) { super(SCHEMA, resultType, Set.of(), List.of(data, pads, constant_value, axes), List.of(mode)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), pads(), constant_value(), axes())); } - + public Value data() { return operands().get(0); } - + public Value pads() { return operands().get(1); } - + public java.util.Optional constant_value() { int i = optionalInputArguments.indexOf(InputParameter.constant_value); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional mode() { String mode = Attribute.mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(mode); } - + } - + public static Pad Pad(CodeType resultType, Value data, Value pads, java.util.Optional constant_value, java.util.Optional axes, java.util.Optional mode) { return new Pad(resultType, data, pads, constant_value, axes, mode); } @@ -19812,74 +19812,74 @@ public static Pad Pad(CodeType resultType, Value data, Value pads, java.util.Opt @OpFactoryHelper.OpDeclaration(Pow.NAME) public static final class Pow extends OnnxOp { public static final String NAME = "Pow"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Z(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -19887,44 +19887,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Pow(ExternalizedOp def) { super(SCHEMA, def); } - + Pow(Pow that, CodeContext cc) { super(that, cc); } - + @Override public Pow transform(CodeContext cc, CodeTransformer ot) { return new Pow(this, cc); } - + Pow(CodeType resultType, Value X, Value Y) { super(SCHEMA, resultType, Set.of(), List.of(X, Y), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), Y())); } - + public Value X() { return operands().get(0); } - + public Value Y() { return operands().get(1); } - + } - + public static Pow Pow(CodeType resultType, Value X, Value Y) { return new Pow(resultType, X, Y); } @@ -19932,7 +19932,7 @@ public static Pow Pow(CodeType resultType, Value X, Value Y) { @OpFactoryHelper.OpDeclaration(QLinearConv.NAME) public static final class QLinearConv extends OnnxOp { public static final String NAME = "QLinearConv"; - + public enum Attribute implements OnnxAttribute { pads(long[].class, true, null), dilations(long[].class, true, null), @@ -19941,51 +19941,51 @@ public enum Attribute implements OnnxAttribute { group(Long.class, true, 1), kernel_shape(long[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8())))), T4(new OnnxType.TypeVariable("T4", List.of(OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { x(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), x_scale(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), @@ -19997,49 +19997,49 @@ public enum InputParameter implements OnnxParameter { y_zero_point(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T4.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -20047,103 +20047,103 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public QLinearConv(ExternalizedOp def) { super(SCHEMA, def); } - + QLinearConv(QLinearConv that, CodeContext cc) { super(that, cc); } - + @Override public QLinearConv transform(CodeContext cc, CodeTransformer ot) { return new QLinearConv(this, cc); } - + QLinearConv(CodeType resultType, Value x, Value x_scale, Value x_zero_point, Value w, Value w_scale, Value w_zero_point, Value y_scale, Value y_zero_point, java.util.Optional B, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional strides, java.util.Optional group, java.util.Optional kernel_shape) { super(SCHEMA, resultType, Set.of(), List.of(x, x_scale, x_zero_point, w, w_scale, w_zero_point, y_scale, y_zero_point, B), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(x(), x_scale(), x_zero_point(), w(), w_scale(), w_zero_point(), y_scale(), y_zero_point(), B())); } - + public Value x() { return operands().get(0); } - + public Value x_scale() { return operands().get(1); } - + public Value x_zero_point() { return operands().get(2); } - + public Value w() { return operands().get(3); } - + public Value w_scale() { return operands().get(4); } - + public Value w_zero_point() { return operands().get(5); } - + public Value y_scale() { return operands().get(6); } - + public Value y_zero_point() { return operands().get(7); } - + public java.util.Optional B() { int i = optionalInputArguments.indexOf(InputParameter.B); return i != -1 ? java.util.Optional.of(operands().get(8 + i)) : java.util.Optional.empty(); } - + public java.util.Optional pads() { long[] pads = Attribute.pads.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(pads).map(long[]::clone); } - + public java.util.Optional dilations() { long[] dilations = Attribute.dilations.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(dilations).map(long[]::clone); } - + public java.util.Optional auto_pad() { String auto_pad = Attribute.auto_pad.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(auto_pad); } - + public java.util.Optional strides() { long[] strides = Attribute.strides.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(strides).map(long[]::clone); } - + public java.util.Optional group() { Long group = Attribute.group.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(group); } - + public java.util.Optional kernel_shape() { long[] kernel_shape = Attribute.kernel_shape.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(kernel_shape).map(long[]::clone); } - + } - + public static QLinearConv QLinearConv(CodeType resultType, Value x, Value x_scale, Value x_zero_point, Value w, Value w_scale, Value w_zero_point, Value y_scale, Value y_zero_point, java.util.Optional B, java.util.Optional pads, java.util.Optional dilations, java.util.Optional auto_pad, java.util.Optional strides, java.util.Optional group, java.util.Optional kernel_shape) { return new QLinearConv(resultType, x, x_scale, x_zero_point, w, w_scale, w_zero_point, y_scale, y_zero_point, B, pads, dilations, auto_pad, strides, group, kernel_shape); } @@ -20151,29 +20151,29 @@ public static QLinearConv QLinearConv(CodeType resultType, Value x, Value x_scal @OpFactoryHelper.OpDeclaration(QLinearMatMul.NAME) public static final class QLinearMatMul extends OnnxOp { public static final String NAME = "QLinearMatMul"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { TS(new OnnxType.TypeVariable("TS", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { a(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), a_scale(TypeConstraint.TS.typeVariable(), Quantifier.REQUIRED), @@ -20184,49 +20184,49 @@ public enum InputParameter implements OnnxParameter { y_scale(TypeConstraint.TS.typeVariable(), Quantifier.REQUIRED), y_zero_point(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -20234,68 +20234,68 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public QLinearMatMul(ExternalizedOp def) { super(SCHEMA, def); } - + QLinearMatMul(QLinearMatMul that, CodeContext cc) { super(that, cc); } - + @Override public QLinearMatMul transform(CodeContext cc, CodeTransformer ot) { return new QLinearMatMul(this, cc); } - + QLinearMatMul(CodeType resultType, Value a, Value a_scale, Value a_zero_point, Value b, Value b_scale, Value b_zero_point, Value y_scale, Value y_zero_point) { super(SCHEMA, resultType, Set.of(), List.of(a, a_scale, a_zero_point, b, b_scale, b_zero_point, y_scale, y_zero_point), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(a(), a_scale(), a_zero_point(), b(), b_scale(), b_zero_point(), y_scale(), y_zero_point())); } - + public Value a() { return operands().get(0); } - + public Value a_scale() { return operands().get(1); } - + public Value a_zero_point() { return operands().get(2); } - + public Value b() { return operands().get(3); } - + public Value b_scale() { return operands().get(4); } - + public Value b_zero_point() { return operands().get(5); } - + public Value y_scale() { return operands().get(6); } - + public Value y_zero_point() { return operands().get(7); } - + } - + public static QLinearMatMul QLinearMatMul(CodeType resultType, Value a, Value a_scale, Value a_zero_point, Value b, Value b_scale, Value b_zero_point, Value y_scale, Value y_zero_point) { return new QLinearMatMul(resultType, a, a_scale, a_zero_point, b, b_scale, b_zero_point, y_scale, y_zero_point); } @@ -20303,7 +20303,7 @@ public static QLinearMatMul QLinearMatMul(CodeType resultType, Value a, Value a_ @OpFactoryHelper.OpDeclaration(QuantizeLinear.NAME) public static final class QuantizeLinear extends OnnxOp { public static final String NAME = "QuantizeLinear"; - + public enum Attribute implements OnnxAttribute { output_dtype(Long.class, true, 0), saturate(Long.class, true, 1), @@ -20311,98 +20311,98 @@ public enum Attribute implements OnnxAttribute { axis(Long.class, true, 1), block_size(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.int32())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.float8e8m0())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { x(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), y_scale(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), y_zero_point(TypeConstraint.T3.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { y(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -20410,74 +20410,74 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public QuantizeLinear(ExternalizedOp def) { super(SCHEMA, def); } - + QuantizeLinear(QuantizeLinear that, CodeContext cc) { super(that, cc); } - + @Override public QuantizeLinear transform(CodeContext cc, CodeTransformer ot) { return new QuantizeLinear(this, cc); } - + QuantizeLinear(CodeType resultType, Value x, Value y_scale, java.util.Optional y_zero_point, java.util.Optional output_dtype, java.util.Optional saturate, java.util.Optional precision, java.util.Optional axis, java.util.Optional block_size) { super(SCHEMA, resultType, Set.of(), List.of(x, y_scale, y_zero_point), List.of(output_dtype, saturate, precision, axis, block_size)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(x(), y_scale(), y_zero_point())); } - + public Value x() { return operands().get(0); } - + public Value y_scale() { return operands().get(1); } - + public java.util.Optional y_zero_point() { int i = optionalInputArguments.indexOf(InputParameter.y_zero_point); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional output_dtype() { Long output_dtype = Attribute.output_dtype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(output_dtype); } - + public java.util.Optional saturate() { Long saturate = Attribute.saturate.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(saturate); } - + public java.util.Optional precision() { Long precision = Attribute.precision.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(precision); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + public java.util.Optional block_size() { Long block_size = Attribute.block_size.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(block_size); } - + } - + public static QuantizeLinear QuantizeLinear(CodeType resultType, Value x, Value y_scale, java.util.Optional y_zero_point, java.util.Optional output_dtype, java.util.Optional saturate, java.util.Optional precision, java.util.Optional axis, java.util.Optional block_size) { return new QuantizeLinear(resultType, x, y_scale, y_zero_point, output_dtype, saturate, precision, axis, block_size); } @@ -20485,102 +20485,102 @@ public static QuantizeLinear QuantizeLinear(CodeType resultType, Value x, Value @OpFactoryHelper.OpDeclaration(RMSNormalization.NAME) public static final class RMSNormalization extends OnnxOp { public static final String NAME = "RMSNormalization"; - + public enum Attribute implements OnnxAttribute { epsilon(Float.class, true, 1.0E-5f), stash_type(Long.class, true, 1), axis(Long.class, true, -1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), V(new OnnxType.TypeVariable("V", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), scale(TypeConstraint.V.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.V.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -20588,59 +20588,59 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public RMSNormalization(ExternalizedOp def) { super(SCHEMA, def); } - + RMSNormalization(RMSNormalization that, CodeContext cc) { super(that, cc); } - + @Override public RMSNormalization transform(CodeContext cc, CodeTransformer ot) { return new RMSNormalization(this, cc); } - + RMSNormalization(CodeType resultType, Value X, Value scale, java.util.Optional epsilon, java.util.Optional stash_type, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(X, scale), List.of(epsilon, stash_type, axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), scale())); } - + public Value X() { return operands().get(0); } - + public Value scale() { return operands().get(1); } - + public java.util.Optional epsilon() { Float epsilon = Attribute.epsilon.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(epsilon); } - + public java.util.Optional stash_type() { Long stash_type = Attribute.stash_type.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(stash_type); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static RMSNormalization RMSNormalization(CodeType resultType, Value X, Value scale, java.util.Optional epsilon, java.util.Optional stash_type, java.util.Optional axis) { return new RMSNormalization(resultType, X, scale, epsilon, stash_type, axis); } @@ -20648,7 +20648,7 @@ public static RMSNormalization RMSNormalization(CodeType resultType, Value X, Va @OpFactoryHelper.OpDeclaration(RNN.NAME) public static final class RNN extends OnnxOp { public static final String NAME = "RNN"; - + public enum Attribute implements OnnxAttribute { layout(Long.class, true, 0), activation_alpha(float[].class, true, null), @@ -20658,49 +20658,49 @@ public enum Attribute implements OnnxAttribute { clip(Float.class, true, null), direction(String.class, true, "forward"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), W(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), @@ -20709,50 +20709,50 @@ public enum InputParameter implements OnnxParameter { sequence_lens(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL), initial_h(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), Y_h(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -20760,98 +20760,98 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public RNN(ExternalizedOp def) { super(SCHEMA, def); } - + RNN(RNN that, CodeContext cc) { super(that, cc); } - + @Override public RNN transform(CodeContext cc, CodeTransformer ot) { return new RNN(this, cc); } - + RNN(CodeType resultType, Set optionalOutputs, Value X, Value W, Value R, java.util.Optional B, java.util.Optional sequence_lens, java.util.Optional initial_h, java.util.Optional layout, java.util.Optional activation_alpha, java.util.Optional hidden_size, java.util.Optional activation_beta, java.util.Optional activations, java.util.Optional clip, java.util.Optional direction) { super(SCHEMA, resultType, optionalOutputs, List.of(X, W, R, B, sequence_lens, initial_h), List.of(layout, activation_alpha, hidden_size, activation_beta, activations, clip, direction)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), W(), R(), B(), sequence_lens(), initial_h())); } - + public Value X() { return operands().get(0); } - + public Value W() { return operands().get(1); } - + public Value R() { return operands().get(2); } - + public java.util.Optional B() { int i = optionalInputArguments.indexOf(InputParameter.B); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional sequence_lens() { int i = optionalInputArguments.indexOf(InputParameter.sequence_lens); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional initial_h() { int i = optionalInputArguments.indexOf(InputParameter.initial_h); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional layout() { Long layout = Attribute.layout.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(layout); } - + public java.util.Optional activation_alpha() { float[] activation_alpha = Attribute.activation_alpha.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(activation_alpha).map(float[]::clone); } - + public java.util.Optional hidden_size() { Long hidden_size = Attribute.hidden_size.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(hidden_size); } - + public java.util.Optional activation_beta() { float[] activation_beta = Attribute.activation_beta.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(activation_beta).map(float[]::clone); } - + public java.util.Optional activations() { String[] activations = Attribute.activations.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(activations).map(String[]::clone); } - + public java.util.Optional clip() { Float clip = Attribute.clip.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(clip); } - + public java.util.Optional direction() { String direction = Attribute.direction.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(direction); } - + } - + public static RNN RNN(CodeType resultType, Set optionalOutputs, Value X, Value W, Value R, java.util.Optional B, java.util.Optional sequence_lens, java.util.Optional initial_h, java.util.Optional layout, java.util.Optional activation_alpha, java.util.Optional hidden_size, java.util.Optional activation_beta, java.util.Optional activations, java.util.Optional clip, java.util.Optional direction) { return new RNN(resultType, optionalOutputs, X, W, R, B, sequence_lens, initial_h, layout, activation_alpha, hidden_size, activation_beta, activations, clip, direction); } @@ -20859,7 +20859,7 @@ public static RNN RNN(CodeType resultType, Set optionalOutp @OpFactoryHelper.OpDeclaration(RandomNormal.NAME) public static final class RandomNormal extends OnnxOp { public static final String NAME = "RandomNormal"; - + public enum Attribute implements OnnxAttribute { shape(long[].class, false, null), seed(Float.class, true, null), @@ -20867,73 +20867,73 @@ public enum Attribute implements OnnxAttribute { scale(Float.class, true, 1.0f), dtype(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter.None { } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -20941,61 +20941,61 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public RandomNormal(ExternalizedOp def) { super(SCHEMA, def); } - + RandomNormal(RandomNormal that, CodeContext cc) { super(that, cc); } - + @Override public RandomNormal transform(CodeContext cc, CodeTransformer ot) { return new RandomNormal(this, cc); } - + RandomNormal(CodeType resultType, long[] shape, java.util.Optional seed, java.util.Optional mean, java.util.Optional scale, java.util.Optional dtype) { super(SCHEMA, resultType, Set.of(), List.of(), List.of(shape, seed, mean, scale, dtype)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of()); } - + public long[] shape() { long[] shape = Attribute.shape.access(long[].class, onnxAttributes); return shape.clone(); } - + public java.util.Optional seed() { Float seed = Attribute.seed.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(seed); } - + public java.util.Optional mean() { Float mean = Attribute.mean.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(mean); } - + public java.util.Optional scale() { Float scale = Attribute.scale.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(scale); } - + public java.util.Optional dtype() { Long dtype = Attribute.dtype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(dtype); } - + } - + public static RandomNormal RandomNormal(CodeType resultType, long[] shape, java.util.Optional seed, java.util.Optional mean, java.util.Optional scale, java.util.Optional dtype) { return new RandomNormal(resultType, shape, seed, mean, scale, dtype); } @@ -21003,102 +21003,102 @@ public static RandomNormal RandomNormal(CodeType resultType, long[] shape, java. @OpFactoryHelper.OpDeclaration(RandomNormalLike.NAME) public static final class RandomNormalLike extends OnnxOp { public static final String NAME = "RandomNormalLike"; - + public enum Attribute implements OnnxAttribute { seed(Float.class, true, null), mean(Float.class, true, 0.0f), scale(Float.class, true, 1.0f), dtype(Long.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -21106,60 +21106,60 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public RandomNormalLike(ExternalizedOp def) { super(SCHEMA, def); } - + RandomNormalLike(RandomNormalLike that, CodeContext cc) { super(that, cc); } - + @Override public RandomNormalLike transform(CodeContext cc, CodeTransformer ot) { return new RandomNormalLike(this, cc); } - + RandomNormalLike(CodeType resultType, Value input, java.util.Optional seed, java.util.Optional mean, java.util.Optional scale, java.util.Optional dtype) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(seed, mean, scale, dtype)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional seed() { Float seed = Attribute.seed.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(seed); } - + public java.util.Optional mean() { Float mean = Attribute.mean.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(mean); } - + public java.util.Optional scale() { Float scale = Attribute.scale.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(scale); } - + public java.util.Optional dtype() { Long dtype = Attribute.dtype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(dtype); } - + } - + public static RandomNormalLike RandomNormalLike(CodeType resultType, Value input, java.util.Optional seed, java.util.Optional mean, java.util.Optional scale, java.util.Optional dtype) { return new RandomNormalLike(resultType, input, seed, mean, scale, dtype); } @@ -21167,7 +21167,7 @@ public static RandomNormalLike RandomNormalLike(CodeType resultType, Value input @OpFactoryHelper.OpDeclaration(RandomUniform.NAME) public static final class RandomUniform extends OnnxOp { public static final String NAME = "RandomUniform"; - + public enum Attribute implements OnnxAttribute { high(Float.class, true, 1.0f), shape(long[].class, false, null), @@ -21175,73 +21175,73 @@ public enum Attribute implements OnnxAttribute { low(Float.class, true, 0.0f), dtype(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter.None { } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -21249,61 +21249,61 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public RandomUniform(ExternalizedOp def) { super(SCHEMA, def); } - + RandomUniform(RandomUniform that, CodeContext cc) { super(that, cc); } - + @Override public RandomUniform transform(CodeContext cc, CodeTransformer ot) { return new RandomUniform(this, cc); } - + RandomUniform(CodeType resultType, java.util.Optional high, long[] shape, java.util.Optional seed, java.util.Optional low, java.util.Optional dtype) { super(SCHEMA, resultType, Set.of(), List.of(), List.of(high, shape, seed, low, dtype)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of()); } - + public java.util.Optional high() { Float high = Attribute.high.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(high); } - + public long[] shape() { long[] shape = Attribute.shape.access(long[].class, onnxAttributes); return shape.clone(); } - + public java.util.Optional seed() { Float seed = Attribute.seed.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(seed); } - + public java.util.Optional low() { Float low = Attribute.low.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(low); } - + public java.util.Optional dtype() { Long dtype = Attribute.dtype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(dtype); } - + } - + public static RandomUniform RandomUniform(CodeType resultType, java.util.Optional high, long[] shape, java.util.Optional seed, java.util.Optional low, java.util.Optional dtype) { return new RandomUniform(resultType, high, shape, seed, low, dtype); } @@ -21311,102 +21311,102 @@ public static RandomUniform RandomUniform(CodeType resultType, java.util.Optiona @OpFactoryHelper.OpDeclaration(RandomUniformLike.NAME) public static final class RandomUniformLike extends OnnxOp { public static final String NAME = "RandomUniformLike"; - + public enum Attribute implements OnnxAttribute { high(Float.class, true, 1.0f), seed(Float.class, true, null), low(Float.class, true, 0.0f), dtype(Long.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -21414,60 +21414,60 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public RandomUniformLike(ExternalizedOp def) { super(SCHEMA, def); } - + RandomUniformLike(RandomUniformLike that, CodeContext cc) { super(that, cc); } - + @Override public RandomUniformLike transform(CodeContext cc, CodeTransformer ot) { return new RandomUniformLike(this, cc); } - + RandomUniformLike(CodeType resultType, Value input, java.util.Optional high, java.util.Optional seed, java.util.Optional low, java.util.Optional dtype) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(high, seed, low, dtype)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional high() { Float high = Attribute.high.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(high); } - + public java.util.Optional seed() { Float seed = Attribute.seed.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(seed); } - + public java.util.Optional low() { Float low = Attribute.low.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(low); } - + public java.util.Optional dtype() { Long dtype = Attribute.dtype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(dtype); } - + } - + public static RandomUniformLike RandomUniformLike(CodeType resultType, Value input, java.util.Optional high, java.util.Optional seed, java.util.Optional low, java.util.Optional dtype) { return new RandomUniformLike(resultType, input, high, seed, low, dtype); } @@ -21475,100 +21475,100 @@ public static RandomUniformLike RandomUniformLike(CodeType resultType, Value inp @OpFactoryHelper.OpDeclaration(Range.NAME) public static final class Range extends OnnxOp { public static final String NAME = "Range"; - + public enum Attribute implements OnnxAttribute { stash_type(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { start(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), limit(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), delta(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -21576,53 +21576,53 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Range(ExternalizedOp def) { super(SCHEMA, def); } - + Range(Range that, CodeContext cc) { super(that, cc); } - + @Override public Range transform(CodeContext cc, CodeTransformer ot) { return new Range(this, cc); } - + Range(CodeType resultType, Value start, Value limit, Value delta, java.util.Optional stash_type) { super(SCHEMA, resultType, Set.of(), List.of(start, limit, delta), List.of(stash_type)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(start(), limit(), delta())); } - + public Value start() { return operands().get(0); } - + public Value limit() { return operands().get(1); } - + public Value delta() { return operands().get(2); } - + public java.util.Optional stash_type() { Long stash_type = Attribute.stash_type.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(stash_type); } - + } - + public static Range Range(CodeType resultType, Value start, Value limit, Value delta, java.util.Optional stash_type) { return new Range(resultType, start, limit, delta, stash_type); } @@ -21630,72 +21630,72 @@ public static Range Range(CodeType resultType, Value start, Value limit, Value d @OpFactoryHelper.OpDeclaration(Reciprocal.NAME) public static final class Reciprocal extends OnnxOp { public static final String NAME = "Reciprocal"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -21703,40 +21703,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Reciprocal(ExternalizedOp def) { super(SCHEMA, def); } - + Reciprocal(Reciprocal that, CodeContext cc) { super(that, cc); } - + @Override public Reciprocal transform(CodeContext cc, CodeTransformer ot) { return new Reciprocal(this, cc); } - + Reciprocal(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Reciprocal Reciprocal(CodeType resultType, Value X) { return new Reciprocal(resultType, X); } @@ -21744,100 +21744,100 @@ public static Reciprocal Reciprocal(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(ReduceL1.NAME) public static final class ReduceL1 extends OnnxOp { public static final String NAME = "ReduceL1"; - + public enum Attribute implements OnnxAttribute { noop_with_empty_axes(Long.class, true, 0), keepdims(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -21845,55 +21845,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ReduceL1(ExternalizedOp def) { super(SCHEMA, def); } - + ReduceL1(ReduceL1 that, CodeContext cc) { super(that, cc); } - + @Override public ReduceL1 transform(CodeContext cc, CodeTransformer ot) { return new ReduceL1(this, cc); } - + ReduceL1(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional noop_with_empty_axes() { Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(noop_with_empty_axes); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + } - + public static ReduceL1 ReduceL1(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { return new ReduceL1(resultType, data, axes, noop_with_empty_axes, keepdims); } @@ -21901,100 +21901,100 @@ public static ReduceL1 ReduceL1(CodeType resultType, Value data, java.util.Optio @OpFactoryHelper.OpDeclaration(ReduceL2.NAME) public static final class ReduceL2 extends OnnxOp { public static final String NAME = "ReduceL2"; - + public enum Attribute implements OnnxAttribute { noop_with_empty_axes(Long.class, true, 0), keepdims(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -22002,55 +22002,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ReduceL2(ExternalizedOp def) { super(SCHEMA, def); } - + ReduceL2(ReduceL2 that, CodeContext cc) { super(that, cc); } - + @Override public ReduceL2 transform(CodeContext cc, CodeTransformer ot) { return new ReduceL2(this, cc); } - + ReduceL2(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional noop_with_empty_axes() { Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(noop_with_empty_axes); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + } - + public static ReduceL2 ReduceL2(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { return new ReduceL2(resultType, data, axes, noop_with_empty_axes, keepdims); } @@ -22058,100 +22058,100 @@ public static ReduceL2 ReduceL2(CodeType resultType, Value data, java.util.Optio @OpFactoryHelper.OpDeclaration(ReduceLogSum.NAME) public static final class ReduceLogSum extends OnnxOp { public static final String NAME = "ReduceLogSum"; - + public enum Attribute implements OnnxAttribute { noop_with_empty_axes(Long.class, true, 0), keepdims(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -22159,55 +22159,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ReduceLogSum(ExternalizedOp def) { super(SCHEMA, def); } - + ReduceLogSum(ReduceLogSum that, CodeContext cc) { super(that, cc); } - + @Override public ReduceLogSum transform(CodeContext cc, CodeTransformer ot) { return new ReduceLogSum(this, cc); } - + ReduceLogSum(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional noop_with_empty_axes() { Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(noop_with_empty_axes); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + } - + public static ReduceLogSum ReduceLogSum(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { return new ReduceLogSum(resultType, data, axes, noop_with_empty_axes, keepdims); } @@ -22215,100 +22215,100 @@ public static ReduceLogSum ReduceLogSum(CodeType resultType, Value data, java.ut @OpFactoryHelper.OpDeclaration(ReduceLogSumExp.NAME) public static final class ReduceLogSumExp extends OnnxOp { public static final String NAME = "ReduceLogSumExp"; - + public enum Attribute implements OnnxAttribute { noop_with_empty_axes(Long.class, true, 0), keepdims(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -22316,55 +22316,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ReduceLogSumExp(ExternalizedOp def) { super(SCHEMA, def); } - + ReduceLogSumExp(ReduceLogSumExp that, CodeContext cc) { super(that, cc); } - + @Override public ReduceLogSumExp transform(CodeContext cc, CodeTransformer ot) { return new ReduceLogSumExp(this, cc); } - + ReduceLogSumExp(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional noop_with_empty_axes() { Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(noop_with_empty_axes); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + } - + public static ReduceLogSumExp ReduceLogSumExp(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { return new ReduceLogSumExp(resultType, data, axes, noop_with_empty_axes, keepdims); } @@ -22372,100 +22372,100 @@ public static ReduceLogSumExp ReduceLogSumExp(CodeType resultType, Value data, j @OpFactoryHelper.OpDeclaration(ReduceMax.NAME) public static final class ReduceMax extends OnnxOp { public static final String NAME = "ReduceMax"; - + public enum Attribute implements OnnxAttribute { noop_with_empty_axes(Long.class, true, 0), keepdims(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -22473,55 +22473,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ReduceMax(ExternalizedOp def) { super(SCHEMA, def); } - + ReduceMax(ReduceMax that, CodeContext cc) { super(that, cc); } - + @Override public ReduceMax transform(CodeContext cc, CodeTransformer ot) { return new ReduceMax(this, cc); } - + ReduceMax(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional noop_with_empty_axes() { Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(noop_with_empty_axes); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + } - + public static ReduceMax ReduceMax(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { return new ReduceMax(resultType, data, axes, noop_with_empty_axes, keepdims); } @@ -22529,100 +22529,100 @@ public static ReduceMax ReduceMax(CodeType resultType, Value data, java.util.Opt @OpFactoryHelper.OpDeclaration(ReduceMean.NAME) public static final class ReduceMean extends OnnxOp { public static final String NAME = "ReduceMean"; - + public enum Attribute implements OnnxAttribute { noop_with_empty_axes(Long.class, true, 0), keepdims(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -22630,55 +22630,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ReduceMean(ExternalizedOp def) { super(SCHEMA, def); } - + ReduceMean(ReduceMean that, CodeContext cc) { super(that, cc); } - + @Override public ReduceMean transform(CodeContext cc, CodeTransformer ot) { return new ReduceMean(this, cc); } - + ReduceMean(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional noop_with_empty_axes() { Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(noop_with_empty_axes); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + } - + public static ReduceMean ReduceMean(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { return new ReduceMean(resultType, data, axes, noop_with_empty_axes, keepdims); } @@ -22686,100 +22686,100 @@ public static ReduceMean ReduceMean(CodeType resultType, Value data, java.util.O @OpFactoryHelper.OpDeclaration(ReduceMin.NAME) public static final class ReduceMin extends OnnxOp { public static final String NAME = "ReduceMin"; - + public enum Attribute implements OnnxAttribute { noop_with_empty_axes(Long.class, true, 0), keepdims(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -22787,55 +22787,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ReduceMin(ExternalizedOp def) { super(SCHEMA, def); } - + ReduceMin(ReduceMin that, CodeContext cc) { super(that, cc); } - + @Override public ReduceMin transform(CodeContext cc, CodeTransformer ot) { return new ReduceMin(this, cc); } - + ReduceMin(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional noop_with_empty_axes() { Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(noop_with_empty_axes); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + } - + public static ReduceMin ReduceMin(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { return new ReduceMin(resultType, data, axes, noop_with_empty_axes, keepdims); } @@ -22843,100 +22843,100 @@ public static ReduceMin ReduceMin(CodeType resultType, Value data, java.util.Opt @OpFactoryHelper.OpDeclaration(ReduceProd.NAME) public static final class ReduceProd extends OnnxOp { public static final String NAME = "ReduceProd"; - + public enum Attribute implements OnnxAttribute { noop_with_empty_axes(Long.class, true, 0), keepdims(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -22944,55 +22944,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ReduceProd(ExternalizedOp def) { super(SCHEMA, def); } - + ReduceProd(ReduceProd that, CodeContext cc) { super(that, cc); } - + @Override public ReduceProd transform(CodeContext cc, CodeTransformer ot) { return new ReduceProd(this, cc); } - + ReduceProd(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional noop_with_empty_axes() { Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(noop_with_empty_axes); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + } - + public static ReduceProd ReduceProd(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { return new ReduceProd(resultType, data, axes, noop_with_empty_axes, keepdims); } @@ -23000,100 +23000,100 @@ public static ReduceProd ReduceProd(CodeType resultType, Value data, java.util.O @OpFactoryHelper.OpDeclaration(ReduceSum.NAME) public static final class ReduceSum extends OnnxOp { public static final String NAME = "ReduceSum"; - + public enum Attribute implements OnnxAttribute { noop_with_empty_axes(Long.class, true, 0), keepdims(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -23101,55 +23101,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ReduceSum(ExternalizedOp def) { super(SCHEMA, def); } - + ReduceSum(ReduceSum that, CodeContext cc) { super(that, cc); } - + @Override public ReduceSum transform(CodeContext cc, CodeTransformer ot) { return new ReduceSum(this, cc); } - + ReduceSum(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional noop_with_empty_axes() { Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(noop_with_empty_axes); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + } - + public static ReduceSum ReduceSum(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { return new ReduceSum(resultType, data, axes, noop_with_empty_axes, keepdims); } @@ -23157,100 +23157,100 @@ public static ReduceSum ReduceSum(CodeType resultType, Value data, java.util.Opt @OpFactoryHelper.OpDeclaration(ReduceSumSquare.NAME) public static final class ReduceSumSquare extends OnnxOp { public static final String NAME = "ReduceSumSquare"; - + public enum Attribute implements OnnxAttribute { noop_with_empty_axes(Long.class, true, 0), keepdims(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reduced(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -23258,55 +23258,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ReduceSumSquare(ExternalizedOp def) { super(SCHEMA, def); } - + ReduceSumSquare(ReduceSumSquare that, CodeContext cc) { super(that, cc); } - + @Override public ReduceSumSquare transform(CodeContext cc, CodeTransformer ot) { return new ReduceSumSquare(this, cc); } - + ReduceSumSquare(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional noop_with_empty_axes() { Long noop_with_empty_axes = Attribute.noop_with_empty_axes.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(noop_with_empty_axes); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + } - + public static ReduceSumSquare ReduceSumSquare(CodeType resultType, Value data, java.util.Optional axes, java.util.Optional noop_with_empty_axes, java.util.Optional keepdims) { return new ReduceSumSquare(resultType, data, axes, noop_with_empty_axes, keepdims); } @@ -23314,99 +23314,99 @@ public static ReduceSumSquare ReduceSumSquare(CodeType resultType, Value data, j @OpFactoryHelper.OpDeclaration(RegexFullMatch.NAME) public static final class RegexFullMatch extends OnnxOp { public static final String NAME = "RegexFullMatch"; - + public enum Attribute implements OnnxAttribute { pattern(String.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.string())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -23414,45 +23414,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public RegexFullMatch(ExternalizedOp def) { super(SCHEMA, def); } - + RegexFullMatch(RegexFullMatch that, CodeContext cc) { super(that, cc); } - + @Override public RegexFullMatch transform(CodeContext cc, CodeTransformer ot) { return new RegexFullMatch(this, cc); } - + RegexFullMatch(CodeType resultType, Value X, java.util.Optional pattern) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(pattern)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional pattern() { String pattern = Attribute.pattern.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(pattern); } - + } - + public static RegexFullMatch RegexFullMatch(CodeType resultType, Value X, java.util.Optional pattern) { return new RegexFullMatch(resultType, X, pattern); } @@ -23460,72 +23460,72 @@ public static RegexFullMatch RegexFullMatch(CodeType resultType, Value X, java.u @OpFactoryHelper.OpDeclaration(Relu.NAME) public static final class Relu extends OnnxOp { public static final String NAME = "Relu"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -23533,40 +23533,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Relu(ExternalizedOp def) { super(SCHEMA, def); } - + Relu(Relu that, CodeContext cc) { super(that, cc); } - + @Override public Relu transform(CodeContext cc, CodeTransformer ot) { return new Relu(this, cc); } - + Relu(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Relu Relu(CodeType resultType, Value X) { return new Relu(resultType, X); } @@ -23574,99 +23574,99 @@ public static Relu Relu(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(Reshape.NAME) public static final class Reshape extends OnnxOp { public static final String NAME = "Reshape"; - + public enum Attribute implements OnnxAttribute { allowzero(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), shape(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { reshaped(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -23674,49 +23674,49 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Reshape(ExternalizedOp def) { super(SCHEMA, def); } - + Reshape(Reshape that, CodeContext cc) { super(that, cc); } - + @Override public Reshape transform(CodeContext cc, CodeTransformer ot) { return new Reshape(this, cc); } - + Reshape(CodeType resultType, Value data, Value shape, java.util.Optional allowzero) { super(SCHEMA, resultType, Set.of(), List.of(data, shape), List.of(allowzero)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), shape())); } - + public Value data() { return operands().get(0); } - + public Value shape() { return operands().get(1); } - + public java.util.Optional allowzero() { Long allowzero = Attribute.allowzero.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(allowzero); } - + } - + public static Reshape Reshape(CodeType resultType, Value data, Value shape, java.util.Optional allowzero) { return new Reshape(resultType, data, shape, allowzero); } @@ -23724,7 +23724,7 @@ public static Reshape Reshape(CodeType resultType, Value data, Value shape, java @OpFactoryHelper.OpDeclaration(Resize.NAME) public static final class Resize extends OnnxOp { public static final String NAME = "Resize"; - + public enum Attribute implements OnnxAttribute { mode(String.class, true, "nearest"), extrapolation_value(Float.class, true, 0.0f), @@ -23736,98 +23736,98 @@ public enum Attribute implements OnnxAttribute { keep_aspect_ratio_policy(String.class, true, "stretch"), exclude_outside(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), roi(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), scales(OnnxType.tensor(OnnxType.float32()), Quantifier.OPTIONAL), sizes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -23835,100 +23835,100 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Resize(ExternalizedOp def) { super(SCHEMA, def); } - + Resize(Resize that, CodeContext cc) { super(that, cc); } - + @Override public Resize transform(CodeContext cc, CodeTransformer ot) { return new Resize(this, cc); } - + Resize(CodeType resultType, Value X, java.util.Optional roi, java.util.Optional scales, java.util.Optional sizes, java.util.Optional mode, java.util.Optional extrapolation_value, java.util.Optional nearest_mode, java.util.Optional antialias, java.util.Optional cubic_coeff_a, java.util.Optional axes, java.util.Optional coordinate_transformation_mode, java.util.Optional keep_aspect_ratio_policy, java.util.Optional exclude_outside) { super(SCHEMA, resultType, Set.of(), List.of(X, roi, scales, sizes), List.of(mode, extrapolation_value, nearest_mode, antialias, cubic_coeff_a, axes, coordinate_transformation_mode, keep_aspect_ratio_policy, exclude_outside)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), roi(), scales(), sizes())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional roi() { int i = optionalInputArguments.indexOf(InputParameter.roi); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional scales() { int i = optionalInputArguments.indexOf(InputParameter.scales); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional sizes() { int i = optionalInputArguments.indexOf(InputParameter.sizes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional mode() { String mode = Attribute.mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(mode); } - + public java.util.Optional extrapolation_value() { Float extrapolation_value = Attribute.extrapolation_value.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(extrapolation_value); } - + public java.util.Optional nearest_mode() { String nearest_mode = Attribute.nearest_mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(nearest_mode); } - + public java.util.Optional antialias() { Long antialias = Attribute.antialias.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(antialias); } - + public java.util.Optional cubic_coeff_a() { Float cubic_coeff_a = Attribute.cubic_coeff_a.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(cubic_coeff_a); } - + public java.util.Optional axes() { long[] axes = Attribute.axes.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(axes).map(long[]::clone); } - + public java.util.Optional coordinate_transformation_mode() { String coordinate_transformation_mode = Attribute.coordinate_transformation_mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(coordinate_transformation_mode); } - + public java.util.Optional keep_aspect_ratio_policy() { String keep_aspect_ratio_policy = Attribute.keep_aspect_ratio_policy.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(keep_aspect_ratio_policy); } - + public java.util.Optional exclude_outside() { Long exclude_outside = Attribute.exclude_outside.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(exclude_outside); } - + } - + public static Resize Resize(CodeType resultType, Value X, java.util.Optional roi, java.util.Optional scales, java.util.Optional sizes, java.util.Optional mode, java.util.Optional extrapolation_value, java.util.Optional nearest_mode, java.util.Optional antialias, java.util.Optional cubic_coeff_a, java.util.Optional axes, java.util.Optional coordinate_transformation_mode, java.util.Optional keep_aspect_ratio_policy, java.util.Optional exclude_outside) { return new Resize(resultType, X, roi, scales, sizes, mode, extrapolation_value, nearest_mode, antialias, cubic_coeff_a, axes, coordinate_transformation_mode, keep_aspect_ratio_policy, exclude_outside); } @@ -23936,100 +23936,100 @@ public static Resize Resize(CodeType resultType, Value X, java.util.Optional t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), sequence_lens(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -24037,54 +24037,54 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ReverseSequence(ExternalizedOp def) { super(SCHEMA, def); } - + ReverseSequence(ReverseSequence that, CodeContext cc) { super(that, cc); } - + @Override public ReverseSequence transform(CodeContext cc, CodeTransformer ot) { return new ReverseSequence(this, cc); } - + ReverseSequence(CodeType resultType, Value input, Value sequence_lens, java.util.Optional time_axis, java.util.Optional batch_axis) { super(SCHEMA, resultType, Set.of(), List.of(input, sequence_lens), List.of(time_axis, batch_axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), sequence_lens())); } - + public Value input() { return operands().get(0); } - + public Value sequence_lens() { return operands().get(1); } - + public java.util.Optional time_axis() { Long time_axis = Attribute.time_axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(time_axis); } - + public java.util.Optional batch_axis() { Long batch_axis = Attribute.batch_axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(batch_axis); } - + } - + public static ReverseSequence ReverseSequence(CodeType resultType, Value input, Value sequence_lens, java.util.Optional time_axis, java.util.Optional batch_axis) { return new ReverseSequence(resultType, input, sequence_lens, time_axis, batch_axis); } @@ -24092,7 +24092,7 @@ public static ReverseSequence ReverseSequence(CodeType resultType, Value input, @OpFactoryHelper.OpDeclaration(RoiAlign.NAME) public static final class RoiAlign extends OnnxOp { public static final String NAME = "RoiAlign"; - + public enum Attribute implements OnnxAttribute { mode(String.class, true, "avg"), output_width(Long.class, true, 1), @@ -24101,97 +24101,97 @@ public enum Attribute implements OnnxAttribute { sampling_ratio(Long.class, true, 0), output_height(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), rois(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), batch_indices(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -24199,78 +24199,78 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public RoiAlign(ExternalizedOp def) { super(SCHEMA, def); } - + RoiAlign(RoiAlign that, CodeContext cc) { super(that, cc); } - + @Override public RoiAlign transform(CodeContext cc, CodeTransformer ot) { return new RoiAlign(this, cc); } - + RoiAlign(CodeType resultType, Value X, Value rois, Value batch_indices, java.util.Optional mode, java.util.Optional output_width, java.util.Optional spatial_scale, java.util.Optional coordinate_transformation_mode, java.util.Optional sampling_ratio, java.util.Optional output_height) { super(SCHEMA, resultType, Set.of(), List.of(X, rois, batch_indices), List.of(mode, output_width, spatial_scale, coordinate_transformation_mode, sampling_ratio, output_height)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), rois(), batch_indices())); } - + public Value X() { return operands().get(0); } - + public Value rois() { return operands().get(1); } - + public Value batch_indices() { return operands().get(2); } - + public java.util.Optional mode() { String mode = Attribute.mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(mode); } - + public java.util.Optional output_width() { Long output_width = Attribute.output_width.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(output_width); } - + public java.util.Optional spatial_scale() { Float spatial_scale = Attribute.spatial_scale.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(spatial_scale); } - + public java.util.Optional coordinate_transformation_mode() { String coordinate_transformation_mode = Attribute.coordinate_transformation_mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(coordinate_transformation_mode); } - + public java.util.Optional sampling_ratio() { Long sampling_ratio = Attribute.sampling_ratio.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(sampling_ratio); } - + public java.util.Optional output_height() { Long output_height = Attribute.output_height.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(output_height); } - + } - + public static RoiAlign RoiAlign(CodeType resultType, Value X, Value rois, Value batch_indices, java.util.Optional mode, java.util.Optional output_width, java.util.Optional spatial_scale, java.util.Optional coordinate_transformation_mode, java.util.Optional sampling_ratio, java.util.Optional output_height) { return new RoiAlign(resultType, X, rois, batch_indices, mode, output_width, spatial_scale, coordinate_transformation_mode, sampling_ratio, output_height); } @@ -24278,104 +24278,104 @@ public static RoiAlign RoiAlign(CodeType resultType, Value X, Value rois, Value @OpFactoryHelper.OpDeclaration(RotaryEmbedding.NAME) public static final class RotaryEmbedding extends OnnxOp { public static final String NAME = "RotaryEmbedding"; - + public enum Attribute implements OnnxAttribute { num_heads(Long.class, true, null), rotary_embedding_dim(Long.class, true, 0), interleaved(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.bfloat16())))), M(new OnnxType.TypeVariable("M", List.of(OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), cos_cache(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), sin_cache(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), position_ids(TypeConstraint.M.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -24383,68 +24383,68 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public RotaryEmbedding(ExternalizedOp def) { super(SCHEMA, def); } - + RotaryEmbedding(RotaryEmbedding that, CodeContext cc) { super(that, cc); } - + @Override public RotaryEmbedding transform(CodeContext cc, CodeTransformer ot) { return new RotaryEmbedding(this, cc); } - + RotaryEmbedding(CodeType resultType, Value X, Value cos_cache, Value sin_cache, java.util.Optional position_ids, java.util.Optional num_heads, java.util.Optional rotary_embedding_dim, java.util.Optional interleaved) { super(SCHEMA, resultType, Set.of(), List.of(X, cos_cache, sin_cache, position_ids), List.of(num_heads, rotary_embedding_dim, interleaved)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), cos_cache(), sin_cache(), position_ids())); } - + public Value X() { return operands().get(0); } - + public Value cos_cache() { return operands().get(1); } - + public Value sin_cache() { return operands().get(2); } - + public java.util.Optional position_ids() { int i = optionalInputArguments.indexOf(InputParameter.position_ids); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional num_heads() { Long num_heads = Attribute.num_heads.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(num_heads); } - + public java.util.Optional rotary_embedding_dim() { Long rotary_embedding_dim = Attribute.rotary_embedding_dim.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(rotary_embedding_dim); } - + public java.util.Optional interleaved() { Long interleaved = Attribute.interleaved.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(interleaved); } - + } - + public static RotaryEmbedding RotaryEmbedding(CodeType resultType, Value X, Value cos_cache, Value sin_cache, java.util.Optional position_ids, java.util.Optional num_heads, java.util.Optional rotary_embedding_dim, java.util.Optional interleaved) { return new RotaryEmbedding(resultType, X, cos_cache, sin_cache, position_ids, num_heads, rotary_embedding_dim, interleaved); } @@ -24452,72 +24452,72 @@ public static RotaryEmbedding RotaryEmbedding(CodeType resultType, Value X, Valu @OpFactoryHelper.OpDeclaration(Round.NAME) public static final class Round extends OnnxOp { public static final String NAME = "Round"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -24525,40 +24525,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Round(ExternalizedOp def) { super(SCHEMA, def); } - + Round(Round that, CodeContext cc) { super(that, cc); } - + @Override public Round transform(CodeContext cc, CodeTransformer ot) { return new Round(this, cc); } - + Round(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Round Round(CodeType resultType, Value X) { return new Round(resultType, X); } @@ -24566,102 +24566,102 @@ public static Round Round(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(STFT.NAME) public static final class STFT extends OnnxOp { public static final String NAME = "STFT"; - + public enum Attribute implements OnnxAttribute { onesided(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { signal(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), frame_step(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), window(TypeConstraint.T1.typeVariable(), Quantifier.OPTIONAL), frame_length(TypeConstraint.T2.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -24669,59 +24669,59 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public STFT(ExternalizedOp def) { super(SCHEMA, def); } - + STFT(STFT that, CodeContext cc) { super(that, cc); } - + @Override public STFT transform(CodeContext cc, CodeTransformer ot) { return new STFT(this, cc); } - + STFT(CodeType resultType, Value signal, Value frame_step, java.util.Optional window, java.util.Optional frame_length, java.util.Optional onesided) { super(SCHEMA, resultType, Set.of(), List.of(signal, frame_step, window, frame_length), List.of(onesided)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(signal(), frame_step(), window(), frame_length())); } - + public Value signal() { return operands().get(0); } - + public Value frame_step() { return operands().get(1); } - + public java.util.Optional window() { int i = optionalInputArguments.indexOf(InputParameter.window); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional frame_length() { int i = optionalInputArguments.indexOf(InputParameter.frame_length); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional onesided() { Long onesided = Attribute.onesided.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(onesided); } - + } - + public static STFT STFT(CodeType resultType, Value signal, Value frame_step, java.util.Optional window, java.util.Optional frame_length, java.util.Optional onesided) { return new STFT(resultType, signal, frame_step, window, frame_length, onesided); } @@ -24729,7 +24729,7 @@ public static STFT STFT(CodeType resultType, Value signal, Value frame_step, jav @OpFactoryHelper.OpDeclaration(SVMClassifier.NAME) public static final class SVMClassifier extends OnnxOp { public static final String NAME = "SVMClassifier"; - + public enum Attribute implements OnnxAttribute { prob_b(float[].class, true, null), kernel_params(float[].class, true, null), @@ -24743,96 +24743,96 @@ public enum Attribute implements OnnxAttribute { prob_a(float[].class, true, null), classlabels_strings(String[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), Z(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -24840,95 +24840,95 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public SVMClassifier(ExternalizedOp def) { super(SCHEMA, def); } - + SVMClassifier(SVMClassifier that, CodeContext cc) { super(that, cc); } - + @Override public SVMClassifier transform(CodeContext cc, CodeTransformer ot) { return new SVMClassifier(this, cc); } - + SVMClassifier(CodeType resultType, Value X, java.util.Optional prob_b, java.util.Optional kernel_params, java.util.Optional kernel_type, java.util.Optional classlabels_ints, java.util.Optional post_transform, java.util.Optional rho, java.util.Optional coefficients, java.util.Optional support_vectors, java.util.Optional vectors_per_class, java.util.Optional prob_a, java.util.Optional classlabels_strings) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(prob_b, kernel_params, kernel_type, classlabels_ints, post_transform, rho, coefficients, support_vectors, vectors_per_class, prob_a, classlabels_strings)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional prob_b() { float[] prob_b = Attribute.prob_b.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(prob_b).map(float[]::clone); } - + public java.util.Optional kernel_params() { float[] kernel_params = Attribute.kernel_params.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(kernel_params).map(float[]::clone); } - + public java.util.Optional kernel_type() { String kernel_type = Attribute.kernel_type.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(kernel_type); } - + public java.util.Optional classlabels_ints() { long[] classlabels_ints = Attribute.classlabels_ints.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(classlabels_ints).map(long[]::clone); } - + public java.util.Optional post_transform() { String post_transform = Attribute.post_transform.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(post_transform); } - + public java.util.Optional rho() { float[] rho = Attribute.rho.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(rho).map(float[]::clone); } - + public java.util.Optional coefficients() { float[] coefficients = Attribute.coefficients.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(coefficients).map(float[]::clone); } - + public java.util.Optional support_vectors() { float[] support_vectors = Attribute.support_vectors.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(support_vectors).map(float[]::clone); } - + public java.util.Optional vectors_per_class() { long[] vectors_per_class = Attribute.vectors_per_class.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(vectors_per_class).map(long[]::clone); } - + public java.util.Optional prob_a() { float[] prob_a = Attribute.prob_a.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(prob_a).map(float[]::clone); } - + public java.util.Optional classlabels_strings() { String[] classlabels_strings = Attribute.classlabels_strings.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(classlabels_strings).map(String[]::clone); } - + } - + public static SVMClassifier SVMClassifier(CodeType resultType, Value X, java.util.Optional prob_b, java.util.Optional kernel_params, java.util.Optional kernel_type, java.util.Optional classlabels_ints, java.util.Optional post_transform, java.util.Optional rho, java.util.Optional coefficients, java.util.Optional support_vectors, java.util.Optional vectors_per_class, java.util.Optional prob_a, java.util.Optional classlabels_strings) { return new SVMClassifier(resultType, X, prob_b, kernel_params, kernel_type, classlabels_ints, post_transform, rho, coefficients, support_vectors, vectors_per_class, prob_a, classlabels_strings); } @@ -24936,7 +24936,7 @@ public static SVMClassifier SVMClassifier(CodeType resultType, Value X, java.uti @OpFactoryHelper.OpDeclaration(SVMRegressor.NAME) public static final class SVMRegressor extends OnnxOp { public static final String NAME = "SVMRegressor"; - + public enum Attribute implements OnnxAttribute { kernel_type(String.class, true, "LINEAR"), kernel_params(float[].class, true, null), @@ -24947,94 +24947,94 @@ public enum Attribute implements OnnxAttribute { support_vectors(float[].class, true, null), one_class(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -25042,80 +25042,80 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public SVMRegressor(ExternalizedOp def) { super(SCHEMA, def); } - + SVMRegressor(SVMRegressor that, CodeContext cc) { super(that, cc); } - + @Override public SVMRegressor transform(CodeContext cc, CodeTransformer ot) { return new SVMRegressor(this, cc); } - + SVMRegressor(CodeType resultType, Value X, java.util.Optional kernel_type, java.util.Optional kernel_params, java.util.Optional n_supports, java.util.Optional rho, java.util.Optional post_transform, java.util.Optional coefficients, java.util.Optional support_vectors, java.util.Optional one_class) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(kernel_type, kernel_params, n_supports, rho, post_transform, coefficients, support_vectors, one_class)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional kernel_type() { String kernel_type = Attribute.kernel_type.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(kernel_type); } - + public java.util.Optional kernel_params() { float[] kernel_params = Attribute.kernel_params.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(kernel_params).map(float[]::clone); } - + public java.util.Optional n_supports() { Long n_supports = Attribute.n_supports.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(n_supports); } - + public java.util.Optional rho() { float[] rho = Attribute.rho.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(rho).map(float[]::clone); } - + public java.util.Optional post_transform() { String post_transform = Attribute.post_transform.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(post_transform); } - + public java.util.Optional coefficients() { float[] coefficients = Attribute.coefficients.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(coefficients).map(float[]::clone); } - + public java.util.Optional support_vectors() { float[] support_vectors = Attribute.support_vectors.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(support_vectors).map(float[]::clone); } - + public java.util.Optional one_class() { Long one_class = Attribute.one_class.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(one_class); } - + } - + public static SVMRegressor SVMRegressor(CodeType resultType, Value X, java.util.Optional kernel_type, java.util.Optional kernel_params, java.util.Optional n_supports, java.util.Optional rho, java.util.Optional post_transform, java.util.Optional coefficients, java.util.Optional support_vectors, java.util.Optional one_class) { return new SVMRegressor(resultType, X, kernel_type, kernel_params, n_supports, rho, post_transform, coefficients, support_vectors, one_class); } @@ -25123,99 +25123,99 @@ public static SVMRegressor SVMRegressor(CodeType resultType, Value X, java.util. @OpFactoryHelper.OpDeclaration(Scaler.NAME) public static final class Scaler extends OnnxOp { public static final String NAME = "Scaler"; - + public enum Attribute implements OnnxAttribute { offset(float[].class, true, null), scale(float[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -25223,50 +25223,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Scaler(ExternalizedOp def) { super(SCHEMA, def); } - + Scaler(Scaler that, CodeContext cc) { super(that, cc); } - + @Override public Scaler transform(CodeContext cc, CodeTransformer ot) { return new Scaler(this, cc); } - + Scaler(CodeType resultType, Value X, java.util.Optional offset, java.util.Optional scale) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(offset, scale)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional offset() { float[] offset = Attribute.offset.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(offset).map(float[]::clone); } - + public java.util.Optional scale() { float[] scale = Attribute.scale.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(scale).map(float[]::clone); } - + } - + public static Scaler Scaler(CodeType resultType, Value X, java.util.Optional offset, java.util.Optional scale) { return new Scaler(resultType, X, offset, scale); } @@ -25274,101 +25274,101 @@ public static Scaler Scaler(CodeType resultType, Value X, java.util.Optional t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), indices(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED), updates(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -25376,53 +25376,53 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Scatter(ExternalizedOp def) { super(SCHEMA, def); } - + Scatter(Scatter that, CodeContext cc) { super(that, cc); } - + @Override public Scatter transform(CodeContext cc, CodeTransformer ot) { return new Scatter(this, cc); } - + Scatter(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(data, indices, updates), List.of(axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), indices(), updates())); } - + public Value data() { return operands().get(0); } - + public Value indices() { return operands().get(1); } - + public Value updates() { return operands().get(2); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static Scatter Scatter(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional axis) { return new Scatter(resultType, data, indices, updates, axis); } @@ -25430,102 +25430,102 @@ public static Scatter Scatter(CodeType resultType, Value data, Value indices, Va @OpFactoryHelper.OpDeclaration(ScatterElements.NAME) public static final class ScatterElements extends OnnxOp { public static final String NAME = "ScatterElements"; - + public enum Attribute implements OnnxAttribute { reduction(String.class, true, "none"), axis(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), indices(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED), updates(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -25533,58 +25533,58 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ScatterElements(ExternalizedOp def) { super(SCHEMA, def); } - + ScatterElements(ScatterElements that, CodeContext cc) { super(that, cc); } - + @Override public ScatterElements transform(CodeContext cc, CodeTransformer ot) { return new ScatterElements(this, cc); } - + ScatterElements(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional reduction, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(data, indices, updates), List.of(reduction, axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), indices(), updates())); } - + public Value data() { return operands().get(0); } - + public Value indices() { return operands().get(1); } - + public Value updates() { return operands().get(2); } - + public java.util.Optional reduction() { String reduction = Attribute.reduction.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(reduction); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static ScatterElements ScatterElements(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional reduction, java.util.Optional axis) { return new ScatterElements(resultType, data, indices, updates, reduction, axis); } @@ -25592,100 +25592,100 @@ public static ScatterElements ScatterElements(CodeType resultType, Value data, V @OpFactoryHelper.OpDeclaration(ScatterND.NAME) public static final class ScatterND extends OnnxOp { public static final String NAME = "ScatterND"; - + public enum Attribute implements OnnxAttribute { reduction(String.class, true, "none"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), indices(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), updates(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -25693,53 +25693,53 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ScatterND(ExternalizedOp def) { super(SCHEMA, def); } - + ScatterND(ScatterND that, CodeContext cc) { super(that, cc); } - + @Override public ScatterND transform(CodeContext cc, CodeTransformer ot) { return new ScatterND(this, cc); } - + ScatterND(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional reduction) { super(SCHEMA, resultType, Set.of(), List.of(data, indices, updates), List.of(reduction)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), indices(), updates())); } - + public Value data() { return operands().get(0); } - + public Value indices() { return operands().get(1); } - + public Value updates() { return operands().get(2); } - + public java.util.Optional reduction() { String reduction = Attribute.reduction.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(reduction); } - + } - + public static ScatterND ScatterND(CodeType resultType, Value data, Value indices, Value updates, java.util.Optional reduction) { return new ScatterND(resultType, data, indices, updates, reduction); } @@ -25747,99 +25747,99 @@ public static ScatterND ScatterND(CodeType resultType, Value data, Value indices @OpFactoryHelper.OpDeclaration(Selu.NAME) public static final class Selu extends OnnxOp { public static final String NAME = "Selu"; - + public enum Attribute implements OnnxAttribute { alpha(Float.class, true, 1.6732632f), gamma(Float.class, true, 1.050701f), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -25847,50 +25847,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Selu(ExternalizedOp def) { super(SCHEMA, def); } - + Selu(Selu that, CodeContext cc) { super(that, cc); } - + @Override public Selu transform(CodeContext cc, CodeTransformer ot) { return new Selu(this, cc); } - + Selu(CodeType resultType, Value X, java.util.Optional alpha, java.util.Optional gamma) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha, gamma)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional alpha() { Float alpha = Attribute.alpha.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(alpha); } - + public java.util.Optional gamma() { Float gamma = Attribute.gamma.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(gamma); } - + } - + public static Selu Selu(CodeType resultType, Value X, java.util.Optional alpha, java.util.Optional gamma) { return new Selu(resultType, X, alpha, gamma); } @@ -25898,75 +25898,75 @@ public static Selu Selu(CodeType resultType, Value X, java.util.Optional @OpFactoryHelper.OpDeclaration(SequenceAt.NAME) public static final class SequenceAt extends OnnxOp { public static final String NAME = "SequenceAt"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED), position(TypeConstraint.I.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { tensor(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -25974,44 +25974,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public SequenceAt(ExternalizedOp def) { super(SCHEMA, def); } - + SequenceAt(SequenceAt that, CodeContext cc) { super(that, cc); } - + @Override public SequenceAt transform(CodeContext cc, CodeTransformer ot) { return new SequenceAt(this, cc); } - + SequenceAt(CodeType resultType, Value input_sequence, Value position) { super(SCHEMA, resultType, Set.of(), List.of(input_sequence, position), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input_sequence(), position())); } - + public Value input_sequence() { return operands().get(0); } - + public Value position() { return operands().get(1); } - + } - + public static SequenceAt SequenceAt(CodeType resultType, Value input_sequence, Value position) { return new SequenceAt(resultType, input_sequence, position); } @@ -26019,73 +26019,73 @@ public static SequenceAt SequenceAt(CodeType resultType, Value input_sequence, V @OpFactoryHelper.OpDeclaration(SequenceConstruct.NAME) public static final class SequenceConstruct extends OnnxOp { public static final String NAME = "SequenceConstruct"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { inputs(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -26093,40 +26093,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public SequenceConstruct(ExternalizedOp def) { super(SCHEMA, def); } - + SequenceConstruct(SequenceConstruct that, CodeContext cc) { super(that, cc); } - + @Override public SequenceConstruct transform(CodeContext cc, CodeTransformer ot) { return new SequenceConstruct(this, cc); } - + SequenceConstruct(CodeType resultType, List inputs) { super(SCHEMA, resultType, Set.of(), List.of(inputs), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(inputs())); } - + public List inputs() { return operands(); } - + } - + public static SequenceConstruct SequenceConstruct(CodeType resultType, List inputs) { return new SequenceConstruct(resultType, inputs); } @@ -26134,77 +26134,77 @@ public static SequenceConstruct SequenceConstruct(CodeType resultType, List t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter.None { } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -26212,41 +26212,41 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public SequenceEmpty(ExternalizedOp def) { super(SCHEMA, def); } - + SequenceEmpty(SequenceEmpty that, CodeContext cc) { super(that, cc); } - + @Override public SequenceEmpty transform(CodeContext cc, CodeTransformer ot) { return new SequenceEmpty(this, cc); } - + SequenceEmpty(CodeType resultType, java.util.Optional dtype) { super(SCHEMA, resultType, Set.of(), List.of(), List.of(dtype)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of()); } - + public java.util.Optional dtype() { Long dtype = Attribute.dtype.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(dtype); } - + } - + public static SequenceEmpty SequenceEmpty(CodeType resultType, java.util.Optional dtype) { return new SequenceEmpty(resultType, dtype); } @@ -26254,74 +26254,74 @@ public static SequenceEmpty SequenceEmpty(CodeType resultType, java.util.Optiona @OpFactoryHelper.OpDeclaration(SequenceErase.NAME) public static final class SequenceErase extends OnnxOp { public static final String NAME = "SequenceErase"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED), position(TypeConstraint.I.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -26329,45 +26329,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public SequenceErase(ExternalizedOp def) { super(SCHEMA, def); } - + SequenceErase(SequenceErase that, CodeContext cc) { super(that, cc); } - + @Override public SequenceErase transform(CodeContext cc, CodeTransformer ot) { return new SequenceErase(this, cc); } - + SequenceErase(CodeType resultType, Value input_sequence, java.util.Optional position) { super(SCHEMA, resultType, Set.of(), List.of(input_sequence, position), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input_sequence(), position())); } - + public Value input_sequence() { return operands().get(0); } - + public java.util.Optional position() { int i = optionalInputArguments.indexOf(InputParameter.position); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + } - + public static SequenceErase SequenceErase(CodeType resultType, Value input_sequence, java.util.Optional position) { return new SequenceErase(resultType, input_sequence, position); } @@ -26375,76 +26375,76 @@ public static SequenceErase SequenceErase(CodeType resultType, Value input_seque @OpFactoryHelper.OpDeclaration(SequenceInsert.NAME) public static final class SequenceInsert extends OnnxOp { public static final String NAME = "SequenceInsert"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED), tensor(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), position(TypeConstraint.I.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -26452,49 +26452,49 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public SequenceInsert(ExternalizedOp def) { super(SCHEMA, def); } - + SequenceInsert(SequenceInsert that, CodeContext cc) { super(that, cc); } - + @Override public SequenceInsert transform(CodeContext cc, CodeTransformer ot) { return new SequenceInsert(this, cc); } - + SequenceInsert(CodeType resultType, Value input_sequence, Value tensor, java.util.Optional position) { super(SCHEMA, resultType, Set.of(), List.of(input_sequence, tensor, position), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input_sequence(), tensor(), position())); } - + public Value input_sequence() { return operands().get(0); } - + public Value tensor() { return operands().get(1); } - + public java.util.Optional position() { int i = optionalInputArguments.indexOf(InputParameter.position); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + } - + public static SequenceInsert SequenceInsert(CodeType resultType, Value input_sequence, Value tensor, java.util.Optional position) { return new SequenceInsert(resultType, input_sequence, tensor, position); } @@ -26502,73 +26502,73 @@ public static SequenceInsert SequenceInsert(CodeType resultType, Value input_seq @OpFactoryHelper.OpDeclaration(SequenceLength.NAME) public static final class SequenceLength extends OnnxOp { public static final String NAME = "SequenceLength"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { length(TypeConstraint.I.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -26576,40 +26576,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public SequenceLength(ExternalizedOp def) { super(SCHEMA, def); } - + SequenceLength(SequenceLength that, CodeContext cc) { super(that, cc); } - + @Override public SequenceLength transform(CodeContext cc, CodeTransformer ot) { return new SequenceLength(this, cc); } - + SequenceLength(CodeType resultType, Value input_sequence) { super(SCHEMA, resultType, Set.of(), List.of(input_sequence), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input_sequence())); } - + public Value input_sequence() { return operands().get(0); } - + } - + public static SequenceLength SequenceLength(CodeType resultType, Value input_sequence) { return new SequenceLength(resultType, input_sequence); } @@ -26617,100 +26617,100 @@ public static SequenceLength SequenceLength(CodeType resultType, Value input_seq @OpFactoryHelper.OpDeclaration(Shape.NAME) public static final class Shape extends OnnxOp { public static final String NAME = "Shape"; - + public enum Attribute implements OnnxAttribute { start(Long.class, true, 0), end(Long.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { shape(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -26718,50 +26718,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Shape(ExternalizedOp def) { super(SCHEMA, def); } - + Shape(Shape that, CodeContext cc) { super(that, cc); } - + @Override public Shape transform(CodeContext cc, CodeTransformer ot) { return new Shape(this, cc); } - + Shape(CodeType resultType, Value data, java.util.Optional start, java.util.Optional end) { super(SCHEMA, resultType, Set.of(), List.of(data), List.of(start, end)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional start() { Long start = Attribute.start.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(start); } - + public java.util.Optional end() { Long end = Attribute.end.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(end); } - + } - + public static Shape Shape(CodeType resultType, Value data, java.util.Optional start, java.util.Optional end) { return new Shape(resultType, data, start, end); } @@ -26769,99 +26769,99 @@ public static Shape Shape(CodeType resultType, Value data, java.util.Optional t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -26869,50 +26869,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Shrink(ExternalizedOp def) { super(SCHEMA, def); } - + Shrink(Shrink that, CodeContext cc) { super(that, cc); } - + @Override public Shrink transform(CodeContext cc, CodeTransformer ot) { return new Shrink(this, cc); } - + Shrink(CodeType resultType, Value input, java.util.Optional lambd, java.util.Optional bias) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(lambd, bias)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional lambd() { Float lambd = Attribute.lambd.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(lambd); } - + public java.util.Optional bias() { Float bias = Attribute.bias.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(bias); } - + } - + public static Shrink Shrink(CodeType resultType, Value input, java.util.Optional lambd, java.util.Optional bias) { return new Shrink(resultType, input, lambd, bias); } @@ -26920,72 +26920,72 @@ public static Shrink Shrink(CodeType resultType, Value input, java.util.Optional @OpFactoryHelper.OpDeclaration(Sigmoid.NAME) public static final class Sigmoid extends OnnxOp { public static final String NAME = "Sigmoid"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -26993,40 +26993,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Sigmoid(ExternalizedOp def) { super(SCHEMA, def); } - + Sigmoid(Sigmoid that, CodeContext cc) { super(that, cc); } - + @Override public Sigmoid transform(CodeContext cc, CodeTransformer ot) { return new Sigmoid(this, cc); } - + Sigmoid(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Sigmoid Sigmoid(CodeType resultType, Value X) { return new Sigmoid(resultType, X); } @@ -27034,72 +27034,72 @@ public static Sigmoid Sigmoid(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(Sign.NAME) public static final class Sign extends OnnxOp { public static final String NAME = "Sign"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -27107,40 +27107,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Sign(ExternalizedOp def) { super(SCHEMA, def); } - + Sign(Sign that, CodeContext cc) { super(that, cc); } - + @Override public Sign transform(CodeContext cc, CodeTransformer ot) { return new Sign(this, cc); } - + Sign(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Sign Sign(CodeType resultType, Value input) { return new Sign(resultType, input); } @@ -27148,72 +27148,72 @@ public static Sign Sign(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Sin.NAME) public static final class Sin extends OnnxOp { public static final String NAME = "Sin"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -27221,40 +27221,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Sin(ExternalizedOp def) { super(SCHEMA, def); } - + Sin(Sin that, CodeContext cc) { super(that, cc); } - + @Override public Sin transform(CodeContext cc, CodeTransformer ot) { return new Sin(this, cc); } - + Sin(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Sin Sin(CodeType resultType, Value input) { return new Sin(resultType, input); } @@ -27262,72 +27262,72 @@ public static Sin Sin(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Sinh.NAME) public static final class Sinh extends OnnxOp { public static final String NAME = "Sinh"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -27335,40 +27335,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Sinh(ExternalizedOp def) { super(SCHEMA, def); } - + Sinh(Sinh that, CodeContext cc) { super(that, cc); } - + @Override public Sinh transform(CodeContext cc, CodeTransformer ot) { return new Sinh(this, cc); } - + Sinh(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Sinh Sinh(CodeType resultType, Value input) { return new Sinh(resultType, input); } @@ -27376,73 +27376,73 @@ public static Sinh Sinh(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Size.NAME) public static final class Size extends OnnxOp { public static final String NAME = "Size"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { size(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -27450,40 +27450,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Size(ExternalizedOp def) { super(SCHEMA, def); } - + Size(Size that, CodeContext cc) { super(that, cc); } - + @Override public Size transform(CodeContext cc, CodeTransformer ot) { return new Size(this, cc); } - + Size(CodeType resultType, Value data) { super(SCHEMA, resultType, Set.of(), List.of(data), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data())); } - + public Value data() { return operands().get(0); } - + } - + public static Size Size(CodeType resultType, Value data) { return new Size(resultType, data); } @@ -27491,27 +27491,27 @@ public static Size Size(CodeType resultType, Value data) { @OpFactoryHelper.OpDeclaration(Slice.NAME) public static final class Slice extends OnnxOp { public static final String NAME = "Slice"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), starts(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED), @@ -27519,49 +27519,49 @@ public enum InputParameter implements OnnxParameter { axes(TypeConstraint.Tind.typeVariable(), Quantifier.OPTIONAL), steps(TypeConstraint.Tind.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -27569,58 +27569,58 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Slice(ExternalizedOp def) { super(SCHEMA, def); } - + Slice(Slice that, CodeContext cc) { super(that, cc); } - + @Override public Slice transform(CodeContext cc, CodeTransformer ot) { return new Slice(this, cc); } - + Slice(CodeType resultType, Value data, Value starts, Value ends, java.util.Optional axes, java.util.Optional steps) { super(SCHEMA, resultType, Set.of(), List.of(data, starts, ends, axes, steps), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), starts(), ends(), axes(), steps())); } - + public Value data() { return operands().get(0); } - + public Value starts() { return operands().get(1); } - + public Value ends() { return operands().get(2); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + public java.util.Optional steps() { int i = optionalInputArguments.indexOf(InputParameter.steps); return i != -1 ? java.util.Optional.of(operands().get(3 + i)) : java.util.Optional.empty(); } - + } - + public static Slice Slice(CodeType resultType, Value data, Value starts, Value ends, java.util.Optional axes, java.util.Optional steps) { return new Slice(resultType, data, starts, ends, axes, steps); } @@ -27628,98 +27628,98 @@ public static Slice Slice(CodeType resultType, Value data, Value starts, Value e @OpFactoryHelper.OpDeclaration(Softmax.NAME) public static final class Softmax extends OnnxOp { public static final String NAME = "Softmax"; - + public enum Attribute implements OnnxAttribute { axis(Long.class, true, -1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -27727,45 +27727,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Softmax(ExternalizedOp def) { super(SCHEMA, def); } - + Softmax(Softmax that, CodeContext cc) { super(that, cc); } - + @Override public Softmax transform(CodeContext cc, CodeTransformer ot) { return new Softmax(this, cc); } - + Softmax(CodeType resultType, Value input, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static Softmax Softmax(CodeType resultType, Value input, java.util.Optional axis) { return new Softmax(resultType, input, axis); } @@ -27773,103 +27773,103 @@ public static Softmax Softmax(CodeType resultType, Value input, java.util.Option @OpFactoryHelper.OpDeclaration(SoftmaxCrossEntropyLoss.NAME) public static final class SoftmaxCrossEntropyLoss extends OnnxOp { public static final String NAME = "SoftmaxCrossEntropyLoss"; - + public enum Attribute implements OnnxAttribute { ignore_index(Long.class, true, null), reduction(String.class, true, "mean"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), Tind(new OnnxType.TypeVariable("Tind", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { scores(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), labels(TypeConstraint.Tind.typeVariable(), Quantifier.REQUIRED), weights(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), log_prob(TypeConstraint.T.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -27877,59 +27877,59 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public SoftmaxCrossEntropyLoss(ExternalizedOp def) { super(SCHEMA, def); } - + SoftmaxCrossEntropyLoss(SoftmaxCrossEntropyLoss that, CodeContext cc) { super(that, cc); } - + @Override public SoftmaxCrossEntropyLoss transform(CodeContext cc, CodeTransformer ot) { return new SoftmaxCrossEntropyLoss(this, cc); } - + SoftmaxCrossEntropyLoss(CodeType resultType, Set optionalOutputs, Value scores, Value labels, java.util.Optional weights, java.util.Optional ignore_index, java.util.Optional reduction) { super(SCHEMA, resultType, optionalOutputs, List.of(scores, labels, weights), List.of(ignore_index, reduction)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(scores(), labels(), weights())); } - + public Value scores() { return operands().get(0); } - + public Value labels() { return operands().get(1); } - + public java.util.Optional weights() { int i = optionalInputArguments.indexOf(InputParameter.weights); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional ignore_index() { Long ignore_index = Attribute.ignore_index.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(ignore_index); } - + public java.util.Optional reduction() { String reduction = Attribute.reduction.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(reduction); } - + } - + public static SoftmaxCrossEntropyLoss SoftmaxCrossEntropyLoss(CodeType resultType, Set optionalOutputs, Value scores, Value labels, java.util.Optional weights, java.util.Optional ignore_index, java.util.Optional reduction) { return new SoftmaxCrossEntropyLoss(resultType, optionalOutputs, scores, labels, weights, ignore_index, reduction); } @@ -27937,72 +27937,72 @@ public static SoftmaxCrossEntropyLoss SoftmaxCrossEntropyLoss(CodeType resultTyp @OpFactoryHelper.OpDeclaration(Softplus.NAME) public static final class Softplus extends OnnxOp { public static final String NAME = "Softplus"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -28010,40 +28010,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Softplus(ExternalizedOp def) { super(SCHEMA, def); } - + Softplus(Softplus that, CodeContext cc) { super(that, cc); } - + @Override public Softplus transform(CodeContext cc, CodeTransformer ot) { return new Softplus(this, cc); } - + Softplus(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Softplus Softplus(CodeType resultType, Value X) { return new Softplus(resultType, X); } @@ -28051,72 +28051,72 @@ public static Softplus Softplus(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(Softsign.NAME) public static final class Softsign extends OnnxOp { public static final String NAME = "Softsign"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -28124,40 +28124,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Softsign(ExternalizedOp def) { super(SCHEMA, def); } - + Softsign(Softsign that, CodeContext cc) { super(that, cc); } - + @Override public Softsign transform(CodeContext cc, CodeTransformer ot) { return new Softsign(this, cc); } - + Softsign(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Softsign Softsign(CodeType resultType, Value input) { return new Softsign(resultType, input); } @@ -28165,98 +28165,98 @@ public static Softsign Softsign(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(SpaceToDepth.NAME) public static final class SpaceToDepth extends OnnxOp { public static final String NAME = "SpaceToDepth"; - + public enum Attribute implements OnnxAttribute { blocksize(Long.class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -28264,45 +28264,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public SpaceToDepth(ExternalizedOp def) { super(SCHEMA, def); } - + SpaceToDepth(SpaceToDepth that, CodeContext cc) { super(that, cc); } - + @Override public SpaceToDepth transform(CodeContext cc, CodeTransformer ot) { return new SpaceToDepth(this, cc); } - + SpaceToDepth(CodeType resultType, Value input, long blocksize) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of(blocksize)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + public long blocksize() { long blocksize = Attribute.blocksize.access(Long.class, onnxAttributes); return blocksize; } - + } - + public static SpaceToDepth SpaceToDepth(CodeType resultType, Value input, long blocksize) { return new SpaceToDepth(resultType, input, blocksize); } @@ -28310,100 +28310,100 @@ public static SpaceToDepth SpaceToDepth(CodeType resultType, Value input, long b @OpFactoryHelper.OpDeclaration(Split.NAME) public static final class Split extends OnnxOp { public static final String NAME = "Split"; - + public enum Attribute implements OnnxAttribute { num_outputs(Long.class, true, null), axis(Long.class, true, 0), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), split(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { outputs(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -28411,55 +28411,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Split(ExternalizedOp def) { super(SCHEMA, def); } - + Split(Split that, CodeContext cc) { super(that, cc); } - + @Override public Split transform(CodeContext cc, CodeTransformer ot) { return new Split(this, cc); } - + Split(CodeType resultType, Value input, java.util.Optional split, java.util.Optional num_outputs, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(input, split), List.of(num_outputs, axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), split())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional split() { int i = optionalInputArguments.indexOf(InputParameter.split); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional num_outputs() { Long num_outputs = Attribute.num_outputs.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(num_outputs); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static Split Split(CodeType resultType, Value input, java.util.Optional split, java.util.Optional num_outputs, java.util.Optional axis) { return new Split(resultType, input, split, num_outputs, axis); } @@ -28467,102 +28467,102 @@ public static Split Split(CodeType resultType, Value input, java.util.Optional t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), S(new OnnxType.TypeVariable("S", List.of(OnnxType.seq(OnnxType.tensor(OnnxType.uint8())), OnnxType.seq(OnnxType.tensor(OnnxType.uint16())), OnnxType.seq(OnnxType.tensor(OnnxType.uint32())), OnnxType.seq(OnnxType.tensor(OnnxType.uint64())), OnnxType.seq(OnnxType.tensor(OnnxType.int8())), OnnxType.seq(OnnxType.tensor(OnnxType.int16())), OnnxType.seq(OnnxType.tensor(OnnxType.int32())), OnnxType.seq(OnnxType.tensor(OnnxType.int64())), OnnxType.seq(OnnxType.tensor(OnnxType.bfloat16())), OnnxType.seq(OnnxType.tensor(OnnxType.float16())), OnnxType.seq(OnnxType.tensor(OnnxType.float32())), OnnxType.seq(OnnxType.tensor(OnnxType.float64())), OnnxType.seq(OnnxType.tensor(OnnxType.string())), OnnxType.seq(OnnxType.tensor(OnnxType.bool())), OnnxType.seq(OnnxType.tensor(OnnxType.complex64())), OnnxType.seq(OnnxType.tensor(OnnxType.complex128()))))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), split(TypeConstraint.I.typeVariable(), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output_sequence(TypeConstraint.S.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -28570,55 +28570,55 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public SplitToSequence(ExternalizedOp def) { super(SCHEMA, def); } - + SplitToSequence(SplitToSequence that, CodeContext cc) { super(that, cc); } - + @Override public SplitToSequence transform(CodeContext cc, CodeTransformer ot) { return new SplitToSequence(this, cc); } - + SplitToSequence(CodeType resultType, Value input, java.util.Optional split, java.util.Optional keepdims, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(input, split), List.of(keepdims, axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), split())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional split() { int i = optionalInputArguments.indexOf(InputParameter.split); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional keepdims() { Long keepdims = Attribute.keepdims.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(keepdims); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static SplitToSequence SplitToSequence(CodeType resultType, Value input, java.util.Optional split, java.util.Optional keepdims, java.util.Optional axis) { return new SplitToSequence(resultType, input, split, keepdims, axis); } @@ -28626,72 +28626,72 @@ public static SplitToSequence SplitToSequence(CodeType resultType, Value input, @OpFactoryHelper.OpDeclaration(Sqrt.NAME) public static final class Sqrt extends OnnxOp { public static final String NAME = "Sqrt"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -28699,40 +28699,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Sqrt(ExternalizedOp def) { super(SCHEMA, def); } - + Sqrt(Sqrt that, CodeContext cc) { super(that, cc); } - + @Override public Sqrt transform(CodeContext cc, CodeTransformer ot) { return new Sqrt(this, cc); } - + Sqrt(CodeType resultType, Value X) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + } - + public static Sqrt Sqrt(CodeType resultType, Value X) { return new Sqrt(resultType, X); } @@ -28740,73 +28740,73 @@ public static Sqrt Sqrt(CodeType resultType, Value X) { @OpFactoryHelper.OpDeclaration(Squeeze.NAME) public static final class Squeeze extends OnnxOp { public static final String NAME = "Squeeze"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { squeezed(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -28814,45 +28814,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Squeeze(ExternalizedOp def) { super(SCHEMA, def); } - + Squeeze(Squeeze that, CodeContext cc) { super(that, cc); } - + @Override public Squeeze transform(CodeContext cc, CodeTransformer ot) { return new Squeeze(this, cc); } - + Squeeze(CodeType resultType, Value data, java.util.Optional axes) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional axes() { int i = optionalInputArguments.indexOf(InputParameter.axes); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + } - + public static Squeeze Squeeze(CodeType resultType, Value data, java.util.Optional axes) { return new Squeeze(resultType, data, axes); } @@ -28860,73 +28860,73 @@ public static Squeeze Squeeze(CodeType resultType, Value data, java.util.Optiona @OpFactoryHelper.OpDeclaration(StringConcat.NAME) public static final class StringConcat extends OnnxOp { public static final String NAME = "StringConcat"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.string())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Z(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -28934,44 +28934,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public StringConcat(ExternalizedOp def) { super(SCHEMA, def); } - + StringConcat(StringConcat that, CodeContext cc) { super(that, cc); } - + @Override public StringConcat transform(CodeContext cc, CodeTransformer ot) { return new StringConcat(this, cc); } - + StringConcat(CodeType resultType, Value X, Value Y) { super(SCHEMA, resultType, Set.of(), List.of(X, Y), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), Y())); } - + public Value X() { return operands().get(0); } - + public Value Y() { return operands().get(1); } - + } - + public static StringConcat StringConcat(CodeType resultType, Value X, Value Y) { return new StringConcat(resultType, X, Y); } @@ -28979,86 +28979,86 @@ public static StringConcat StringConcat(CodeType resultType, Value X, Value Y) { @OpFactoryHelper.OpDeclaration(StringNormalizer.NAME) public static final class StringNormalizer extends OnnxOp { public static final String NAME = "StringNormalizer"; - + public enum Attribute implements OnnxAttribute { is_case_sensitive(Long.class, true, 0), locale(String.class, true, null), stopwords(String[].class, true, null), case_change_action(String.class, true, "NONE"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint.None { } - + public enum InputParameter implements OnnxParameter { X(OnnxType.tensor(OnnxType.string()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(OnnxType.tensor(OnnxType.string()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -29066,60 +29066,60 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public StringNormalizer(ExternalizedOp def) { super(SCHEMA, def); } - + StringNormalizer(StringNormalizer that, CodeContext cc) { super(that, cc); } - + @Override public StringNormalizer transform(CodeContext cc, CodeTransformer ot) { return new StringNormalizer(this, cc); } - + StringNormalizer(CodeType resultType, Value X, java.util.Optional is_case_sensitive, java.util.Optional locale, java.util.Optional stopwords, java.util.Optional case_change_action) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(is_case_sensitive, locale, stopwords, case_change_action)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional is_case_sensitive() { Long is_case_sensitive = Attribute.is_case_sensitive.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(is_case_sensitive); } - + public java.util.Optional locale() { String locale = Attribute.locale.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(locale); } - + public java.util.Optional stopwords() { String[] stopwords = Attribute.stopwords.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(stopwords).map(String[]::clone); } - + public java.util.Optional case_change_action() { String case_change_action = Attribute.case_change_action.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(case_change_action); } - + } - + public static StringNormalizer StringNormalizer(CodeType resultType, Value X, java.util.Optional is_case_sensitive, java.util.Optional locale, java.util.Optional stopwords, java.util.Optional case_change_action) { return new StringNormalizer(resultType, X, is_case_sensitive, locale, stopwords, case_change_action); } @@ -29127,102 +29127,102 @@ public static StringNormalizer StringNormalizer(CodeType resultType, Value X, ja @OpFactoryHelper.OpDeclaration(StringSplit.NAME) public static final class StringSplit extends OnnxOp { public static final String NAME = "StringSplit"; - + public enum Attribute implements OnnxAttribute { delimiter(String.class, true, null), maxsplit(Long.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.string())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string())))), T3(new OnnxType.TypeVariable("T3", List.of(OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), Z(TypeConstraint.T3.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -29230,50 +29230,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public StringSplit(ExternalizedOp def) { super(SCHEMA, def); } - + StringSplit(StringSplit that, CodeContext cc) { super(that, cc); } - + @Override public StringSplit transform(CodeContext cc, CodeTransformer ot) { return new StringSplit(this, cc); } - + StringSplit(CodeType resultType, Value X, java.util.Optional delimiter, java.util.Optional maxsplit) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(delimiter, maxsplit)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional delimiter() { String delimiter = Attribute.delimiter.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(delimiter); } - + public java.util.Optional maxsplit() { Long maxsplit = Attribute.maxsplit.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(maxsplit); } - + } - + public static StringSplit StringSplit(CodeType resultType, Value X, java.util.Optional delimiter, java.util.Optional maxsplit) { return new StringSplit(resultType, X, delimiter, maxsplit); } @@ -29281,73 +29281,73 @@ public static StringSplit StringSplit(CodeType resultType, Value X, java.util.Op @OpFactoryHelper.OpDeclaration(Sub.NAME) public static final class Sub extends OnnxOp { public static final String NAME = "Sub"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -29355,44 +29355,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Sub(ExternalizedOp def) { super(SCHEMA, def); } - + Sub(Sub that, CodeContext cc) { super(that, cc); } - + @Override public Sub transform(CodeContext cc, CodeTransformer ot) { return new Sub(this, cc); } - + Sub(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static Sub Sub(CodeType resultType, Value A, Value B) { return new Sub(resultType, A, B); } @@ -29400,72 +29400,72 @@ public static Sub Sub(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(Sum.NAME) public static final class Sum extends OnnxOp { public static final String NAME = "Sum"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data_0(TypeConstraint.T.typeVariable(), Quantifier.VARIADIC), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { sum(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -29473,40 +29473,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Sum(ExternalizedOp def) { super(SCHEMA, def); } - + Sum(Sum that, CodeContext cc) { super(that, cc); } - + @Override public Sum transform(CodeContext cc, CodeTransformer ot) { return new Sum(this, cc); } - + Sum(CodeType resultType, List data_0) { super(SCHEMA, resultType, Set.of(), List.of(data_0), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data_0())); } - + public List data_0() { return operands(); } - + } - + public static Sum Sum(CodeType resultType, List data_0) { return new Sum(resultType, data_0); } @@ -29514,98 +29514,98 @@ public static Sum Sum(CodeType resultType, List data_0) { @OpFactoryHelper.OpDeclaration(Swish.NAME) public static final class Swish extends OnnxOp { public static final String NAME = "Swish"; - + public enum Attribute implements OnnxAttribute { alpha(Float.class, true, 1.0f), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -29613,45 +29613,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Swish(ExternalizedOp def) { super(SCHEMA, def); } - + Swish(Swish that, CodeContext cc) { super(that, cc); } - + @Override public Swish transform(CodeContext cc, CodeTransformer ot) { return new Swish(this, cc); } - + Swish(CodeType resultType, Value X, java.util.Optional alpha) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional alpha() { Float alpha = Attribute.alpha.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(alpha); } - + } - + public static Swish Swish(CodeType resultType, Value X, java.util.Optional alpha) { return new Swish(resultType, X, alpha); } @@ -29659,72 +29659,72 @@ public static Swish Swish(CodeType resultType, Value X, java.util.Optional onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Tan Tan(CodeType resultType, Value input) { return new Tan(resultType, input); } @@ -29773,72 +29773,72 @@ public static Tan Tan(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(Tanh.NAME) public static final class Tanh extends OnnxOp { public static final String NAME = "Tanh"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -29846,40 +29846,40 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Tanh(ExternalizedOp def) { super(SCHEMA, def); } - + Tanh(Tanh that, CodeContext cc) { super(that, cc); } - + @Override public Tanh transform(CodeContext cc, CodeTransformer ot) { return new Tanh(this, cc); } - + Tanh(CodeType resultType, Value input) { super(SCHEMA, resultType, Set.of(), List.of(input), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input())); } - + public Value input() { return operands().get(0); } - + } - + public static Tanh Tanh(CodeType resultType, Value input) { return new Tanh(resultType, input); } @@ -29887,101 +29887,101 @@ public static Tanh Tanh(CodeType resultType, Value input) { @OpFactoryHelper.OpDeclaration(TensorScatter.NAME) public static final class TensorScatter extends OnnxOp { public static final String NAME = "TensorScatter"; - + public enum Attribute implements OnnxAttribute { mode(String.class, true, "linear"), axis(Long.class, true, -2), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { past_cache(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), update(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), write_indices(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { present_cache(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -29989,59 +29989,59 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public TensorScatter(ExternalizedOp def) { super(SCHEMA, def); } - + TensorScatter(TensorScatter that, CodeContext cc) { super(that, cc); } - + @Override public TensorScatter transform(CodeContext cc, CodeTransformer ot) { return new TensorScatter(this, cc); } - + TensorScatter(CodeType resultType, Value past_cache, Value update, java.util.Optional write_indices, java.util.Optional mode, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(past_cache, update, write_indices), List.of(mode, axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(past_cache(), update(), write_indices())); } - + public Value past_cache() { return operands().get(0); } - + public Value update() { return operands().get(1); } - + public java.util.Optional write_indices() { int i = optionalInputArguments.indexOf(InputParameter.write_indices); return i != -1 ? java.util.Optional.of(operands().get(2 + i)) : java.util.Optional.empty(); } - + public java.util.Optional mode() { String mode = Attribute.mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(mode); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static TensorScatter TensorScatter(CodeType resultType, Value past_cache, Value update, java.util.Optional write_indices, java.util.Optional mode, java.util.Optional axis) { return new TensorScatter(resultType, past_cache, update, write_indices, mode, axis); } @@ -30049,7 +30049,7 @@ public static TensorScatter TensorScatter(CodeType resultType, Value past_cache, @OpFactoryHelper.OpDeclaration(TfIdfVectorizer.NAME) public static final class TfIdfVectorizer extends OnnxOp { public static final String NAME = "TfIdfVectorizer"; - + public enum Attribute implements OnnxAttribute { ngram_counts(long[].class, false, null), min_gram_length(Long.class, false, null), @@ -30061,95 +30061,95 @@ public enum Attribute implements OnnxAttribute { weights(float[].class, true, null), ngram_indexes(long[].class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -30157,85 +30157,85 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public TfIdfVectorizer(ExternalizedOp def) { super(SCHEMA, def); } - + TfIdfVectorizer(TfIdfVectorizer that, CodeContext cc) { super(that, cc); } - + @Override public TfIdfVectorizer transform(CodeContext cc, CodeTransformer ot) { return new TfIdfVectorizer(this, cc); } - + TfIdfVectorizer(CodeType resultType, Value X, long[] ngram_counts, long min_gram_length, java.util.Optional pool_strings, String mode, long max_gram_length, long max_skip_count, java.util.Optional pool_int64s, java.util.Optional weights, long[] ngram_indexes) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(ngram_counts, min_gram_length, pool_strings, mode, max_gram_length, max_skip_count, pool_int64s, weights, ngram_indexes)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public long[] ngram_counts() { long[] ngram_counts = Attribute.ngram_counts.access(long[].class, onnxAttributes); return ngram_counts.clone(); } - + public long min_gram_length() { long min_gram_length = Attribute.min_gram_length.access(Long.class, onnxAttributes); return min_gram_length; } - + public java.util.Optional pool_strings() { String[] pool_strings = Attribute.pool_strings.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(pool_strings).map(String[]::clone); } - + public String mode() { String mode = Attribute.mode.access(String.class, onnxAttributes); return mode; } - + public long max_gram_length() { long max_gram_length = Attribute.max_gram_length.access(Long.class, onnxAttributes); return max_gram_length; } - + public long max_skip_count() { long max_skip_count = Attribute.max_skip_count.access(Long.class, onnxAttributes); return max_skip_count; } - + public java.util.Optional pool_int64s() { long[] pool_int64s = Attribute.pool_int64s.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(pool_int64s).map(long[]::clone); } - + public java.util.Optional weights() { float[] weights = Attribute.weights.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(weights).map(float[]::clone); } - + public long[] ngram_indexes() { long[] ngram_indexes = Attribute.ngram_indexes.access(long[].class, onnxAttributes); return ngram_indexes.clone(); } - + } - + public static TfIdfVectorizer TfIdfVectorizer(CodeType resultType, Value X, long[] ngram_counts, long min_gram_length, java.util.Optional pool_strings, String mode, long max_gram_length, long max_skip_count, java.util.Optional pool_int64s, java.util.Optional weights, long[] ngram_indexes) { return new TfIdfVectorizer(resultType, X, ngram_counts, min_gram_length, pool_strings, mode, max_gram_length, max_skip_count, pool_int64s, weights, ngram_indexes); } @@ -30243,98 +30243,98 @@ public static TfIdfVectorizer TfIdfVectorizer(CodeType resultType, Value X, long @OpFactoryHelper.OpDeclaration(ThresholdedRelu.NAME) public static final class ThresholdedRelu extends OnnxOp { public static final String NAME = "ThresholdedRelu"; - + public enum Attribute implements OnnxAttribute { alpha(Float.class, true, 1.0f), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -30342,45 +30342,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ThresholdedRelu(ExternalizedOp def) { super(SCHEMA, def); } - + ThresholdedRelu(ThresholdedRelu that, CodeContext cc) { super(that, cc); } - + @Override public ThresholdedRelu transform(CodeContext cc, CodeTransformer ot) { return new ThresholdedRelu(this, cc); } - + ThresholdedRelu(CodeType resultType, Value X, java.util.Optional alpha) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(alpha)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional alpha() { Float alpha = Attribute.alpha.access(Float.class, onnxAttributes); return java.util.Optional.ofNullable(alpha); } - + } - + public static ThresholdedRelu ThresholdedRelu(CodeType resultType, Value X, java.util.Optional alpha) { return new ThresholdedRelu(resultType, X, alpha); } @@ -30388,74 +30388,74 @@ public static ThresholdedRelu ThresholdedRelu(CodeType resultType, Value X, java @OpFactoryHelper.OpDeclaration(Tile.NAME) public static final class Tile extends OnnxOp { public static final String NAME = "Tile"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), repeats(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -30463,44 +30463,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Tile(ExternalizedOp def) { super(SCHEMA, def); } - + Tile(Tile that, CodeContext cc) { super(that, cc); } - + @Override public Tile transform(CodeContext cc, CodeTransformer ot) { return new Tile(this, cc); } - + Tile(CodeType resultType, Value input, Value repeats) { super(SCHEMA, resultType, Set.of(), List.of(input, repeats), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), repeats())); } - + public Value input() { return operands().get(0); } - + public Value repeats() { return operands().get(1); } - + } - + public static Tile Tile(CodeType resultType, Value input, Value repeats) { return new Tile(resultType, input, repeats); } @@ -30508,103 +30508,103 @@ public static Tile Tile(CodeType resultType, Value input, Value repeats) { @OpFactoryHelper.OpDeclaration(TopK.NAME) public static final class TopK extends OnnxOp { public static final String NAME = "TopK"; - + public enum Attribute implements OnnxAttribute { largest(Long.class, true, 1), sorted(Long.class, true, 1), axis(Long.class, true, -1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.bfloat16())))), I(new OnnxType.TypeVariable("I", List.of(OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), K(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Values(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), Indices(TypeConstraint.I.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -30612,59 +30612,59 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public TopK(ExternalizedOp def) { super(SCHEMA, def); } - + TopK(TopK that, CodeContext cc) { super(that, cc); } - + @Override public TopK transform(CodeContext cc, CodeTransformer ot) { return new TopK(this, cc); } - + TopK(CodeType resultType, Value X, Value K, java.util.Optional largest, java.util.Optional sorted, java.util.Optional axis) { super(SCHEMA, resultType, Set.of(), List.of(X, K), List.of(largest, sorted, axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), K())); } - + public Value X() { return operands().get(0); } - + public Value K() { return operands().get(1); } - + public java.util.Optional largest() { Long largest = Attribute.largest.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(largest); } - + public java.util.Optional sorted() { Long sorted = Attribute.sorted.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(sorted); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static TopK TopK(CodeType resultType, Value X, Value K, java.util.Optional largest, java.util.Optional sorted, java.util.Optional axis) { return new TopK(resultType, X, K, largest, sorted, axis); } @@ -30672,98 +30672,98 @@ public static TopK TopK(CodeType resultType, Value X, Value K, java.util.Optiona @OpFactoryHelper.OpDeclaration(Transpose.NAME) public static final class Transpose extends OnnxOp { public static final String NAME = "Transpose"; - + public enum Attribute implements OnnxAttribute { perm(long[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { transposed(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -30771,45 +30771,45 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Transpose(ExternalizedOp def) { super(SCHEMA, def); } - + Transpose(Transpose that, CodeContext cc) { super(that, cc); } - + @Override public Transpose transform(CodeContext cc, CodeTransformer ot) { return new Transpose(this, cc); } - + Transpose(CodeType resultType, Value data, java.util.Optional perm) { super(SCHEMA, resultType, Set.of(), List.of(data), List.of(perm)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data())); } - + public Value data() { return operands().get(0); } - + public java.util.Optional perm() { long[] perm = Attribute.perm.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(perm).map(long[]::clone); } - + } - + public static Transpose Transpose(CodeType resultType, Value data, java.util.Optional perm) { return new Transpose(resultType, data, perm); } @@ -30817,7 +30817,7 @@ public static Transpose Transpose(CodeType resultType, Value data, java.util.Opt @OpFactoryHelper.OpDeclaration(TreeEnsemble.NAME) public static final class TreeEnsemble extends OnnxOp { public static final String NAME = "TreeEnsemble"; - + public enum Attribute implements OnnxAttribute { aggregate_function(Long.class, true, 1), nodes_hitrates(Tensor.class, true, null), @@ -30836,94 +30836,94 @@ public enum Attribute implements OnnxAttribute { membership_values(Tensor.class, true, null), nodes_splits(Tensor.class, false, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.float16())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -30931,120 +30931,120 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public TreeEnsemble(ExternalizedOp def) { super(SCHEMA, def); } - + TreeEnsemble(TreeEnsemble that, CodeContext cc) { super(that, cc); } - + @Override public TreeEnsemble transform(CodeContext cc, CodeTransformer ot) { return new TreeEnsemble(this, cc); } - + TreeEnsemble(CodeType resultType, Value X, java.util.Optional aggregate_function, java.util.Optional nodes_hitrates, long[] nodes_featureids, long[] nodes_falseleafs, java.util.Optional post_transform, long[] nodes_trueleafs, Tensor nodes_modes, long[] nodes_falsenodeids, long[] nodes_truenodeids, Tensor leaf_weights, long[] leaf_targetids, long[] tree_roots, java.util.Optional n_targets, java.util.Optional nodes_missing_value_tracks_true, java.util.Optional membership_values, Tensor nodes_splits) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(aggregate_function, nodes_hitrates, nodes_featureids, nodes_falseleafs, post_transform, nodes_trueleafs, nodes_modes, nodes_falsenodeids, nodes_truenodeids, leaf_weights, leaf_targetids, tree_roots, n_targets, nodes_missing_value_tracks_true, membership_values, nodes_splits)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional aggregate_function() { Long aggregate_function = Attribute.aggregate_function.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(aggregate_function); } - + public java.util.Optional nodes_hitrates() { Tensor nodes_hitrates = Attribute.nodes_hitrates.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(nodes_hitrates); } - + public long[] nodes_featureids() { long[] nodes_featureids = Attribute.nodes_featureids.access(long[].class, onnxAttributes); return nodes_featureids.clone(); } - + public long[] nodes_falseleafs() { long[] nodes_falseleafs = Attribute.nodes_falseleafs.access(long[].class, onnxAttributes); return nodes_falseleafs.clone(); } - + public java.util.Optional post_transform() { Long post_transform = Attribute.post_transform.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(post_transform); } - + public long[] nodes_trueleafs() { long[] nodes_trueleafs = Attribute.nodes_trueleafs.access(long[].class, onnxAttributes); return nodes_trueleafs.clone(); } - + public Tensor nodes_modes() { Tensor nodes_modes = Attribute.nodes_modes.access(Tensor.class, onnxAttributes); return nodes_modes; } - + public long[] nodes_falsenodeids() { long[] nodes_falsenodeids = Attribute.nodes_falsenodeids.access(long[].class, onnxAttributes); return nodes_falsenodeids.clone(); } - + public long[] nodes_truenodeids() { long[] nodes_truenodeids = Attribute.nodes_truenodeids.access(long[].class, onnxAttributes); return nodes_truenodeids.clone(); } - + public Tensor leaf_weights() { Tensor leaf_weights = Attribute.leaf_weights.access(Tensor.class, onnxAttributes); return leaf_weights; } - + public long[] leaf_targetids() { long[] leaf_targetids = Attribute.leaf_targetids.access(long[].class, onnxAttributes); return leaf_targetids.clone(); } - + public long[] tree_roots() { long[] tree_roots = Attribute.tree_roots.access(long[].class, onnxAttributes); return tree_roots.clone(); } - + public java.util.Optional n_targets() { Long n_targets = Attribute.n_targets.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(n_targets); } - + public java.util.Optional nodes_missing_value_tracks_true() { long[] nodes_missing_value_tracks_true = Attribute.nodes_missing_value_tracks_true.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_missing_value_tracks_true).map(long[]::clone); } - + public java.util.Optional membership_values() { Tensor membership_values = Attribute.membership_values.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(membership_values); } - + public Tensor nodes_splits() { Tensor nodes_splits = Attribute.nodes_splits.access(Tensor.class, onnxAttributes); return nodes_splits; } - + } - + public static TreeEnsemble TreeEnsemble(CodeType resultType, Value X, java.util.Optional aggregate_function, java.util.Optional nodes_hitrates, long[] nodes_featureids, long[] nodes_falseleafs, java.util.Optional post_transform, long[] nodes_trueleafs, Tensor nodes_modes, long[] nodes_falsenodeids, long[] nodes_truenodeids, Tensor leaf_weights, long[] leaf_targetids, long[] tree_roots, java.util.Optional n_targets, java.util.Optional nodes_missing_value_tracks_true, java.util.Optional membership_values, Tensor nodes_splits) { return new TreeEnsemble(resultType, X, aggregate_function, nodes_hitrates, nodes_featureids, nodes_falseleafs, post_transform, nodes_trueleafs, nodes_modes, nodes_falsenodeids, nodes_truenodeids, leaf_weights, leaf_targetids, tree_roots, n_targets, nodes_missing_value_tracks_true, membership_values, nodes_splits); } @@ -31052,7 +31052,7 @@ public static TreeEnsemble TreeEnsemble(CodeType resultType, Value X, java.util. @OpFactoryHelper.OpDeclaration(TreeEnsembleClassifier.NAME) public static final class TreeEnsembleClassifier extends OnnxOp { public static final String NAME = "TreeEnsembleClassifier"; - + public enum Attribute implements OnnxAttribute { classlabels_int64s(long[].class, true, null), class_ids(long[].class, true, null), @@ -31076,96 +31076,96 @@ public enum Attribute implements OnnxAttribute { nodes_values(float[].class, true, null), nodes_values_as_tensor(Tensor.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))), T2(new OnnxType.TypeVariable("T2", List.of(OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.int64())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T2.typeVariable(), Quantifier.REQUIRED), Z(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -31173,145 +31173,145 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public TreeEnsembleClassifier(ExternalizedOp def) { super(SCHEMA, def); } - + TreeEnsembleClassifier(TreeEnsembleClassifier that, CodeContext cc) { super(that, cc); } - + @Override public TreeEnsembleClassifier transform(CodeContext cc, CodeTransformer ot) { return new TreeEnsembleClassifier(this, cc); } - + TreeEnsembleClassifier(CodeType resultType, Value X, java.util.Optional classlabels_int64s, java.util.Optional class_ids, java.util.Optional nodes_hitrates, java.util.Optional nodes_featureids, java.util.Optional nodes_treeids, java.util.Optional class_weights_as_tensor, java.util.Optional post_transform, java.util.Optional nodes_modes, java.util.Optional nodes_falsenodeids, java.util.Optional classlabels_strings, java.util.Optional nodes_truenodeids, java.util.Optional nodes_nodeids, java.util.Optional nodes_hitrates_as_tensor, java.util.Optional class_weights, java.util.Optional base_values_as_tensor, java.util.Optional nodes_missing_value_tracks_true, java.util.Optional class_nodeids, java.util.Optional class_treeids, java.util.Optional base_values, java.util.Optional nodes_values, java.util.Optional nodes_values_as_tensor) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(classlabels_int64s, class_ids, nodes_hitrates, nodes_featureids, nodes_treeids, class_weights_as_tensor, post_transform, nodes_modes, nodes_falsenodeids, classlabels_strings, nodes_truenodeids, nodes_nodeids, nodes_hitrates_as_tensor, class_weights, base_values_as_tensor, nodes_missing_value_tracks_true, class_nodeids, class_treeids, base_values, nodes_values, nodes_values_as_tensor)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional classlabels_int64s() { long[] classlabels_int64s = Attribute.classlabels_int64s.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(classlabels_int64s).map(long[]::clone); } - + public java.util.Optional class_ids() { long[] class_ids = Attribute.class_ids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(class_ids).map(long[]::clone); } - + public java.util.Optional nodes_hitrates() { float[] nodes_hitrates = Attribute.nodes_hitrates.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_hitrates).map(float[]::clone); } - + public java.util.Optional nodes_featureids() { long[] nodes_featureids = Attribute.nodes_featureids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_featureids).map(long[]::clone); } - + public java.util.Optional nodes_treeids() { long[] nodes_treeids = Attribute.nodes_treeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_treeids).map(long[]::clone); } - + public java.util.Optional class_weights_as_tensor() { Tensor class_weights_as_tensor = Attribute.class_weights_as_tensor.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(class_weights_as_tensor); } - + public java.util.Optional post_transform() { String post_transform = Attribute.post_transform.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(post_transform); } - + public java.util.Optional nodes_modes() { String[] nodes_modes = Attribute.nodes_modes.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_modes).map(String[]::clone); } - + public java.util.Optional nodes_falsenodeids() { long[] nodes_falsenodeids = Attribute.nodes_falsenodeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_falsenodeids).map(long[]::clone); } - + public java.util.Optional classlabels_strings() { String[] classlabels_strings = Attribute.classlabels_strings.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(classlabels_strings).map(String[]::clone); } - + public java.util.Optional nodes_truenodeids() { long[] nodes_truenodeids = Attribute.nodes_truenodeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_truenodeids).map(long[]::clone); } - + public java.util.Optional nodes_nodeids() { long[] nodes_nodeids = Attribute.nodes_nodeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_nodeids).map(long[]::clone); } - + public java.util.Optional nodes_hitrates_as_tensor() { Tensor nodes_hitrates_as_tensor = Attribute.nodes_hitrates_as_tensor.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(nodes_hitrates_as_tensor); } - + public java.util.Optional class_weights() { float[] class_weights = Attribute.class_weights.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(class_weights).map(float[]::clone); } - + public java.util.Optional base_values_as_tensor() { Tensor base_values_as_tensor = Attribute.base_values_as_tensor.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(base_values_as_tensor); } - + public java.util.Optional nodes_missing_value_tracks_true() { long[] nodes_missing_value_tracks_true = Attribute.nodes_missing_value_tracks_true.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_missing_value_tracks_true).map(long[]::clone); } - + public java.util.Optional class_nodeids() { long[] class_nodeids = Attribute.class_nodeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(class_nodeids).map(long[]::clone); } - + public java.util.Optional class_treeids() { long[] class_treeids = Attribute.class_treeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(class_treeids).map(long[]::clone); } - + public java.util.Optional base_values() { float[] base_values = Attribute.base_values.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(base_values).map(float[]::clone); } - + public java.util.Optional nodes_values() { float[] nodes_values = Attribute.nodes_values.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_values).map(float[]::clone); } - + public java.util.Optional nodes_values_as_tensor() { Tensor nodes_values_as_tensor = Attribute.nodes_values_as_tensor.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(nodes_values_as_tensor); } - + } - + public static TreeEnsembleClassifier TreeEnsembleClassifier(CodeType resultType, Value X, java.util.Optional classlabels_int64s, java.util.Optional class_ids, java.util.Optional nodes_hitrates, java.util.Optional nodes_featureids, java.util.Optional nodes_treeids, java.util.Optional class_weights_as_tensor, java.util.Optional post_transform, java.util.Optional nodes_modes, java.util.Optional nodes_falsenodeids, java.util.Optional classlabels_strings, java.util.Optional nodes_truenodeids, java.util.Optional nodes_nodeids, java.util.Optional nodes_hitrates_as_tensor, java.util.Optional class_weights, java.util.Optional base_values_as_tensor, java.util.Optional nodes_missing_value_tracks_true, java.util.Optional class_nodeids, java.util.Optional class_treeids, java.util.Optional base_values, java.util.Optional nodes_values, java.util.Optional nodes_values_as_tensor) { return new TreeEnsembleClassifier(resultType, X, classlabels_int64s, class_ids, nodes_hitrates, nodes_featureids, nodes_treeids, class_weights_as_tensor, post_transform, nodes_modes, nodes_falsenodeids, classlabels_strings, nodes_truenodeids, nodes_nodeids, nodes_hitrates_as_tensor, class_weights, base_values_as_tensor, nodes_missing_value_tracks_true, class_nodeids, class_treeids, base_values, nodes_values, nodes_values_as_tensor); } @@ -31319,7 +31319,7 @@ public static TreeEnsembleClassifier TreeEnsembleClassifier(CodeType resultType, @OpFactoryHelper.OpDeclaration(TreeEnsembleRegressor.NAME) public static final class TreeEnsembleRegressor extends OnnxOp { public static final String NAME = "TreeEnsembleRegressor"; - + public enum Attribute implements OnnxAttribute { aggregate_function(String.class, true, "SUM"), nodes_hitrates(float[].class, true, null), @@ -31343,94 +31343,94 @@ public enum Attribute implements OnnxAttribute { nodes_values(float[].class, true, null), nodes_values_as_tensor(Tensor.class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.int32())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -31438,145 +31438,145 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public TreeEnsembleRegressor(ExternalizedOp def) { super(SCHEMA, def); } - + TreeEnsembleRegressor(TreeEnsembleRegressor that, CodeContext cc) { super(that, cc); } - + @Override public TreeEnsembleRegressor transform(CodeContext cc, CodeTransformer ot) { return new TreeEnsembleRegressor(this, cc); } - + TreeEnsembleRegressor(CodeType resultType, Value X, java.util.Optional aggregate_function, java.util.Optional nodes_hitrates, java.util.Optional target_weights_as_tensor, java.util.Optional nodes_featureids, java.util.Optional target_treeids, java.util.Optional nodes_treeids, java.util.Optional post_transform, java.util.Optional nodes_modes, java.util.Optional target_weights, java.util.Optional nodes_falsenodeids, java.util.Optional target_ids, java.util.Optional nodes_truenodeids, java.util.Optional target_nodeids, java.util.Optional nodes_nodeids, java.util.Optional nodes_hitrates_as_tensor, java.util.Optional base_values_as_tensor, java.util.Optional n_targets, java.util.Optional nodes_missing_value_tracks_true, java.util.Optional base_values, java.util.Optional nodes_values, java.util.Optional nodes_values_as_tensor) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(aggregate_function, nodes_hitrates, target_weights_as_tensor, nodes_featureids, target_treeids, nodes_treeids, post_transform, nodes_modes, target_weights, nodes_falsenodeids, target_ids, nodes_truenodeids, target_nodeids, nodes_nodeids, nodes_hitrates_as_tensor, base_values_as_tensor, n_targets, nodes_missing_value_tracks_true, base_values, nodes_values, nodes_values_as_tensor)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional aggregate_function() { String aggregate_function = Attribute.aggregate_function.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(aggregate_function); } - + public java.util.Optional nodes_hitrates() { float[] nodes_hitrates = Attribute.nodes_hitrates.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_hitrates).map(float[]::clone); } - + public java.util.Optional target_weights_as_tensor() { Tensor target_weights_as_tensor = Attribute.target_weights_as_tensor.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(target_weights_as_tensor); } - + public java.util.Optional nodes_featureids() { long[] nodes_featureids = Attribute.nodes_featureids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_featureids).map(long[]::clone); } - + public java.util.Optional target_treeids() { long[] target_treeids = Attribute.target_treeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(target_treeids).map(long[]::clone); } - + public java.util.Optional nodes_treeids() { long[] nodes_treeids = Attribute.nodes_treeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_treeids).map(long[]::clone); } - + public java.util.Optional post_transform() { String post_transform = Attribute.post_transform.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(post_transform); } - + public java.util.Optional nodes_modes() { String[] nodes_modes = Attribute.nodes_modes.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_modes).map(String[]::clone); } - + public java.util.Optional target_weights() { float[] target_weights = Attribute.target_weights.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(target_weights).map(float[]::clone); } - + public java.util.Optional nodes_falsenodeids() { long[] nodes_falsenodeids = Attribute.nodes_falsenodeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_falsenodeids).map(long[]::clone); } - + public java.util.Optional target_ids() { long[] target_ids = Attribute.target_ids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(target_ids).map(long[]::clone); } - + public java.util.Optional nodes_truenodeids() { long[] nodes_truenodeids = Attribute.nodes_truenodeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_truenodeids).map(long[]::clone); } - + public java.util.Optional target_nodeids() { long[] target_nodeids = Attribute.target_nodeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(target_nodeids).map(long[]::clone); } - + public java.util.Optional nodes_nodeids() { long[] nodes_nodeids = Attribute.nodes_nodeids.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_nodeids).map(long[]::clone); } - + public java.util.Optional nodes_hitrates_as_tensor() { Tensor nodes_hitrates_as_tensor = Attribute.nodes_hitrates_as_tensor.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(nodes_hitrates_as_tensor); } - + public java.util.Optional base_values_as_tensor() { Tensor base_values_as_tensor = Attribute.base_values_as_tensor.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(base_values_as_tensor); } - + public java.util.Optional n_targets() { Long n_targets = Attribute.n_targets.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(n_targets); } - + public java.util.Optional nodes_missing_value_tracks_true() { long[] nodes_missing_value_tracks_true = Attribute.nodes_missing_value_tracks_true.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_missing_value_tracks_true).map(long[]::clone); } - + public java.util.Optional base_values() { float[] base_values = Attribute.base_values.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(base_values).map(float[]::clone); } - + public java.util.Optional nodes_values() { float[] nodes_values = Attribute.nodes_values.access(float[].class, onnxAttributes); return java.util.Optional.ofNullable(nodes_values).map(float[]::clone); } - + public java.util.Optional nodes_values_as_tensor() { Tensor nodes_values_as_tensor = Attribute.nodes_values_as_tensor.access(Tensor.class, onnxAttributes); return java.util.Optional.ofNullable(nodes_values_as_tensor); } - + } - + public static TreeEnsembleRegressor TreeEnsembleRegressor(CodeType resultType, Value X, java.util.Optional aggregate_function, java.util.Optional nodes_hitrates, java.util.Optional target_weights_as_tensor, java.util.Optional nodes_featureids, java.util.Optional target_treeids, java.util.Optional nodes_treeids, java.util.Optional post_transform, java.util.Optional nodes_modes, java.util.Optional target_weights, java.util.Optional nodes_falsenodeids, java.util.Optional target_ids, java.util.Optional nodes_truenodeids, java.util.Optional target_nodeids, java.util.Optional nodes_nodeids, java.util.Optional nodes_hitrates_as_tensor, java.util.Optional base_values_as_tensor, java.util.Optional n_targets, java.util.Optional nodes_missing_value_tracks_true, java.util.Optional base_values, java.util.Optional nodes_values, java.util.Optional nodes_values_as_tensor) { return new TreeEnsembleRegressor(resultType, X, aggregate_function, nodes_hitrates, target_weights_as_tensor, nodes_featureids, target_treeids, nodes_treeids, post_transform, nodes_modes, target_weights, nodes_falsenodeids, target_ids, nodes_truenodeids, target_nodeids, nodes_nodeids, nodes_hitrates_as_tensor, base_values_as_tensor, n_targets, nodes_missing_value_tracks_true, base_values, nodes_values, nodes_values_as_tensor); } @@ -31584,99 +31584,99 @@ public static TreeEnsembleRegressor TreeEnsembleRegressor(CodeType resultType, V @OpFactoryHelper.OpDeclaration(Trilu.NAME) public static final class Trilu extends OnnxOp { public static final String NAME = "Trilu"; - + public enum Attribute implements OnnxAttribute { upper(Long.class, true, 1), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { input(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), k(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -31684,50 +31684,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Trilu(ExternalizedOp def) { super(SCHEMA, def); } - + Trilu(Trilu that, CodeContext cc) { super(that, cc); } - + @Override public Trilu transform(CodeContext cc, CodeTransformer ot) { return new Trilu(this, cc); } - + Trilu(CodeType resultType, Value input, java.util.Optional k, java.util.Optional upper) { super(SCHEMA, resultType, Set.of(), List.of(input, k), List.of(upper)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(input(), k())); } - + public Value input() { return operands().get(0); } - + public java.util.Optional k() { int i = optionalInputArguments.indexOf(InputParameter.k); return i != -1 ? java.util.Optional.of(operands().get(1 + i)) : java.util.Optional.empty(); } - + public java.util.Optional upper() { Long upper = Attribute.upper.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(upper); } - + } - + public static Trilu Trilu(CodeType resultType, Value input, java.util.Optional k, java.util.Optional upper) { return new Trilu(resultType, input, k, upper); } @@ -31735,102 +31735,102 @@ public static Trilu Trilu(CodeType resultType, Value input, java.util.Optional t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), indices(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), inverse_indices(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), counts(OnnxType.tensor(OnnxType.int64()), Quantifier.OPTIONAL), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -31838,50 +31838,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Unique(ExternalizedOp def) { super(SCHEMA, def); } - + Unique(Unique that, CodeContext cc) { super(that, cc); } - + @Override public Unique transform(CodeContext cc, CodeTransformer ot) { return new Unique(this, cc); } - + Unique(CodeType resultType, Set optionalOutputs, Value X, java.util.Optional sorted, java.util.Optional axis) { super(SCHEMA, resultType, optionalOutputs, List.of(X), List.of(sorted, axis)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional sorted() { Long sorted = Attribute.sorted.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(sorted); } - + public java.util.Optional axis() { Long axis = Attribute.axis.access(Long.class, onnxAttributes); return java.util.Optional.ofNullable(axis); } - + } - + public static Unique Unique(CodeType resultType, Set optionalOutputs, Value X, java.util.Optional sorted, java.util.Optional axis) { return new Unique(resultType, optionalOutputs, X, sorted, axis); } @@ -31889,73 +31889,73 @@ public static Unique Unique(CodeType resultType, Set opt @OpFactoryHelper.OpDeclaration(Unsqueeze.NAME) public static final class Unsqueeze extends OnnxOp { public static final String NAME = "Unsqueeze"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128()), OnnxType.tensor(OnnxType.float8e4m3fn()), OnnxType.tensor(OnnxType.float8e4m3fnuz()), OnnxType.tensor(OnnxType.float8e5m2()), OnnxType.tensor(OnnxType.float8e5m2fnuz()), OnnxType.tensor(OnnxType.uint4()), OnnxType.tensor(OnnxType.int4()), OnnxType.tensor(OnnxType.float4e2m1()), OnnxType.tensor(OnnxType.float8e8m0()), OnnxType.tensor(OnnxType.uint2()), OnnxType.tensor(OnnxType.int2())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { data(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), axes(OnnxType.tensor(OnnxType.int64()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { expanded(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -31963,44 +31963,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Unsqueeze(ExternalizedOp def) { super(SCHEMA, def); } - + Unsqueeze(Unsqueeze that, CodeContext cc) { super(that, cc); } - + @Override public Unsqueeze transform(CodeContext cc, CodeTransformer ot) { return new Unsqueeze(this, cc); } - + Unsqueeze(CodeType resultType, Value data, Value axes) { super(SCHEMA, resultType, Set.of(), List.of(data, axes), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(data(), axes())); } - + public Value data() { return operands().get(0); } - + public Value axes() { return operands().get(1); } - + } - + public static Unsqueeze Unsqueeze(CodeType resultType, Value data, Value axes) { return new Unsqueeze(resultType, data, axes); } @@ -32008,99 +32008,99 @@ public static Unsqueeze Unsqueeze(CodeType resultType, Value data, Value axes) { @OpFactoryHelper.OpDeclaration(Upsample.NAME) public static final class Upsample extends OnnxOp { public static final String NAME = "Upsample"; - + public enum Attribute implements OnnxAttribute { mode(String.class, true, "nearest"), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), scales(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -32108,49 +32108,49 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Upsample(ExternalizedOp def) { super(SCHEMA, def); } - + Upsample(Upsample that, CodeContext cc) { super(that, cc); } - + @Override public Upsample transform(CodeContext cc, CodeTransformer ot) { return new Upsample(this, cc); } - + Upsample(CodeType resultType, Value X, Value scales, java.util.Optional mode) { super(SCHEMA, resultType, Set.of(), List.of(X, scales), List.of(mode)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X(), scales())); } - + public Value X() { return operands().get(0); } - + public Value scales() { return operands().get(1); } - + public java.util.Optional mode() { String mode = Attribute.mode.access(String.class, onnxAttributes); return java.util.Optional.ofNullable(mode); } - + } - + public static Upsample Upsample(CodeType resultType, Value X, Value scales, java.util.Optional mode) { return new Upsample(resultType, X, scales, mode); } @@ -32158,75 +32158,75 @@ public static Upsample Upsample(CodeType resultType, Value X, Value scales, java @OpFactoryHelper.OpDeclaration(Where.NAME) public static final class Where extends OnnxOp { public static final String NAME = "Where"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { B(new OnnxType.TypeVariable("B", List.of(OnnxType.tensor(OnnxType.bool())))), T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.uint8()), OnnxType.tensor(OnnxType.uint16()), OnnxType.tensor(OnnxType.uint32()), OnnxType.tensor(OnnxType.uint64()), OnnxType.tensor(OnnxType.int8()), OnnxType.tensor(OnnxType.int16()), OnnxType.tensor(OnnxType.int32()), OnnxType.tensor(OnnxType.int64()), OnnxType.tensor(OnnxType.bfloat16()), OnnxType.tensor(OnnxType.float16()), OnnxType.tensor(OnnxType.float32()), OnnxType.tensor(OnnxType.float64()), OnnxType.tensor(OnnxType.string()), OnnxType.tensor(OnnxType.bool()), OnnxType.tensor(OnnxType.complex64()), OnnxType.tensor(OnnxType.complex128())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { condition(TypeConstraint.B.typeVariable(), Quantifier.REQUIRED), X(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), Y(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { output(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -32234,48 +32234,48 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Where(ExternalizedOp def) { super(SCHEMA, def); } - + Where(Where that, CodeContext cc) { super(that, cc); } - + @Override public Where transform(CodeContext cc, CodeTransformer ot) { return new Where(this, cc); } - + Where(CodeType resultType, Value condition, Value X, Value Y) { super(SCHEMA, resultType, Set.of(), List.of(condition, X, Y), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(condition(), X(), Y())); } - + public Value condition() { return operands().get(0); } - + public Value X() { return operands().get(1); } - + public Value Y() { return operands().get(2); } - + } - + public static Where Where(CodeType resultType, Value condition, Value X, Value Y) { return new Where(resultType, condition, X, Y); } @@ -32283,74 +32283,74 @@ public static Where Where(CodeType resultType, Value condition, Value X, Value Y @OpFactoryHelper.OpDeclaration(Xor.NAME) public static final class Xor extends OnnxOp { public static final String NAME = "Xor"; - + public enum Attribute implements OnnxAttribute.None { } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.tensor(OnnxType.bool())))), T1(new OnnxType.TypeVariable("T1", List.of(OnnxType.tensor(OnnxType.bool())))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { A(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), B(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { C(TypeConstraint.T1.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -32358,44 +32358,44 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public Xor(ExternalizedOp def) { super(SCHEMA, def); } - + Xor(Xor that, CodeContext cc) { super(that, cc); } - + @Override public Xor transform(CodeContext cc, CodeTransformer ot) { return new Xor(this, cc); } - + Xor(CodeType resultType, Value A, Value B) { super(SCHEMA, resultType, Set.of(), List.of(A, B), List.of()); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(A(), B())); } - + public Value A() { return operands().get(0); } - + public Value B() { return operands().get(1); } - + } - + public static Xor Xor(CodeType resultType, Value A, Value B) { return new Xor(resultType, A, B); } @@ -32403,99 +32403,99 @@ public static Xor Xor(CodeType resultType, Value A, Value B) { @OpFactoryHelper.OpDeclaration(ZipMap.NAME) public static final class ZipMap extends OnnxOp { public static final String NAME = "ZipMap"; - + public enum Attribute implements OnnxAttribute { classlabels_int64s(long[].class, true, null), classlabels_strings(String[].class, true, null), ; - + final Class t; final boolean optional; final Object defaultValue; - + Attribute(Class type, boolean optional, Object defaultValue) { this.t = type; this.optional = optional; this.defaultValue = defaultValue; assert optional || defaultValue == null; } - + public Class type() { return t; } - + public boolean isOptional() { return optional; } - + public Object defaultValue() { return defaultValue; } } - + public enum TypeConstraint implements OnnxTypeConstraint { T(new OnnxType.TypeVariable("T", List.of(OnnxType.seq(OnnxType.map(OnnxType.string(), OnnxType.float32())), OnnxType.seq(OnnxType.map(OnnxType.int64(), OnnxType.float32()))))), ; - + final OnnxType.TypeVariable typeVariable; - + TypeConstraint(OnnxType.TypeVariable typeVariable) { assert typeVariable.name().equals(name()); this.typeVariable = typeVariable; } - + @Override public OnnxType.TypeVariable typeVariable() { return typeVariable; } } - + public enum InputParameter implements OnnxParameter { X(OnnxType.tensor(OnnxType.float32()), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + InputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public enum OutputParameter implements OnnxParameter { Z(TypeConstraint.T.typeVariable(), Quantifier.REQUIRED), ; - + final OnnxType type; final Quantifier quantifier; - + OutputParameter(OnnxType type, Quantifier quantifier) { this.type = type; this.quantifier = quantifier; } - + @Override public OnnxType type() { return type; } - + @Override public Quantifier quantifier() { return quantifier; } } - + public static final OnnxSchema SCHEMA = new OnnxSchemaRecord( NAME, List.of(Attribute.values()), @@ -32503,50 +32503,50 @@ public Quantifier quantifier() { List.of(InputParameter.values()), List.of(OutputParameter.values()) ); - + public ZipMap(ExternalizedOp def) { super(SCHEMA, def); } - + ZipMap(ZipMap that, CodeContext cc) { super(that, cc); } - + @Override public ZipMap transform(CodeContext cc, CodeTransformer ot) { return new ZipMap(this, cc); } - + ZipMap(CodeType resultType, Value X, java.util.Optional classlabels_int64s, java.util.Optional classlabels_strings) { super(SCHEMA, resultType, Set.of(), List.of(X), List.of(classlabels_int64s, classlabels_strings)); } - + @Override public SequencedSet onnxOutputs() { return onnxOutputs(SCHEMA); } - + @Override public SequencedMap onnxInputs() { return onnxInputs(SCHEMA, List.of(X())); } - + public Value X() { return operands().get(0); } - + public java.util.Optional classlabels_int64s() { long[] classlabels_int64s = Attribute.classlabels_int64s.access(long[].class, onnxAttributes); return java.util.Optional.ofNullable(classlabels_int64s).map(long[]::clone); } - + public java.util.Optional classlabels_strings() { String[] classlabels_strings = Attribute.classlabels_strings.access(String[].class, onnxAttributes); return java.util.Optional.ofNullable(classlabels_strings).map(String[]::clone); } - + } - + public static ZipMap ZipMap(CodeType resultType, Value X, java.util.Optional classlabels_int64s, java.util.Optional classlabels_strings) { return new ZipMap(resultType, X, classlabels_int64s, classlabels_strings); } From 8ea7c36cfc439965255f99986474a6cd81664057 Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Wed, 15 Jul 2026 22:21:29 +0200 Subject: [PATCH 11/18] Address review comments and make the model faster by adding maxNewTokens. Signed-off-by: Ana-Maria Mihalceanu --- .../main/java/oracle/code/onnx/Tensor.java | 5 +- .../java/oracle/code/onnx/OnnxOperators.java | 1722 ++++++++--------- .../main/java/oracle/code/onnx/Tensor.java | 15 +- .../onnx/genai/OnnxGenRuntimeSession.java | 58 +- .../code/onnx/genai/TensorDataStream.java | 4 +- .../java/oracle/code/onnx/ir/OnnxType.java | 2 +- .../java/oracle/code/onnx/llm/LlamaDemo.java | 3 +- .../java/oracle/code/onnx/llm/LlamaModel.java | 47 +- 8 files changed, 952 insertions(+), 904 deletions(-) diff --git a/cr-examples/onnx/opgen/src/main/java/oracle/code/onnx/Tensor.java b/cr-examples/onnx/opgen/src/main/java/oracle/code/onnx/Tensor.java index 5a9acd581d9..4a07ac7ff33 100644 --- a/cr-examples/onnx/opgen/src/main/java/oracle/code/onnx/Tensor.java +++ b/cr-examples/onnx/opgen/src/main/java/oracle/code/onnx/Tensor.java @@ -87,8 +87,9 @@ enum ElementType { UINT4(21, Object.class), INT4(22, Object.class), FLOAT4E2M1(23, Object.class), - INT2(25, Object.class), - UINT2(26, Object.class) + FLOAT8E8M0(24, Object.class), + UINT2(25, Object.class), + INT2(26, Object.class) ; final int id; diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java index 3cef838114c..013b7e18d94 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java @@ -34,10 +34,10 @@ @SuppressWarnings({"unchecked", "OptionalUsedAsFieldOrParameterType"}) public final class OnnxOperators extends ExplicitOnnxOperators { - + private OnnxOperators() {} - - /// + + /// /// Absolute takes one input data (Tensor) and produces one output data /// (Tensor) where absolute value, y = abs(x), is applied to /// the tensor elementwise. @@ -45,34 +45,34 @@ public static Tensor Abs(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Abs.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the arccosine (inverse of cosine) of the given input tensor, element-wise. public static Tensor Acos(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Acos.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic arccosine of the given input tensor element-wise. public static Tensor Acosh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Acosh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Compute one iteration of ADAGRAD, a stochastic gradient based optimization /// algorithm. This operator can conduct the optimization of multiple tensor variables. - /// + /// /// Let's define the behavior of this operator. As you can imagine, ADAGRAD requires /// some parameters: - /// + /// /// - The initial learning-rate "R". /// - The update count "T". That is, the number of training iterations conducted. /// - A L2-norm regularization coefficient "norm_coefficient". /// - A learning-rate decay factor "decay_factor". /// - A small constant "epsilon" to avoid dividing-by-zero. - /// + /// /// At each ADAGRAD iteration, the optimized tensors are moved along a direction /// computed based on their estimated gradient and accumulated squared gradient. Assume /// that only a single tensor "X" is updated by this operator. We need the value of "X", @@ -82,32 +82,32 @@ public static Tensor Acosh(Tensor input) { /// corresponding output tensors are the new value of "X" (called "X_new"), and then /// the new accumulated squared gradient (called "H_new"). Those outputs are computed /// from the given inputs following the pseudo code below. - /// + /// /// Let "+", "-", "*", and "/" are all element-wise arithmetic operations with /// numpy-style broadcasting support. The pseudo code to compute those outputs is: - /// + /// /// // Compute a scalar learning-rate factor. At the first update of X, T is generally /// // 0 (0-based update index) or 1 (1-based update index). /// r = R / (1 + T * decay_factor); - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||_2^2, where ||X||_2 is the 2-norm. /// G_regularized = norm_coefficient * X + G; - /// + /// /// // Compute new accumulated squared gradient. /// H_new = H + G_regularized * G_regularized; - /// + /// /// // Compute the adaptive part of per-coordinate learning rate. Note that Sqrt(...) /// // computes element-wise square-root. /// H_adaptive = Sqrt(H_new) + epsilon - /// + /// /// // Compute the new value of "X". /// X_new = X - r * G_regularized / H_adaptive; - /// + /// /// If one assign this operators to optimize multiple inputs, for example, "X_1" and "X_2", the same /// pseudo code may be extended to handle all tensors jointly. More specifically, we can view "X" as a /// concatenation of "X_1" and "X_2" (of course, their gradient and accumulate gradient should /// be concatenated too) and then just reuse the entire pseudo code. - /// + /// /// Note that ADAGRAD was first proposed in http://jmlr.org/papers/volume12/duchi11a/duchi11a.pdf. /// In that reference paper, this operator is a special case of the Figure 1's composite mirror /// descent update. @@ -115,86 +115,86 @@ public static List> Adagrad(Tensor R, Tensor T, Li Object result = OnnxInterpreter.interpret(OnnxOps.Adagrad.class, List.of(R, T, inputs), List.of(epsilon, decay_factor, norm_coefficient)); return (List>) result; } - - /// + + /// /// Compute one iteration of Adam, a stochastic gradient based optimization /// algorithm. This operator can conduct the optimization of multiple tensor variables. - /// + /// /// Let's define the behavior of this operator. First of all, Adam requires /// some parameters: - /// + /// /// - The learning-rate "R". /// - The update count "T". That is, the number of training iterations conducted. /// - A L2-norm regularization coefficient "norm_coefficient". /// - A small constant "epsilon" to avoid dividing-by-zero. /// - Two coefficients, "alpha" and "beta". - /// + /// /// At each Adam iteration, the optimized tensors are moved along a direction /// computed based on their exponentially-averaged historical gradient and /// exponentially-averaged historical squared gradient. Assume that only a tensor /// "X" is being optimized. The rest of required information is - /// + /// /// - the value of "X", /// - "X"'s gradient (denoted by "G"), /// - "X"'s exponentially-averaged historical gradient (denoted by "V"), and /// - "X"'s exponentially-averaged historical squared gradient (denoted by "H"). - /// + /// /// Some of those parameters are passed into this operator as input tensors and others /// are stored as this operator's attributes. Specifically, this operator's input tensor /// list is ["R", "T", "X", "G", "V", "H"]. That is, "R" is the first input, "T" is /// the second input, and so on. Other parameters are given as attributes because they /// are constants. Moreover, the corresponding output tensors are - /// + /// /// - the new value of "X" (called "X_new"), /// - the new exponentially-averaged historical gradient (denoted by "V_new"), and /// - the new exponentially-averaged historical squared gradient (denoted by "H_new"). - /// + /// /// Those outputs are computed following the pseudo code below. - /// + /// /// Let "+", "-", "*", and "/" are all element-wise arithmetic operations with /// numpy-style broadcasting support. The pseudo code to compute those outputs is: - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||_2^2, where ||X||_2 is the 2-norm. /// G_regularized = norm_coefficient * X + G - /// + /// /// // Update exponentially-averaged historical gradient. /// V_new = alpha * V + (1 - alpha) * G_regularized - /// + /// /// // Update exponentially-averaged historical squared gradient. /// H_new = beta * H + (1 - beta) * G_regularized * G_regularized - /// + /// /// // Compute the element-wise square-root of H_new. V_new will be element-wisely /// // divided by H_sqrt for a better update direction. /// H_sqrt = Sqrt(H_new) + epsilon - /// + /// /// // Compute learning-rate. Note that "alpha**T"/"beta**T" is alpha's/beta's T-th power. /// R_adjusted = T > 0 ? R * Sqrt(1 - beta**T) / (1 - alpha**T) : R - /// + /// /// // Compute new value of "X". /// X_new = X - R_adjusted * V_new / H_sqrt - /// + /// /// // Post-update regularization. /// X_final = (1 - norm_coefficient_post) * X_new - /// + /// /// If there are multiple inputs to be optimized, the pseudo code will be applied /// independently to each of them. public static List> Adam(Tensor R, Tensor T, List> inputs, Optional epsilon, Optional norm_coefficient_post, Optional norm_coefficient, Optional alpha, Optional beta) { Object result = OnnxInterpreter.interpret(OnnxOps.Adam.class, List.of(R, T, inputs), List.of(epsilon, norm_coefficient_post, norm_coefficient, alpha, beta)); return (List>) result; } - - /// + + /// /// Performs element-wise binary addition (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Add(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Add.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Generates a 2D or 3D flow field (sampling grid), given a batch of affine matrices theta /// (https://pytorch.org/docs/stable/generated/torch.nn.functional.affine_grid.html). /// An affine matrix `theta` is applied to a position tensor represented in its homogeneous expression. Here is an example in 3D: @@ -206,10 +206,10 @@ public static Tensor Add(Tensor A, Tensor B) { /// ``` /// where `(x, y, z)` is the position in the original space, `(x', y', z')` is the position in the output space. /// The last row is always `[0, 0, 0, 1]` and is not stored in the affine matrix. Therefore we have `theta` of shape `(N, 2, 3)` for 2D or `(N, 3, 4)` for 3D. - /// + /// /// Input `size` is used to define grid of positions evenly spaced in the original 2D or 3D space, with dimensions ranging from `-1` to `1`. /// The output `grid` contains positions in the output space. - /// + /// /// When `align_corners=1`, consider `-1` and `1` to refer to the centers of the corner pixels (mark `v` in illustration). /// ``` /// v v v v @@ -226,18 +226,18 @@ public static Tensor AffineGrid(Tensor theta, Tensor size, Op Object result = OnnxInterpreter.interpret(OnnxOps.AffineGrid.class, List.of(theta, size), List.of(align_corners)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `and` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor And(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.And.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Computes the indices of the max elements of the input tensor's element along the /// provided axis. The resulting tensor has the same rank as the input if keepdims equals 1. /// If keepdims equals 0, then the resulting tensor has the reduced dimension pruned. @@ -249,8 +249,8 @@ public static Tensor ArgMax(Tensor data, Optional keepdims, O Object result = OnnxInterpreter.interpret(OnnxOps.ArgMax.class, List.of(data), List.of(keepdims, select_last_index, axis)); return (Tensor) result; } - - /// + + /// /// Computes the indices of the min elements of the input tensor's element along the /// provided axis. The resulting tensor has the same rank as the input if keepdims equals 1. /// If keepdims equals 0, then the resulting tensor has the reduced dimension pruned. @@ -262,65 +262,65 @@ public static Tensor ArgMin(Tensor data, Optional keepdims, O Object result = OnnxInterpreter.interpret(OnnxOps.ArgMin.class, List.of(data), List.of(keepdims, select_last_index, axis)); return (Tensor) result; } - - /// + + /// /// Select elements of the input tensor based on the indices passed.
/// The indices are applied to the last axes of the tensor. public static Tensor ArrayFeatureExtractor(Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.ArrayFeatureExtractor.class, List.of(X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the arcsine (inverse of sine) of the given input tensor, element-wise. public static Tensor Asin(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Asin.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic arcsine of the given input tensor element-wise. public static Tensor Asinh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Asinh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the arctangent (inverse of tangent) of the given input tensor, element-wise. public static Tensor Atan(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Atan.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic arctangent of the given input tensor element-wise. public static Tensor Atanh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Atanh.class, List.of(input), List.of()); return (Tensor) result; } - + public record AttentionResult(Tensor Y, Tensor present_key, Tensor present_value, Tensor qk_matmul_output) { } - /// - /// + /// + /// /// Computes scaled dot product attention on query, key and value tensors, using an optional attention mask if passed. - /// + /// /// This operator covers self and cross variants of the attention operation based on sequence lengths of K, Q and V. - /// + /// /// For self attention, `kv_sequence_length` equals to `q_sequence_length`. - /// + /// /// For cross attention, query and key might have different lengths. - /// + /// /// This operator also covers the 3 following variants based on the number of heads: /// 1) Multi-headed Attention (MHA): Described in the paper https://arxiv.org/pdf/1706.03762, `q_num_heads = kv_num_heads`. /// 2) Group-query Attention (GQA): Described in the paper https://arxiv.org/pdf/2305.13245, `q_num_heads > kv_num_heads`, `q_num_heads % kv_num_heads == 0`. /// 3) Multi-query Attention (MQA): Described in the paper https://arxiv.org/pdf/1911.02150, `q_num_heads > kv_num_heads`, `kv_num_heads=1`. - /// + /// /// Attention bias to be added is calculated based on `attn_mask` input and `is_causal` attribute: /// 1) `attn_mask`: A boolean mask where a value of `True` indicates that the element should take part in attention or a float mask of the same type as query, key, value that is added to the attention score. /// 2) If `is_causal` is set to `1`, attention scores above the diagonal are masked out, regardless of the `attn_mask` input. - /// + /// /// With respect to KV cache update, this operator allows the following two use cases: - /// + /// /// 1) Cache update happens inside the Attention operator. In this case, the `K` and `V` inputs contain only the incoming /// tokens for the current autoregressive step, and the four optional inputs/outputs past and present key and value are /// all needed. The Attention op performs a Concat operation on the past and incoming key and value to form the present @@ -332,10 +332,10 @@ public record AttentionResult(Tensor Y, Tensor present_key, Tens /// provided to indicate the number of non-padding tokens in each sample of the batch to save unnecessary computation. /// Here, the kv_sequence dimension of `attn_mask` can be shorter than `K` and `V`, but still needs to be at least as long /// as the maximum value of `nonpad_kv_seqlen`. - /// + /// /// Both past and present state key/values are optional. They shall be used together, and not allowed to use only one of them. /// The following pattern is applied to the Q, K and V inputs after appropriate reshaping of K and V inputs based on sequence lengths and num heads provided: - /// + /// /// ``` /// The following pattern is applied by this operator: /// Q K V @@ -361,8 +361,8 @@ public static AttentionResult Attention(Tensor Q, Tensor Object[] resultArray = (Object[]) result; return new AttentionResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2], (Tensor)resultArray[3]); } - - /// + + /// /// AveragePool consumes an input tensor X and applies average pooling across /// the tensor according to kernel sizes, stride sizes, and pad lengths. /// average pooling consisting of computing the average on all values of a @@ -378,7 +378,7 @@ public static AttentionResult Attention(Tensor Q, Tensor /// output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1) /// ``` /// if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`. Sliding windows that would start in the right padded region are ignored. - /// + /// /// `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled: /// ``` /// VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i]) @@ -394,14 +394,14 @@ public static AttentionResult Attention(Tensor Q, Tensor /// pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i] /// ``` /// The output of each pooling window is divided by the number of elements (exclude pad when attribute count_include_pad is zero). - /// + /// public static Tensor AveragePool(Tensor X, Optional pads, Optional dilations, Optional auto_pad, Optional count_include_pad, Optional ceil_mode, Optional strides, long[] kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.AveragePool.class, List.of(X), List.of(pads, dilations, auto_pad, count_include_pad, ceil_mode, strides, kernel_shape)); return (Tensor) result; } - + public record BatchNormalizationResult(Tensor Y, Tensor running_mean, Tensor running_var) { } - /// + /// /// Carries out batch normalization as described in the paper /// https://arxiv.org/abs/1502.03167. Depending on the mode it is being run, /// There are five required inputs 'X', 'scale', 'B', 'input_mean' and @@ -410,16 +410,16 @@ public record BatchNormalizationResult(Tensor Y, Tensor running_me /// statistics in inference mode (training_mode=False, default), /// and the running statistics in training mode (training_mode=True). /// There are multiple cases for the number of outputs, which we list below: - /// + /// /// * Output case #1: Y, running_mean, running_var (training_mode=True) /// * Output case #2: Y (training_mode=False) - /// + /// /// When training_mode=False, extra outputs are invalid. /// The outputs are updated as follows when training_mode=True: /// ``` /// running_mean = input_mean * momentum + current_mean * (1 - momentum) /// running_var = input_var * momentum + current_var * (1 - momentum) - /// + /// /// Y = (X - current_mean) / sqrt(current_var + epsilon) * scale + B /// ``` /// where: @@ -430,14 +430,14 @@ public record BatchNormalizationResult(Tensor Y, Tensor running_me /// Notice that `ReduceVar` refers to the population variance, and it equals to /// `sum(sqrd(x_i - x_avg)) / N` /// where `N` is the population size (this formula does not use sample size `N - 1`). - /// + /// /// The computation of ReduceMean and ReduceVar uses float to avoid overflow for float16 inputs. - /// + /// /// When training_mode=False: /// ``` /// Y = (X - input_mean) / sqrt(input_var + epsilon) * scale + B /// ``` - /// + /// /// For previous (depreciated) non-spatial cases, implementors are suggested /// to flatten the input shape to (N x C * D1 * D2 * ... * Dn) before a BatchNormalization Op. /// This operator has **optional** inputs/outputs. See [the doc](IR.md) for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted. @@ -446,31 +446,31 @@ public static BatchNormalizationResult BatchNormalization(Ten Object[] resultArray = (Object[]) result; return new BatchNormalizationResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// Draws binary random numbers (0 or 1) from a Bernoulli distribution. The input tensor should be a tensor /// containing probabilities p (a value in the range [0,1]) to be used for drawing the binary random number, /// where an output of 1 is produced with probability p and an output of 0 is produced with probability (1-p). - /// + /// /// This operator is non-deterministic and may not produce the same values in different /// implementations (even if a seed is specified). public static Tensor Bernoulli(Tensor input, Optional seed, Optional dtype) { Object result = OnnxInterpreter.interpret(OnnxOps.Bernoulli.class, List.of(input), List.of(seed, dtype)); return (Tensor) result; } - - /// + + /// /// Maps the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value. public static Tensor Binarizer(Tensor X, Optional threshold) { Object result = OnnxInterpreter.interpret(OnnxOps.Binarizer.class, List.of(X), List.of(threshold)); return (Tensor) result; } - - /// + + /// /// Reinterprets the binary representation of a tensor as a different data type, /// specified by the 'to' attribute. Unlike Cast, BitCast preserves the exact bit /// pattern without any value conversion. - /// + /// /// The target data type must have the same bit-width as the input data type. /// The output tensor has the same shape as the input tensor. /// All types except string are supported. Implementations must treat the @@ -479,8 +479,8 @@ public static Tensor BitCast(Tensor input, long to) { Object result = OnnxInterpreter.interpret(OnnxOps.BitCast.class, List.of(input), List.of(to)); return (Tensor) result; } - - /// + + /// /// Bitwise shift operator performs element-wise operation. For each input element, if the /// attribute "direction" is "RIGHT", this operator moves its binary representation toward /// the right side so that the input value is effectively decreased. If the attribute "direction" @@ -489,7 +489,7 @@ public static Tensor BitCast(Tensor input, long to) { /// Y specifies the amounts of shifting. For example, if "direction" is "Right", X is [1, 4], /// and S is [1, 1], the corresponding output Z would be [0, 2]. If "direction" is "LEFT" with /// X=[1, 2] and S=[1, 2], the corresponding output Y would be [2, 8]. - /// + /// /// Because this operator supports Numpy-style broadcasting, X's and Y's shapes are /// not necessarily identical. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -497,57 +497,57 @@ public static Tensor BitShift(Tensor X, Tensor Y, String direction) Object result = OnnxInterpreter.interpret(OnnxOps.BitShift.class, List.of(X, Y), List.of(direction)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulting from performing the bitwise `and` operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor BitwiseAnd(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseAnd.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the bitwise not of the input tensor element-wise. public static Tensor BitwiseNot(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseNot.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulting from performing the bitwise `or` operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor BitwiseOr(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseOr.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulting from performing the bitwise `xor` operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor BitwiseXor(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseXor.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Generates a Blackman window as described in the paper https://ieeexplore.ieee.org/document/1455106. public static Tensor BlackmanWindow(Tensor size, Optional periodic, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.BlackmanWindow.class, List.of(size), List.of(periodic, output_datatype)); return (Tensor) result; } - - /// + + /// /// The operator casts the elements of a given input tensor to a data type /// specified by the 'to' argument and returns an output tensor of the same size in /// the converted type. The 'to' argument must be one of the data types specified /// in the 'DataType' enum field in the TensorProto message. - /// + /// /// Casting from string tensor in plain (e.g., "3.14" and "1000") and scientific numeric representations /// (e.g., "1e-5" and "1E8") to float types is supported. For example, converting string "100.5" to an integer may /// yield result 100. There are some string literals reserved for special floating-point values; @@ -557,15 +557,15 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// to string tensors, plain floating-point representation (such as "314.15926") would be used. /// Converting non-numerical-literal string such as "Hello World!" is an undefined behavior. Cases /// of converting string representing floating-point arithmetic value, such as "2.718", to INT is an undefined behavior. - /// + /// /// Conversion from a numerical type to any numerical type is always allowed. /// User must be aware of precision loss and value change caused by range difference between two types. /// For example, a 64-bit float 3.1415926459 may be round to a 32-bit float 3.141592. Similarly, converting /// an integer 36 to Boolean may produce 1 because we truncate bits which can't be stored in the targeted type. - /// + /// /// In more detail, the conversion among numerical types should follow these rules /// if the destination type is not a float 8 type. - /// + /// /// * Casting from floating point to: /// * floating point: +/- infinity if OOR (out of range). /// * fixed point: undefined if OOR. @@ -579,12 +579,12 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// * floating point: `{1.0, 0.0}`. /// * fixed point: `{1, 0}`. /// * bool: no change. - /// + /// /// Float 8 types (E4M3FN, E4M3FNUZ, E5M2, E5M2FNUZ) were introduced to speed up the training of /// deep models. By default the conversion of a float *x* obeys /// to the following rules. `[x]` means the value rounded to /// the target mantissa width. - /// + /// /// | x | E4M3FN | E4M3FNUZ | E5M2 | E5M2FNUZ | /// | ----------------- | -------- | -------- | -------- | -------- | /// | 0 | 0 | 0 | 0 | 0 | @@ -595,10 +595,10 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// | \[x\] > FLT_MAX | FLT_MAX | FLT_MAX | FLT_MAX | FLT_MAX | /// | \[x\] \< -FLT_MAX | -FLT_MAX | -FLT_MAX | -FLT_MAX | -FLT_MAX | /// | else | RNE | RNE | RNE | RNE | - /// + /// /// The behavior changes if the parameter 'saturate' is set to False. /// The rules then become: - /// + /// /// | x | E4M3FN | E4M3FNUZ | E5M2 | E5M2FNUZ | /// | ----------------- | ------ | -------- | ---- | -------- | /// | 0 | 0 | 0 | 0 | 0 | @@ -610,12 +610,12 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// | \[x\] > FLT_MAX | NaN | NaN | Inf | NaN | /// | \[x\] \< -FLT_MAX | NaN | NaN | -Inf | NaN | /// | else | RNE | RNE | RNE | RNE | - /// + /// /// FLOAT8E8M0 type was introduced to enable [Microscaling (MX) formats](https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf). /// When casting to FLOAT8E8M0, the rounding behavior can be specified using the `round_mode` and `saturate` attributes. /// The current CUDA behavior is to round up and saturate. Casting negative values to FLOAT8E8M0 gives undefined behavior. /// The following table describes the casting behavior of special values to FLOAT8E8M0 in the two most common cases. - /// + /// /// | x | saturate + up | non-saturate + nearest | /// | ----------------- | ------------- | --------------------- | /// | 0 | 0 | NaN | @@ -629,8 +629,8 @@ public static Tensor Cast(Tensor input, Optional saturate Object result = OnnxInterpreter.interpret(OnnxOps.Cast.class, List.of(input), List.of(saturate, to, round_mode)); return (Tensor) result; } - - /// + + /// /// The operator casts the elements of a given input tensor (the first input) to /// the same data type as the elements of the second input tensor. /// See documentation of the Cast operator for further details. @@ -638,8 +638,8 @@ public static Tensor CastLike(Tensor input, Tensor target_t Object result = OnnxInterpreter.interpret(OnnxOps.CastLike.class, List.of(input, target_type), List.of(saturate, round_mode)); return (Tensor) result; } - - /// + + /// /// Converts a map to a tensor.
The map key must be an int64 and the values will be ordered /// in ascending order based on this key.
The operator supports dense packing or sparse packing. /// If using sparse packing, the key cannot exceed the max_map-1 value. @@ -647,8 +647,8 @@ public static Tensor CastMap(Map X, Optional map_ Object result = OnnxInterpreter.interpret(OnnxOps.CastMap.class, List.of(X), List.of(map_form, cast_to, max_map)); return (Tensor) result; } - - /// + + /// /// Converts strings to integers and vice versa.
/// Two sequences of equal length are used to map between integers and strings, /// with strings and integers at the same index detailing the mapping.
@@ -661,34 +661,34 @@ public static Tensor CategoryMapper(Tensor X, Optional Object result = OnnxInterpreter.interpret(OnnxOps.CategoryMapper.class, List.of(X), List.of(cats_int64s, cats_strings, default_int64, default_string)); return (Tensor) result; } - + public record CausalConvWithStateResult(Tensor output, Tensor present_state) { } - /// - /// + /// + /// /// Stateful causal 1D depthwise convolution. - /// + /// /// Used by Gated DeltaNet (Qwen3.5) and Mamba (Jamba, FalconMamba) as a preprocessing step. /// Replaces the 3-op pattern (Concat + Conv + Slice) with a single fused operation. - /// + /// /// The convolution is causal (looks only at current and past positions) and depthwise /// (each channel is convolved independently with its own kernel). - /// + /// /// The input, weight, past_state, output, and present_state tensors are rank-3 with /// shape (batch_size, channels, length). The optional bias input is rank-1 with /// shape (channels). For higher-dimensional data, use Reshape nodes before and /// after this operator to pack extra dimensions into the batch or channel axis. - /// + /// /// Weight layout: (channels, 1, k) for depthwise convolution. /// The carry state stores the last (k-1) positions for incremental decode. - /// + /// /// The optional activation attribute supports fused SiLU/Swish activation. public static CausalConvWithStateResult CausalConvWithState(Tensor input, Tensor weight, Optional> bias, Optional> past_state, Optional activation) { Object result = OnnxInterpreter.interpret(OnnxOps.CausalConvWithState.class, List.of(input, weight, bias, past_state), List.of(activation)); Object[] resultArray = (Object[]) result; return new CausalConvWithStateResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Ceil takes one input data (Tensor) and produces one output data /// (Tensor) where the ceil is, y = ceil(x), is applied to /// the tensor elementwise. If x is integral, +0, -0, NaN, or infinite, x itself is returned. @@ -696,12 +696,12 @@ public static Tensor Ceil(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Ceil.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Continuously Differentiable Exponential Linear Units: /// Perform the linear unit element-wise on the input tensor X /// using formula: - /// + /// /// ``` /// max(0,x) + min(0,alpha*(exp(x/alpha)-1)) /// ``` @@ -709,28 +709,28 @@ public static Tensor Celu(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.Celu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Center crop or pad an input to given dimensions. - /// + /// /// The crop/pad dimensions can be specified for a subset of the `axes`; unspecified dimensions will remain unchanged. - /// + /// /// If the input dimensions are larger than the target crop dimensions, a centered cropping window will be extracted /// from the input. The starting value for the cropping window is rounded down, which means that if the difference /// between the input shape and the crop shape is odd, the cropping window will be shifted half a pixel to the left /// of the input center. - /// + /// /// If the input dimensions are smaller than the target crop dimensions, the input will be padded equally on both sides /// to center it in the output. In cases where the total number of padding pixels is odd, an additional pixel will be /// added to the right side. - /// + /// /// The padding value used is zero. public static Tensor CenterCropPad(Tensor input_data, Tensor shape, Optional axes) { Object result = OnnxInterpreter.interpret(OnnxOps.CenterCropPad.class, List.of(input_data, shape), List.of(axes)); return (Tensor) result; } - - /// + + /// /// Clip operator limits the given input within an interval. The interval is /// specified by the inputs 'min' and 'max'. They default to /// numeric_limits::lowest() and numeric_limits::max(), respectively. @@ -740,14 +740,14 @@ public static Tensor Clip(Tensor input, Optional> min, Optio Object result = OnnxInterpreter.interpret(OnnxOps.Clip.class, List.of(input, min, max), List.of()); return (Tensor) result; } - - /// + + /// /// The operator rearranges column blocks back into a multidimensional image - /// + /// /// Col2Im behaves similarly to PyTorch's fold https://pytorch.org/docs/stable/generated/torch.nn.Fold.html, /// but it only supports *batched* multi-dimensional image tensors. /// Another implementation in Python with N-dimension support can be found at https://github.com/f-dangel/unfoldNd/. - /// + /// /// NOTE: /// Although specifying image_shape looks redundant because it could be calculated from /// convolution formulas, it is required as input for more advanced scenarios as explained @@ -756,24 +756,24 @@ public static Tensor Col2Im(Tensor input, Tensor image_shape, Te Object result = OnnxInterpreter.interpret(OnnxOps.Col2Im.class, List.of(input, image_shape, block_shape), List.of(pads, dilations, strides)); return (Tensor) result; } - - /// + + /// /// Selects slices from an input tensor along a given axis where condition evaluates to True for each axis index. /// In case axis is not provided, input is flattened before elements are selected. /// Compress behaves like numpy.compress: https://docs.scipy.org/doc/numpy/reference/generated/numpy.compress.html - /// + /// public static Tensor Compress(Tensor input, Tensor condition, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Compress.class, List.of(input, condition), List.of(axis)); return (Tensor) result; } - + /// Concatenate a list of tensors into a single tensor. All input tensors must have the same shape, except for the dimension size of the axis to concatenate on. public static Tensor Concat(List> inputs, long axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Concat.class, List.of(inputs), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Concatenate a sequence of tensors into a single tensor. /// All input tensors must have the same shape, except for the dimension size of the axis to concatenate on. /// By default 'new_axis' is 0, the behavior is similar to numpy.concatenate. @@ -782,78 +782,78 @@ public static Tensor ConcatFromSequence(List> input_sequence Object result = OnnxInterpreter.interpret(OnnxOps.ConcatFromSequence.class, List.of(input_sequence), List.of(axis, new_axis)); return (Tensor) result; } - - /// + + /// /// This operator produces a constant tensor. Exactly one of the provided attributes, either value, sparse_value, /// or value_* must be specified. public static Tensor Constant(Optional value_int, Optional value_floats, Optional value_strings, Optional value_float, Optional value_string, Optional value_ints, Optional sparse_value, Optional value) { Object result = OnnxInterpreter.interpret(OnnxOps.Constant.class, List.of(), List.of(value_int, value_floats, value_strings, value_float, value_string, value_ints, sparse_value, value)); return (Tensor) result; } - - /// + + /// /// Generate a tensor with given value and shape. public static Tensor ConstantOfShape(Tensor input, Optional value) { Object result = OnnxInterpreter.interpret(OnnxOps.ConstantOfShape.class, List.of(input), List.of(value)); return (Tensor) result; } - - /// + + /// /// The convolution operator consumes an input tensor and a filter, and /// computes the output. public static Tensor Conv(Tensor X, Tensor W, Optional> B, Optional pads, Optional dilations, Optional auto_pad, Optional strides, Optional group, Optional kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.Conv.class, List.of(X, W, B), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); return (Tensor) result; } - - /// + + /// /// The integer convolution operator consumes an input tensor, its zero-point, a filter, and its zero-point, /// and computes the output. The production MUST never overflow. The accumulation may overflow if and only if in 32 bits. public static Tensor ConvInteger(Tensor x, Tensor w, Optional> x_zero_point, Optional> w_zero_point, Optional pads, Optional dilations, Optional auto_pad, Optional strides, Optional group, Optional kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.ConvInteger.class, List.of(x, w, x_zero_point, w_zero_point), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); return (Tensor) result; } - - /// + + /// /// The convolution transpose operator consumes an input tensor and a filter, /// and computes the output. - /// + /// /// If the pads parameter is provided the shape of the output is calculated via the following equation: - /// + /// /// output_shape[i] = stride[i] * (input_size[i] - 1) + output_padding[i] + ((kernel_shape[i] - 1) * dilations[i] + 1) - pads[start_i] - pads[end_i] - /// + /// /// output_shape can also be explicitly specified in which case pads values are auto generated using these equations: - /// + /// /// total_padding[i] = stride[i] * (input_size[i] - 1) + output_padding[i] + ((kernel_shape[i] - 1) * dilations[i] + 1) - output_shape[i] /// If (auto_pads == SAME_UPPER): pads[start_i] = total_padding[i]/2; pads[end_i] = total_padding[i] - (total_padding[i]/2) /// Else: pads[start_i] = total_padding[i] - (total_padding[i]/2); pads[end_i] = (total_padding[i]/2). - /// - /// + /// + /// public static Tensor ConvTranspose(Tensor X, Tensor W, Optional> B, Optional output_shape, Optional pads, Optional dilations, Optional auto_pad, Optional strides, Optional group, Optional kernel_shape, Optional output_padding) { Object result = OnnxInterpreter.interpret(OnnxOps.ConvTranspose.class, List.of(X, W, B), List.of(output_shape, pads, dilations, auto_pad, strides, group, kernel_shape, output_padding)); return (Tensor) result; } - - /// + + /// /// Calculates the cosine of the given input tensor, element-wise. public static Tensor Cos(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Cos.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic cosine of the given input tensor element-wise. public static Tensor Cosh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Cosh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Performs cumulative product of the input elements along the given axis. /// By default, it will do the product inclusively meaning the first element is copied as is. /// Through an `exclusive` attribute, this behavior can change to exclude the first element. /// It can also perform product in the opposite direction of the axis. For that, set `reverse` attribute to 1. - /// + /// /// Example: /// ``` /// input_x = [1, 2, 3] @@ -868,18 +868,18 @@ public static Tensor Cosh(Tensor input) { /// reverse=1 /// output = [6, 3, 1] /// ``` - /// + /// public static Tensor CumProd(Tensor x, Tensor axis, Optional exclusive, Optional reverse) { Object result = OnnxInterpreter.interpret(OnnxOps.CumProd.class, List.of(x, axis), List.of(exclusive, reverse)); return (Tensor) result; } - - /// + + /// /// Performs cumulative sum of the input elements along the given axis. /// By default, it will do the sum inclusively meaning the first element is copied as is. /// Through an `exclusive` attribute, this behavior can change to exclude the first element. /// It can also perform summation in the opposite direction of the axis. For that, set `reverse` attribute to 1. - /// + /// /// Example: /// ``` /// input_x = [1, 2, 3] @@ -894,59 +894,59 @@ public static Tensor CumProd(Tensor x, Tensor axis, Optional Tensor CumSum(Tensor x, Tensor axis, Optional exclusive, Optional reverse) { Object result = OnnxInterpreter.interpret(OnnxOps.CumSum.class, List.of(x, axis), List.of(exclusive, reverse)); return (Tensor) result; } - + /// Computes the discrete Fourier Transform (DFT) of the input. - /// + /// /// Assuming the input has shape `[M, N]`, where `N` is the dimension over which the /// DFT is computed and `M` denotes the conceptual "all other dimensions," /// the DFT `y[m, k]` of shape `[M, N]` is defined as - /// + /// /// $$y[m, k] = \sum_{n=0}^{N-1} e^{-2 \pi j \frac{k n}{N} } x[m, n] ,$$ - /// + /// /// and the inverse transform is defined as - /// + /// /// $$x[m, n] = \frac{1}{N} \sum_{k=0}^{N-1} e^{2 \pi j \frac{k n}{N} } y[m, k] ,$$ - /// + /// /// where $j$ is the imaginary unit. - /// + /// /// The actual shape of the output is specified in the "output" section. - /// + /// /// Reference: https://docs.scipy.org/doc/scipy/tutorial/fft.html public static Tensor DFT(Tensor input, Optional> dft_length, Optional> axis, Optional inverse, Optional onesided) { Object result = OnnxInterpreter.interpret(OnnxOps.DFT.class, List.of(input, dft_length, axis), List.of(inverse, onesided)); return (Tensor) result; } - - /// + + /// /// Performs deformable convolution as described in https://arxiv.org/abs/1703.06211 and https://arxiv.org/abs/1811.11168. /// This operator specification supports the general N-D case. Note that most common use cases have 2D or 3D data. public static Tensor DeformConv(Tensor X, Tensor W, Tensor offset, Optional> B, Optional> mask, Optional pads, Optional dilations, Optional strides, Optional offset_group, Optional group, Optional kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.DeformConv.class, List.of(X, W, offset, B, mask), List.of(pads, dilations, strides, offset_group, group, kernel_shape)); return (Tensor) result; } - + /// DepthToSpace rearranges (permutes) data from depth into blocks of spatial data. /// This is the reverse transformation of SpaceToDepth. More specifically, this op outputs a copy of /// the input tensor where values from the depth dimension are moved in spatial blocks to the height /// and width dimensions. By default, `mode` = `DCR`. /// In the DCR mode, elements along the depth dimension from the input tensor are rearranged in the /// following order: depth, column, and then row. The output y is computed from the input x as below: - /// + /// /// ``` /// b, c, h, w = x.shape /// tmp = np.reshape(x, [b, blocksize, blocksize, c // (blocksize**2), h, w]) /// tmp = np.transpose(tmp, [0, 3, 4, 1, 5, 2]) /// y = np.reshape(tmp, [b, c // (blocksize**2), h * blocksize, w * blocksize]) /// ``` - /// + /// /// In the CRD mode, elements along the depth dimension from the input tensor are rearranged in the /// following order: column, row, and the depth. The output y is computed from the input x as below: - /// + /// /// ``` /// b, c, h, w = x.shape /// tmp = np.reshape(x, [b, c // (blocksize ** 2), blocksize, blocksize, h, w]) @@ -957,14 +957,14 @@ public static Tensor DepthToSpace(Tensor input, Optional mode, Object result = OnnxInterpreter.interpret(OnnxOps.DepthToSpace.class, List.of(input), List.of(mode, blocksize)); return (Tensor) result; } - - /// + + /// /// The linear dequantization operator. It consumes a quantized tensor, a scale, and a zero point to compute the /// full-precision tensor. The dequantization formula is `y = (x - x_zero_point) * x_scale`. `x_scale` and `x_zero_point` /// must have the same shape, determining the quantization's granularity: a scalar for per-tensor/per-layer quantization, /// a 1-D tensor for per-axis quantization, or have a rank identical to the input for blocked quantization. /// See QuantizeLinear for details on quantization granularity. - /// + /// /// `x_zero_point` and `x` must have the same type. `x` and `y` must have the same shape. In the case of dequantizing /// `int32`, there's no zero point (zero point is supposed to be 0). /// `zero-point` is usually not used in the case of float8 and 4-bit types quantization, but the dequantization formula remains the same @@ -974,8 +974,8 @@ public static Tensor DequantizeLinear(Tensor x, Tensor Object result = OnnxInterpreter.interpret(OnnxOps.DequantizeLinear.class, List.of(x, x_scale, x_zero_point), List.of(output_dtype, axis, block_size)); return (Tensor) result; } - - /// + + /// /// Det calculates determinant of a square matrix or batches of square matrices. /// Det takes one input tensor of shape `[*, M, M]`, where `*` is zero or more batch dimensions, /// and the inner-most 2 dimensions form square matrices. @@ -985,8 +985,8 @@ public static Tensor Det(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Det.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Uses an index mapping to convert a dictionary to an array.
/// Given a dictionary, each key is looked up in the vocabulary attribute corresponding to /// the key type. The index into the vocabulary array at which the key is found is then @@ -998,26 +998,26 @@ public static Tensor Det(Tensor X) { /// Any keys not present in the input dictionary, will be zero in the output array.
/// For example: if the ``string_vocabulary`` parameter is set to ``["a", "c", "b", "z"]``, /// then an input of ``{"a": 4, "c": 8}`` will produce an output of ``[4, 8, 0, 0]``. - /// + /// public static Tensor DictVectorizer(Map X, Optional string_vocabulary, Optional int64_vocabulary) { Object result = OnnxInterpreter.interpret(OnnxOps.DictVectorizer.class, List.of(X), List.of(string_vocabulary, int64_vocabulary)); return (Tensor) result; } - - /// + + /// /// Performs element-wise binary division (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// For integer inputs, the result is computed using truncating division (rounding toward zero). /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Div(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Div.class, List.of(A, B), List.of()); return (Tensor) result; } - + public record DropoutResult(Tensor output, Tensor mask) { } - /// + /// /// Dropout takes an input floating-point tensor, an optional input ratio (floating-point scalar) and an optional input training_mode (boolean scalar). It produces two tensor outputs, /// output (floating-point tensor) and mask (optional `Tensor`). If `training_mode` is true then the output Y will be a random dropout; /// Note that this Dropout scales the masked input data by the following equation, so to convert the trained model into inference mode, @@ -1035,34 +1035,34 @@ public static DropoutResult Dropout(Tensor data, Optional((Tensor)resultArray[0], (Tensor)resultArray[1]); } - + public record DynamicQuantizeLinearResult(Tensor y, Tensor y_scale, Tensor y_zero_point) { } - /// + /// /// A Function to fuse calculation for Scale, Zero Point and FP32->8Bit conversion of FP32 Input data. /// Outputs Scale, ZeroPoint and Quantized Input for a given FP32 Input. /// Scale is calculated as: /// ``` /// y_scale = (maximum(0, max(x)) - minimum(0, min(x))) / (qmax - qmin) /// ``` - /// + /// /// * where qmax and qmin are max and min values for quantization range i.e. [0, 255] in case of uint8 /// * data range is adjusted to include 0. - /// + /// /// Zero point is calculated as: /// ``` /// intermediate_zero_point = qmin - min(x)/y_scale /// y_zero_point = cast(round(saturate(intermediate_zero_point))) /// ``` - /// + /// /// * where qmax and qmin are max and min values for quantization range .i.e [0, 255] in case of uint8 /// * for saturation, it saturates to [0, 255] if it's uint8, or [-127, 127] if it's int8. Right now only uint8 is supported. /// * rounding to nearest ties to even. - /// + /// /// Data quantization formula is: /// ``` /// y = saturate (round (x / y_scale) + y_zero_point) /// ``` - /// + /// /// * for saturation, it saturates to [0, 255] if it's uint8, or [-127, 127] if it's int8. Right now only uint8 is supported. /// * rounding to nearest ties to even. public static DynamicQuantizeLinearResult DynamicQuantizeLinear(Tensor x) { @@ -1070,29 +1070,29 @@ public static DynamicQuantizeLinearResult DynamicQuantizeLinear(Tensor x) Object[] resultArray = (Object[]) result; return new DynamicQuantizeLinearResult((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// An einsum of the form `term1, term2 -> output-term` produces an output tensor using the following equation - /// + /// /// ``` /// output[output-term] = reduce-sum( input1[term1] * input2[term2] ) /// ``` - /// + /// /// where the reduce-sum performs a summation over all the indices occurring in the input terms (term1, term2) /// that do not occur in the output-term. - /// + /// /// The Einsum operator evaluates algebraic tensor operations on a sequence of tensors, using the Einstein summation /// convention. The equation string contains a comma-separated sequence of lower case letters. Each term corresponds to /// an operand tensor, and the characters within the terms correspond to operands dimensions. - /// + /// /// This sequence may be followed by "->" to separate the left and right hand side of the equation. /// If the equation contains "->" followed by the right-hand side, the explicit (not classical) form of the Einstein /// summation is performed, and the right-hand side indices indicate output tensor dimensions. In other cases, /// output indices are (implicitly) set to the alphabetically sorted sequence of indices appearing exactly once in the /// equation. - /// + /// /// When a dimension character is repeated in the left-hand side, it represents summation along the dimension. - /// + /// /// The equation may contain ellipsis ("...") to enable broadcasting. Ellipsis must indicate a fixed number of dimensions. /// Specifically, every occurrence of ellipsis in the equation must represent the same number of dimensions. /// The right-hand side may contain exactly one ellipsis. In implicit mode, the ellipsis dimensions are set to the @@ -1101,8 +1101,8 @@ public static Tensor Einsum(List> Inputs, String equation) { Object result = OnnxInterpreter.interpret(OnnxOps.Einsum.class, List.of(Inputs), List.of(equation)); return (Tensor) result; } - - /// + + /// /// Elu takes one input data (Tensor) and produces one output data /// (Tensor) where the function `f(x) = alpha * (exp(x) - 1.) for x < /// 0`, `f(x) = x for x >= 0`., is applied to the tensor elementwise. @@ -1110,32 +1110,32 @@ public static Tensor Elu(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.Elu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `equal` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Equal(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Equal.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Computes the error function of the given input tensor element-wise. public static Tensor Erf(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Erf.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the exponential of the given input tensor, element-wise. public static Tensor Exp(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Exp.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Broadcast the input tensor following the given shape and the broadcast rule. /// The broadcast rule is similar to numpy.array(input) * numpy.ones(shape): /// Dimensions are right alignment; @@ -1148,8 +1148,8 @@ public static Tensor Expand(Tensor input, Tensor shape) { Object result = OnnxInterpreter.interpret(OnnxOps.Expand.class, List.of(input, shape), List.of()); return (Tensor) result; } - - /// + + /// /// Generate a 2D tensor (matrix) with ones on the diagonal and zeros everywhere else. Only 2D /// tensors are supported, i.e. input T1 must be of rank 2. The shape of the output tensor is the /// same as the input tensor. The data type can be specified by the 'dtype' argument. If @@ -1161,8 +1161,8 @@ public static Tensor EyeLike(Tensor input, Optional dtype Object result = OnnxInterpreter.interpret(OnnxOps.EyeLike.class, List.of(input), List.of(dtype, k)); return (Tensor) result; } - - /// + + /// /// Concatenates input tensors into one continuous output.
/// All input shapes are 2-D and are concatenated along the second dimension. 1-D tensors are treated as [1,C]. /// Inputs are copied to the output maintaining the order of the input arguments.
@@ -1171,8 +1171,8 @@ public static Tensor FeatureVectorizer(List> X, Optional< Object result = OnnxInterpreter.interpret(OnnxOps.FeatureVectorizer.class, List.of(X), List.of(inputdimensions)); return (Tensor) result; } - - /// + + /// /// Flattens the input tensor into a 2D matrix. If input tensor has shape /// (d_0, d_1, ... d_n) then the output will have shape /// (d_0 X d_1 ... d_(axis-1), d_axis X d_(axis+1) ... X dn). @@ -1180,8 +1180,8 @@ public static Tensor Flatten(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Flatten.class, List.of(input), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Floor takes one input data (Tensor) and produces one output data /// (Tensor) where the floor is, y = floor(x), is applied to /// the tensor elementwise. If x is integral, +0, -0, NaN, or infinite, x itself is returned. @@ -1189,14 +1189,14 @@ public static Tensor Floor(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Floor.class, List.of(X), List.of()); return (Tensor) result; } - + public record GRUResult(Tensor Y, Tensor Y_h) { } - /// + /// /// Computes an one-layer GRU. This operator is usually supported via some custom /// implementation such as CuDNN. - /// + /// /// Notations: - /// + /// /// * `X` - input tensor /// * `z` - update gate /// * `r` - reset gate @@ -1212,16 +1212,16 @@ public record GRUResult(Tensor Y, Tensor Y_h) { } /// * `RBb[zrh]` - R bias vectors for backward update, reset, and hidden gates /// * `H` - Hidden state /// * `num_directions` - 2 if direction == bidirectional else 1 - /// + /// /// Activation functions: - /// + /// /// * Relu(x) - max(0, x) /// * Tanh(x) - (1 - e^{-2x})/(1 + e^{-2x}) /// * Sigmoid(x) - 1/(1 + e^{-x}) - /// + /// /// NOTE: /// Below are optional - /// + /// /// * Affine(x) - alpha * x + beta /// * LeakyRelu(x) - x if x >= 0 else alpha * x /// * ThresholdedRelu(x) - x if x >= alpha else 0 @@ -1230,9 +1230,9 @@ public record GRUResult(Tensor Y, Tensor Y_h) { } /// * Elu(x) - x if x >= 0 else alpha * (e^x - 1) /// * Softsign(x) - x/(1 + |x|) /// * Softplus(x) - log(1 + e^x) - /// + /// /// Equations (Default: f=Sigmoid, g=Tanh): - /// + /// /// * zt = f(Xt*(Wz^T) + Ht-1*(Rz^T) + Wbz + Rbz) /// * rt = f(Xt*(Wr^T) + Ht-1*(Rr^T) + Wbr + Rbr) /// * ht = g(Xt*(Wh^T) + (rt (.) Ht-1)*(Rh^T) + Rbh + Wbh) # default, when linear_before_reset = 0 @@ -1244,18 +1244,18 @@ public static GRUResult GRU(Tensor X, Tensor W, Tensor R, Option Object[] resultArray = (Object[]) result; return new GRUResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Given `data` tensor of rank r >= 1, and `indices` tensor of rank q, gather /// entries of the axis dimension of `data` (by default outer-most one as axis=0) indexed by `indices`, and concatenates /// them in an output tensor of rank q + (r - 1). - /// + /// /// It is an indexing operation that indexes into the input `data` along a single (specified) axis. /// Each entry in `indices` produces a `r-1` dimensional slice of the input tensor. /// The entire operation produces, conceptually, a `q`-dimensional tensor of `r-1` dimensional slices, /// which is arranged into a `q + (r-1)`-dimensional tensor, with the `q` dimensions taking the /// place of the original `axis` that is being indexed into. - /// + /// /// The following few examples illustrate how `Gather` works for specific shapes of `data`, /// `indices`, and given value of `axis`: /// | data shape | indices shape | axis | output shape | output equation | @@ -1264,10 +1264,10 @@ public static GRUResult GRU(Tensor X, Tensor W, Tensor R, Option /// | (P, Q, R) | ( ) (a scalar) | 1 | (P, R) | output[p, r] = data[p, indices, r] | /// | (P, Q) | (R, S) | 0 | (R, S, Q) | output[r, s, q] = data[ [indices[r, s], q] | /// | (P, Q) | (R, S) | 1 | (P, R, S) | output[p, r, s] = data[ p, indices[r, s]] | - /// + /// /// More generally, if `axis = 0`, let `k = indices[i_{0}, ..., i_{q-1}]` /// then `output[i_{0}, ..., i_{q-1}, j_{0}, ..., j_{r-2}] = input[k , j_{0}, ..., j_{r-2}]`: - /// + /// /// ``` /// data = [ /// [1.0, 1.2], @@ -1289,10 +1289,10 @@ public static GRUResult GRU(Tensor X, Tensor W, Tensor R, Option /// ], /// ] /// ``` - /// + /// /// If `axis = 1`, let `k = indices[i_{0}, ..., i_{q-1}]` /// then `output[j_{0}, i_{0}, ..., i_{q-1}, j_{1}, ..., j_{r-2}] = input[j_{0}, k, j_{1}, ..., j_{r-2}]`: - /// + /// /// ``` /// data = [ /// [1.0, 1.2, 1.9], @@ -1313,9 +1313,9 @@ public static Tensor Gather(Tensor data, Tensor indices, O Object result = OnnxInterpreter.interpret(OnnxOps.Gather.class, List.of(data, indices), List.of(axis)); return (Tensor) result; } - - /// - /// + + /// + /// /// GatherElements takes two inputs `data` and `indices` of the same rank r >= 1 /// and an optional attribute `axis` that identifies an axis of `data` /// (by default, the outer-most axis, that is axis 0). It is an indexing operation @@ -1323,7 +1323,7 @@ public static Tensor Gather(Tensor data, Tensor indices, O /// positions determined by elements of the `indices` tensor. /// Its output shape is the same as the shape of `indices` and consists of one value /// (gathered from the `data`) for each element in `indices`. - /// + /// /// For instance, in the 3-D case (r = 3), the output produced is determined /// by the following equations: /// ``` @@ -1331,9 +1331,9 @@ public static Tensor Gather(Tensor data, Tensor indices, O /// out[i][j][k] = input[i][index[i][j][k]][k] if axis = 1, /// out[i][j][k] = input[i][j][index[i][j][k]] if axis = 2, /// ``` - /// + /// /// This operator is also the inverse of ScatterElements. It is similar to Torch's gather operation. - /// + /// /// Example 1: /// ``` /// data = [ @@ -1371,86 +1371,86 @@ public static Tensor GatherElements(Tensor data, Tensor in Object result = OnnxInterpreter.interpret(OnnxOps.GatherElements.class, List.of(data, indices), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Given `data` tensor of rank `r` >= 1, `indices` tensor of rank `q` >= 1, and `batch_dims` integer `b`, this operator gathers /// slices of `data` into an output tensor of rank `q + r - indices_shape[-1] - 1 - b`. - /// + /// /// `indices` is an q-dimensional integer tensor, best thought of as a `(q-1)`-dimensional tensor of index-tuples into `data`, /// where each element defines a slice of `data` - /// + /// /// `batch_dims` (denoted as `b`) is an integer indicating the number of batch dimensions, i.e the leading `b` number of dimensions of /// `data` tensor and `indices` are representing the batches, and the gather starts from the `b+1` dimension. - /// + /// /// Some salient points about the inputs' rank and shape: - /// + /// /// 1) r >= 1 and q >= 1 are to be honored. There is no dependency condition to be met between ranks `r` and `q` - /// + /// /// 2) The first `b` dimensions of the shape of `indices` tensor and `data` tensor must be equal. - /// + /// /// 3) b < min(q, r) is to be honored. - /// + /// /// 4) The `indices_shape[-1]` should have a value between 1 (inclusive) and rank `r-b` (inclusive) - /// + /// /// 5) All values in `indices` are expected to be within bounds [-s, s-1] along axis of size `s` (i.e.) `-data_shape[i] <= indices[...,i] <= data_shape[i] - 1`. /// It is an error if any of the index values are out of bounds. - /// + /// /// The output is computed as follows: - /// + /// /// The output tensor is obtained by mapping each index-tuple in the `indices` tensor to the corresponding slice of the input `data`. - /// + /// /// 1) If `indices_shape[-1] > r-b` => error condition - /// + /// /// 2) If `indices_shape[-1] == r-b`, since the rank of `indices` is `q`, `indices` can be thought of as `N` `(q-b-1)`-dimensional tensors /// containing 1-D tensors of dimension `r-b`, where `N` is an integer equals to the product of 1 and all the elements in the batch dimensions /// of the indices_shape. Let us think of each such `r-b` ranked tensor as `indices_slice`. Each *scalar value* corresponding to `data[0:b-1,indices_slice]` /// is filled into the corresponding location of the `(q-b-1)`-dimensional tensor to form the `output` tensor (Example 1 below) - /// + /// /// 3) If `indices_shape[-1] < r-b`, since the rank of `indices` is `q`, `indices` can be thought of as `N` `(q-b-1)`-dimensional tensor /// containing 1-D tensors of dimension `< r-b`. Let us think of each such tensors as `indices_slice`. Each *tensor slice* corresponding /// to `data[0:b-1, indices_slice , :]` is filled into the corresponding location of the `(q-b-1)`-dimensional tensor /// to form the `output` tensor (Examples 2, 3, 4 and 5 below) - /// + /// /// This operator is the inverse of `ScatterND`. - /// + /// /// **Example 1** - /// + /// /// ``` /// batch_dims = 0 /// data = [[0,1],[2,3]] # data_shape = [2, 2] /// indices = [[0,0],[1,1]] # indices_shape = [2, 2] /// output = [0,3] # output_shape = [2] /// ``` - /// + /// /// **Example 2** - /// + /// /// ``` /// batch_dims = 0 /// data = [[0,1],[2,3]] # data_shape = [2, 2] /// indices = [[1],[0]] # indices_shape = [2, 1] /// output = [[2,3],[0,1]] # output_shape = [2, 2] /// ``` - /// + /// /// **Example 3** - /// + /// /// ``` /// batch_dims = 0 /// data = [[[0,1],[2,3]],[[4,5],[6,7]]] # data_shape = [2, 2, 2] /// indices = [[0,1],[1,0]] # indices_shape = [2, 2] /// output = [[2,3],[4,5]] # output_shape = [2, 2] /// ``` - /// + /// /// **Example 4** - /// + /// /// ``` /// batch_dims = 0 /// data = [[[0,1],[2,3]],[[4,5],[6,7]]] # data_shape = [2, 2, 2] /// indices = [[[0,1]],[[1,0]]] # indices_shape = [2, 1, 2] /// output = [[[2,3]],[[4,5]]] # output_shape = [2, 1, 2] /// ``` - /// + /// /// **Example 5** - /// + /// /// ``` /// batch_dims = 1 /// data = [[[0,1],[2,3]],[[4,5],[6,7]]] # data_shape = [2, 2, 2] @@ -1461,8 +1461,8 @@ public static Tensor GatherND(Tensor data, Tensor indices, Optio Object result = OnnxInterpreter.interpret(OnnxOps.GatherND.class, List.of(data, indices), List.of(batch_dims)); return (Tensor) result; } - - /// + + /// /// Gelu takes one input data (Tensor) and produces one /// output data (Tensor) where the gaussian error linear units function, /// $y = 0.5 * x * (1 + erf(x/sqrt(2)))$ is applied to the tensor elementwise. @@ -1473,13 +1473,13 @@ public static Tensor Gelu(Tensor X, Optional approximate) { Object result = OnnxInterpreter.interpret(OnnxOps.Gelu.class, List.of(X), List.of(approximate)); return (Tensor) result; } - + /// General Matrix multiplication: /// https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 - /// + /// /// * A' = transpose(A) if transA else A /// * B' = transpose(B) if transB else B - /// + /// /// Compute Y = alpha * A' * B' + beta * C, where input tensor A has shape (M, K) or (K, M), /// input tensor B has shape (K, N) or (N, K), input tensor C is broadcastable to shape (M, N), /// and output tensor Y has shape (M, N). A will be transposed before doing the @@ -1490,8 +1490,8 @@ public static Tensor Gemm(Tensor A, Tensor B, Optional> C Object result = OnnxInterpreter.interpret(OnnxOps.Gemm.class, List.of(A, B, C), List.of(alpha, transB, beta, transA)); return (Tensor) result; } - - /// + + /// /// GlobalAveragePool consumes an input tensor X and applies average pooling across /// the values in the same channel. This is equivalent to AveragePool with kernel size /// equal to the spatial dimension of input tensor. @@ -1499,8 +1499,8 @@ public static Tensor GlobalAveragePool(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.GlobalAveragePool.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// GlobalLpPool consumes an input tensor X and applies lp pool pooling across /// the values in the same channel. This is equivalent to LpPool with kernel size /// equal to the spatial dimension of input tensor. @@ -1508,8 +1508,8 @@ public static Tensor GlobalLpPool(Tensor X, Optional p) { Object result = OnnxInterpreter.interpret(OnnxOps.GlobalLpPool.class, List.of(X), List.of(p)); return (Tensor) result; } - - /// + + /// /// GlobalMaxPool consumes an input tensor X and applies max pooling across /// the values in the same channel. This is equivalent to MaxPool with kernel size /// equal to the spatial dimension of input tensor. @@ -1517,12 +1517,12 @@ public static Tensor GlobalMaxPool(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.GlobalMaxPool.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Gradient operator computes the partial derivatives of a specific tensor w.r.t. /// some other tensors. This operator is widely used in gradient-based training /// algorithms. To illustrate its use, let's consider a computation graph, - /// + /// /// ``` /// X -----. /// | @@ -1532,12 +1532,12 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// Z /// ``` - /// + /// /// , where W and Z are trainable tensors. Note that operators' attributes are /// omitted for the sake of simplicity. Let dY/dW (dY/dZ) be the gradient of /// Y with respect to W (Z). The user can compute gradient by inserting Gradient /// operator to form another graph shown below. - /// + /// /// ``` /// W --> Conv --> H --> Gemm --> Y /// | ^ ^ @@ -1554,21 +1554,21 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---------------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// By definition, the tensor "y" is a function of independent variables in "xs" /// and "zs". Since we only compute the gradient of "y" w.r.t. the differentiable /// variables in "xs", this Gradient only outputs dY/dW and dY/dZ. Note that "H" /// cannot appear in "xs" and "zs". The reason is that "H" can be determined by /// tensors "W" and "X" and therefore "H" is not an independent variable. - /// + /// /// All outputs are optional. If needed, for example, user can assign an empty /// string to the 1st output name of that Gradient to skip the generation of dY/dW. /// Note that the concept of optional outputs can also be found in ONNX's RNN, GRU, /// and LSTM. - /// + /// /// Gradient operator can compute derivative against intermediate tensors. For /// example, the gradient of Y with respect to H can be done via - /// + /// /// ``` /// W --> Conv --> H --> Gemm --> Y /// ^ | ^ @@ -1584,20 +1584,20 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---------------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// It is possible to represent high-order differentiation using Gradient operators. /// For example, given the following linear model: - /// + /// /// ``` /// W --> Gemm --> Y --> Loss --> O /// ^ ^ /// | | /// X L /// ``` - /// + /// /// To compute the 2nd order derivative of O with respect to W (denoted by /// d^2O/dW^2), one can do - /// + /// /// ``` /// W --> Gemm --> Y --> Loss --> O /// | ^ ^ @@ -1615,20 +1615,20 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---> d^2O/dW^2 (2nd output of Gradient) /// ``` - /// + /// /// The tensors named in attributes "xs", "zs", and "y" define the differentiated /// computation graph, and the inputs to Gradient node define the values at /// which the gradient is computed. We can feed different tensors to the identified /// graph. For example, one can compute the gradient of Y with respect to H at /// a specific value of H, H_1, by providing that value as an input to the Gradient /// node. - /// + /// /// ``` /// W --> Conv --> H --> Gemm --> Y /// ^ ^ /// | | /// X Z - /// + /// /// Z_1 (2nd input of Gradient) /// | /// v @@ -1636,7 +1636,7 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// When the inputs of Gradient are the tensors named in "xs" and "zs", the /// computation can be optimized. More specifically, intermediate variables in /// forward pass can be reused if the gradient is computed via reverse-mode @@ -1645,43 +1645,43 @@ public static List> Gradient(List> Inputs, String Object result = OnnxInterpreter.interpret(OnnxOps.Gradient.class, List.of(Inputs), List.of(y, zs, xs)); return (List>) result; } - - /// + + /// /// Returns the tensor resulted from performing the `greater` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Greater(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Greater.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `greater_equal` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor GreaterOrEqual(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.GreaterOrEqual.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Given an input `X` and a flow-field `grid`, computes the output `Y` using `X` values and pixel locations from the `grid`. /// For spatial input `X` with shape (N, C, H, W), the `grid` will have shape (N, H_out, W_out, 2), /// the output `Y` will have shape (N, C, H_out, W_out). For volumetric input `X` with shape (N, C, D, H, W), /// the `grid` will have shape (N, D_out, H_out, W_out, 3), the output `Y` will have shape (N, C, D_out, H_out, W_out). /// More generally, for an input `X` of rank r+2 with shape (N, C, d1, d2, ..., dr), /// the `grid` will have shape (N, D1_out, D2_out, ..., Dr_out, r), the output `Y` will have shape (N, C, D1_out, D2_out, ..., Dr_out). - /// + /// /// The tensor `X` contains values at centers of square pixels (voxels, etc) locations such as (n, c, d1_in, d2_in, ..., dr_in). /// The (n, d1_out, d2_out, ..., dr_out, :) values from the tensor `grid` are the normalized positions for interpolating the values /// at the (n, c, d1_out, d2_out, ..., dr_out) locations from the output tensor `Y` using a specified interpolation method (the mode) /// and a padding mode (for `grid` positions falling outside the 2-dimensional image). - /// + /// /// For example, the values in `grid[n, h_out, w_out, :]` are size-2 vectors specifying normalized positions in the 2-dimensional space of `X`. /// They are used to interpolate output values of `Y[n, c, h_out, w_out]`. - /// + /// /// The GridSample operator is often used in doing grid generator and sampler in the /// [Spatial Transformer Networks](https://arxiv.org/abs/1506.02025). /// See also in [torch.nn.functional.grid_sample](https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html). @@ -1689,11 +1689,11 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti Object result = OnnxInterpreter.interpret(OnnxOps.GridSample.class, List.of(X, grid), List.of(mode, align_corners, padding_mode)); return (Tensor) result; } - - /// + + /// /// A GroupNormalization function. Carries out group normalization as described in /// the paper https://arxiv.org/abs/1803.08494 - /// + /// /// This operator transforms input according to /// ``` /// y = scale * (x - mean) / sqrt(variance + epsilon) + bias, @@ -1702,7 +1702,7 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti /// `scale` and `bias` should be specified for each channel. The number of /// groups `num_groups` should be divisible by the number of channels so that there are /// an equal number of channels per group. - /// + /// /// The overall computation has two stages: the first stage normalizes the elements to /// have zero mean and unit variance for each instance in each group, and the second /// stage scales and shifts the results of the first stage. The floating-point precision @@ -1710,7 +1710,7 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti /// if `stash_type` is 1, the operator casts all input variables to 32-bit float, /// performs the computation, and finally casts the normalized results back to the /// original type of `X`. The second stage does not depend on `stash_type`. - /// + /// /// When the number of groups is the same as the number of channels, this operator is /// equivalent to InstanceNormalization. When there is only one group, this operator /// is equivalent to LayerNormalization. @@ -1718,22 +1718,22 @@ public static Tensor GroupNormalization(Tensor X, Tensor scale, Ten Object result = OnnxInterpreter.interpret(OnnxOps.GroupNormalization.class, List.of(X, scale, bias), List.of(epsilon, stash_type, num_groups)); return (Tensor) result; } - - /// + + /// /// Generates a Hamming window as described in the paper https://ieeexplore.ieee.org/document/1455106. public static Tensor HammingWindow(Tensor size, Optional periodic, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.HammingWindow.class, List.of(size), List.of(periodic, output_datatype)); return (Tensor) result; } - - /// + + /// /// Generates a Hann window as described in the paper https://ieeexplore.ieee.org/document/1455106. public static Tensor HannWindow(Tensor size, Optional periodic, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.HannWindow.class, List.of(size), List.of(periodic, output_datatype)); return (Tensor) result; } - - /// + + /// /// HardSigmoid takes one input data (Tensor) and produces one output data /// (Tensor) where the HardSigmoid function, y = max(0, min(1, alpha * x + beta)), /// is applied to the tensor elementwise. @@ -1741,8 +1741,8 @@ public static Tensor HardSigmoid(Tensor X, Optional alpha, Opti Object result = OnnxInterpreter.interpret(OnnxOps.HardSigmoid.class, List.of(X), List.of(alpha, beta)); return (Tensor) result; } - - /// + + /// /// HardSwish takes one input data (Tensor) and produces one output data (Tensor) where /// the HardSwish function, y = x * max(0, min(1, alpha * x + beta)) = x * HardSigmoid(x), /// where alpha = 1/6 and beta = 0.5, is applied to the tensor elementwise. @@ -1750,12 +1750,12 @@ public static Tensor HardSwish(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.HardSwish.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the hardmax values for the given input: - /// + /// /// Hardmax(element in input, axis) = 1 if the element is the first maximum value along the specified axis, 0 otherwise - /// + /// /// The "axis" attribute indicates the dimension along which Hardmax /// will be performed. The output tensor has the same shape /// and contains the Hardmax values of the corresponding input. @@ -1763,13 +1763,13 @@ public static Tensor Hardmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Hardmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - + /// Identity operator public static V Identity(V input) { Object result = OnnxInterpreter.interpret(OnnxOps.Identity.class, List.of(input), List.of()); return (V) result; } - + /// Loads and decodes and image from a file. If it can't decode for any reason (e.g. corrupted encoded /// stream, invalid format, it will return an empty matrix). /// The following image formats are supported: @@ -1797,8 +1797,8 @@ public static Tensor ImageDecoder(Tensor encoded_stream, Optional) result; } - - /// + + /// /// Replaces inputs that equal one value with another, leaving all other elements alone.
/// This operator is typically used to replace missing values in situations where they have a canonical /// representation, such as -1, 0, NaN, or some extreme value.
@@ -1811,53 +1811,53 @@ public static Tensor Imputer(Tensor X, Optional replaced_value_i Object result = OnnxInterpreter.interpret(OnnxOps.Imputer.class, List.of(X), List.of(replaced_value_int64, replaced_value_float, imputed_value_int64s, imputed_value_floats)); return (Tensor) result; } - - /// + + /// /// Carries out instance normalization as described in the paper /// https://arxiv.org/abs/1607.08022. - /// + /// /// y = scale * (x - mean) / sqrt(variance + epsilon) + B, /// where mean and variance are computed per instance per channel. public static Tensor InstanceNormalization(Tensor input, Tensor scale, Tensor B, Optional epsilon) { Object result = OnnxInterpreter.interpret(OnnxOps.InstanceNormalization.class, List.of(input, scale, B), List.of(epsilon)); return (Tensor) result; } - + /// Map infinity to true and other values to false. public static Tensor IsInf(Tensor X, Optional detect_negative, Optional detect_positive) { Object result = OnnxInterpreter.interpret(OnnxOps.IsInf.class, List.of(X), List.of(detect_negative, detect_positive)); return (Tensor) result; } - + /// Returns which elements of the input are NaN. public static Tensor IsNaN(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.IsNaN.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Local Response Normalization proposed in the [AlexNet paper](https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf). /// It normalizes over local input regions. /// The local region is defined across the channels. For an element `X[n, c, d1, ..., dk]` in a tensor /// of shape `(N x C x D1 x D2, ..., Dk)`, its region is /// `{X[n, i, d1, ..., dk] | max(0, c - floor((size - 1) / 2)) <= i <= min(C - 1, c + ceil((size - 1) / 2))}`. - /// + /// /// `square_sum[n, c, d1, ..., dk] = sum(X[n, i, d1, ..., dk] ^ 2)`, /// where `max(0, c - floor((size - 1) / 2)) <= i <= min(C - 1, c + ceil((size - 1) / 2))`. - /// + /// /// `Y[n, c, d1, ..., dk] = X[n, c, d1, ..., dk] / (bias + alpha / size * square_sum[n, c, d1, ..., dk] ) ^ beta` public static Tensor LRN(Tensor X, long size, Optional alpha, Optional bias, Optional beta) { Object result = OnnxInterpreter.interpret(OnnxOps.LRN.class, List.of(X), List.of(size, alpha, bias, beta)); return (Tensor) result; } - + public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } - /// + /// /// Computes an one-layer LSTM. This operator is usually supported via some /// custom implementation such as CuDNN. - /// + /// /// Notations: - /// + /// /// * `X` - input tensor /// * `i` - input gate /// * `o` - output gate @@ -1876,15 +1876,15 @@ public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } /// * `PB[iof]` - P peephole weight vector for backward input, output, and forget gates /// * `H` - Hidden state /// * `num_directions` - 2 if direction == bidirectional else 1 - /// + /// /// Activation functions: - /// + /// /// * Relu(x) - max(0, x) /// * Tanh(x) - (1 - e^{-2x})/(1 + e^{-2x}) /// * Sigmoid(x) - 1/(1 + e^{-x}) - /// + /// /// NOTE: Below are optional - /// + /// /// * Affine(x) - alpha*x + beta /// * LeakyRelu(x) - x if x >= 0 else alpha * x /// * ThresholdedRelu(x) - x if x >= alpha else 0 @@ -1893,9 +1893,9 @@ public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } /// * Elu(x) - x if x >= 0 else alpha*(e^x - 1) /// * Softsign(x) - x/(1 + |x|) /// * Softplus(x) - log(1 + e^x) - /// + /// /// Equations (Default: f=Sigmoid, g=Tanh, h=Tanh): - /// + /// /// * it = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Pi (.) Ct-1 + Wbi + Rbi) /// * ft = f(Xt*(Wf^T) + Ht-1*(Rf^T) + Pf (.) Ct-1 + Wbf + Rbf) /// * ct = g(Xt*(Wc^T) + Ht-1*(Rc^T) + Wbc + Rbc) @@ -1908,8 +1908,8 @@ public static LSTMResult LSTM(Tensor X, Tensor W, Tensor R, Opti Object[] resultArray = (Object[]) result; return new LSTMResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// Maps each element in the input tensor to another value.
/// The mapping is determined by the two parallel attributes, 'keys_*' and /// 'values_*' attribute. The i-th value in the specified 'keys_*' attribute @@ -1933,9 +1933,9 @@ public static Tensor LabelEncoder(Tensor X, Optional Object result = OnnxInterpreter.interpret(OnnxOps.LabelEncoder.class, List.of(X), List.of(values_strings, keys_int64s, keys_tensor, keys_strings, default_float, keys_floats, default_tensor, default_int64, values_tensor, values_int64s, default_string, values_floats)); return (Tensor) result; } - + public record LayerNormalizationResult(Tensor Y, Tensor Mean, Tensor InvStdDev) { } - /// + /// /// This is layer normalization defined in ONNX as function. /// The overall computation can be split into two stages. /// The first stage is standardization, which makes the @@ -1982,8 +1982,8 @@ public static LayerNormalizationResult LayerNormalization(Tensor Object[] resultArray = (Object[]) result; return new LayerNormalizationResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// LeakyRelu takes input data (Tensor) and an argument alpha, and produces one /// output data (Tensor) where the function `f(x) = alpha * x for x < 0`, /// `f(x) = x for x >= 0`, is applied to the data tensor elementwise. @@ -1991,50 +1991,50 @@ public static Tensor LeakyRelu(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.LeakyRelu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `less` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Less(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Less.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `less_equal` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor LessOrEqual(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.LessOrEqual.class, List.of(A, B), List.of()); return (Tensor) result; } - + public record LinearAttentionResult(Tensor output, Tensor present_state) { } - /// + /// /// Unified linear attention operator for autoregressive decoding (T=1) and prefill (T>1). - /// + /// /// The query, key, value, and (where applicable) decay/beta inputs use 3D packed format /// [B, T, H*D], where heads are flattened into the last dimension; q_num_heads and /// kv_num_heads are always required and are used to unpack to 4D internally for computation. /// The optional past_state and present_state are 4D with shape (B, H_kv, d_k, d_v). - /// + /// /// Group-query attention (GQA) is supported: q_num_heads must be a positive multiple of /// kv_num_heads. When q_num_heads == kv_num_heads this reduces to multi-headed linear /// attention; when q_num_heads > kv_num_heads each KV head (and its recurrent state) is /// shared by `q_num_heads / kv_num_heads` query heads (multi-query attention is the /// special case kv_num_heads == 1). - /// + /// /// The update_rule attribute selects the recurrence type: /// - "linear": S_t = S_{t-1} + k_t ⊗ v_t; o_t = scale * q_t^T S_t /// - "gated": S_t = exp(g_t) * S_{t-1} + k_t ⊗ v_t; o_t = scale * q_t^T S_t /// - "delta": S_t = S_{t-1} + β_t * k_t ⊗ (v_t - S_{t-1}^T k_t); o_t = scale * q_t^T S_t /// - "gated_delta": S_t = exp(g_t) * S_{t-1} + β_t * k_t ⊗ (v_t - exp(g_t) * S_{t-1}^T k_t); o_t = scale * q_t^T S_t - /// + /// /// where g_t is the decay (in log-space), β_t is the update rate, and ⊗ denotes outer product. - /// + /// /// Semantics: Equivalent to running the recurrent update sequentially for each token, /// but may be implemented using chunk-parallel algorithms for GPU efficiency. public static LinearAttentionResult LinearAttention(Tensor query, Tensor key, Tensor value, Optional> past_state, Optional> decay, Optional> beta, Optional chunk_size, Optional update_rule, Optional scale, long q_num_heads, long kv_num_heads) { @@ -2042,17 +2042,17 @@ public static LinearAttentionResult LinearAttention(Tensor query Object[] resultArray = (Object[]) result; return new LinearAttentionResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - + public record LinearClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// Linear classifier public static LinearClassifierResult LinearClassifier(Tensor X, Optional classlabels_ints, Optional post_transform, float[] coefficients, Optional multi_class, Optional intercepts, Optional classlabels_strings) { Object result = OnnxInterpreter.interpret(OnnxOps.LinearClassifier.class, List.of(X), List.of(classlabels_ints, post_transform, coefficients, multi_class, intercepts, classlabels_strings)); Object[] resultArray = (Object[]) result; return new LinearClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Generalized linear regression evaluation.
/// If targets is set to 1 (default) then univariate regression is performed.
/// If targets is set to M then M sets of coefficients must be passed in as a sequence @@ -2063,19 +2063,19 @@ public static Tensor LinearRegressor(Tensor X, Optional po Object result = OnnxInterpreter.interpret(OnnxOps.LinearRegressor.class, List.of(X), List.of(post_transform, coefficients, targets, intercepts)); return (Tensor) result; } - - /// + + /// /// Calculates the natural log of the given input tensor, element-wise. public static Tensor Log(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Log.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the log of softmax values for the given input: - /// + /// /// LogSoftmax(input, axis) = Log(Softmax(input, axis=axis)) - /// + /// /// The "axis" attribute indicates the dimension along which LogSoftmax /// will be performed. The output tensor has the same shape /// and contains the LogSoftmax values of the corresponding input. @@ -2083,8 +2083,8 @@ public static Tensor LogSoftmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.LogSoftmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Given a matrix, apply Lp-normalization along the provided axis. /// The output is computed as: `output = input / Lp_norm(input, axis)`. /// When the Lp norm is zero (i.e., all elements along the axis are zero), @@ -2093,8 +2093,8 @@ public static Tensor LpNormalization(Tensor input, Optional p, O Object result = OnnxInterpreter.interpret(OnnxOps.LpNormalization.class, List.of(input), List.of(p, axis)); return (Tensor) result; } - - /// + + /// /// LpPool consumes an input tensor X and applies Lp pooling across /// the tensor according to kernel sizes, stride sizes, and pad lengths. /// Lp pooling consisting of computing the Lp norm on all values of a subset @@ -2108,7 +2108,7 @@ public static Tensor LpNormalization(Tensor input, Optional p, O /// output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - {kernelSpatialShape}) / strides_spatial_shape[i] + 1) /// ``` /// if ceil_mode is enabled `pad_shape[i]` is the sum of pads along axis `i`. - /// + /// /// `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following: /// ``` /// VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - {kernelSpatialShape} + 1) / strides_spatial_shape[i]) @@ -2122,23 +2122,23 @@ public static Tensor LpPool(Tensor X, Optional p, Optional) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). public static Tensor MatMul(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.MatMul.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). /// The production MUST never overflow. The accumulation may overflow if and only if in 32 bits. public static Tensor MatMulInteger(Tensor A, Tensor B, Optional> a_zero_point, Optional> b_zero_point) { Object result = OnnxInterpreter.interpret(OnnxOps.MatMulInteger.class, List.of(A, B, a_zero_point, b_zero_point), List.of()); return (Tensor) result; } - - /// + + /// /// Element-wise max of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2146,9 +2146,9 @@ public static Tensor Max(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Max.class, List.of(data_0), List.of()); return (Tensor) result; } - + public record MaxPoolResult(Tensor Y, Tensor Indices) { } - /// + /// /// MaxPool consumes an input tensor X and applies max pooling across /// the tensor according to kernel sizes, stride sizes, and pad lengths. /// max pooling consisting of computing the max on all values of a @@ -2164,7 +2164,7 @@ public record MaxPoolResult(Tensor Y, Tensor Indices) { } /// output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1) /// ``` /// if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`. Sliding windows that would start in the right padded region are ignored. - /// + /// /// `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled: /// ``` /// VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i]) @@ -2179,15 +2179,15 @@ public record MaxPoolResult(Tensor Y, Tensor Indices) { } /// ``` /// pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i] /// ``` - /// The output of each pooling window is maximum number of elements exclude pad. - /// + /// The output of each pooling window is maximum number of elements exclude pad. + /// public static MaxPoolResult MaxPool(Tensor X, Optional pads, Optional dilations, Optional auto_pad, Optional ceil_mode, Optional storage_order, Optional strides, long[] kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.MaxPool.class, List.of(X), List.of(pads, dilations, auto_pad, ceil_mode, storage_order, strides, kernel_shape)); Object[] resultArray = (Object[]) result; return new MaxPoolResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// ROI max pool consumes an input tensor X and region of interests (RoIs) to /// apply max pooling across each RoI, to produce output 4-D tensor of shape /// (num_rois, channels, pooled_shape[0], pooled_shape[1]). @@ -2195,23 +2195,23 @@ public static Tensor MaxRoiPool(Tensor X, Tensor rois, Optional) result; } - - /// + + /// /// MaxUnpool essentially computes the partial inverse of the MaxPool op. /// The input information to this op is typically the output information from a MaxPool op. The first /// input tensor X is the tensor that needs to be unpooled, which is typically the pooled tensor (first output) /// from MaxPool. The second input tensor, I, contains the indices to the (locally maximal) elements corresponding /// to the elements in the first input tensor X. Input tensor I is typically the second output of the MaxPool op. /// The third (optional) input is a tensor that specifies the output size of the unpooling operation. - /// + /// /// MaxUnpool is intended to do 'partial' inverse of the MaxPool op. 'Partial' because all the non-maximal /// values from the original input to MaxPool are set to zero in the output of the MaxUnpool op. Pooling /// the result of an unpooling operation should give back the original input to the unpooling op. - /// + /// /// MaxUnpool can produce the same output size for several input sizes, which makes unpooling op ambiguous. /// The third input argument, output_size, is meant to disambiguate the op and produce output tensor of /// known/predictable size. - /// + /// /// In addition to the inputs, MaxUnpool takes three attributes, namely kernel_shape, strides, and pads, /// which define the exact unpooling op. The attributes typically have the same values as the corresponding /// pooling op that the unpooling op is trying to invert. @@ -2219,8 +2219,8 @@ public static Tensor MaxUnpool(Tensor X, Tensor I, Optional) result; } - - /// + + /// /// Element-wise mean of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2228,30 +2228,30 @@ public static Tensor Mean(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Mean.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// A MeanVarianceNormalization Function: Perform mean variance normalization /// on the input tensor X using formula: `(X-EX)/sqrt(E(X-EX)^2)` public static Tensor MeanVarianceNormalization(Tensor X, Optional axes) { Object result = OnnxInterpreter.interpret(OnnxOps.MeanVarianceNormalization.class, List.of(X), List.of(axes)); return (Tensor) result; } - - /// + + /// /// Generate a MelWeightMatrix that can be used to re-weight a Tensor containing a linearly sampled frequency spectra (from DFT or STFT) into num_mel_bins frequency information based on the [lower_edge_hertz, upper_edge_hertz] range on the mel scale. /// This function defines the mel scale in terms of a frequency in hertz according to the following formula: - /// + /// /// mel(f) = 2595 * log10(1 + f/700) - /// + /// /// In the returned matrix, all the triangles (filterbanks) have a peak value of 1.0. - /// + /// /// The returned MelWeightMatrix can be used to right-multiply a spectrogram S of shape [frames, num_spectrogram_bins] of linear scale spectrum values (e.g. STFT magnitudes) to generate a "mel spectrogram" M of shape [frames, num_mel_bins]. public static Tensor MelWeightMatrix(Tensor num_mel_bins, Tensor dft_length, Tensor sample_rate, Tensor lower_edge_hertz, Tensor upper_edge_hertz, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.MelWeightMatrix.class, List.of(num_mel_bins, dft_length, sample_rate, lower_edge_hertz, upper_edge_hertz), List.of(output_datatype)); return (Tensor) result; } - - /// + + /// /// Element-wise min of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2259,12 +2259,12 @@ public static Tensor Min(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Min.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// Mish: A Self Regularized Non-Monotonic Neural Activation Function. - /// + /// /// Perform the linear unit element-wise on the input tensor X using formula: - /// + /// /// ``` /// mish(x) = x * tanh(softplus(x)) = x * tanh(ln(1 + e^{x})) /// ``` @@ -2272,14 +2272,14 @@ public static Tensor Mish(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Mish.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Performs an element-wise binary modulo operation. /// The semantics and supported data types depend on the value of the `fmod` attribute which must be `0` (default), or `1`. - /// + /// /// If the `fmod` attribute is set to `0`, `T` is constrained to integer data types and the semantics follow that of the Python `%`-operator. /// The sign of the result is that of the divisor. - /// + /// /// If `fmod` is set to `1`, the behavior of this operator follows that of the `fmod` function in C and `T` is constrained to floating point data types. /// The result of this operator is the remainder of the division operation `x / y` where `x` and `y` are respective elements of `A` and `B`. The result is exactly the value `x - n * y`, where `n` is `x / y` with its fractional part truncated. /// The returned value has the same sign as `x` (except if `x` is `-0`) and is less or equal to `|y|` in magnitude. @@ -2289,20 +2289,20 @@ public static Tensor Mish(Tensor X) { /// - If `y` is `±0` and `x` is not `NaN`, `NaN` should be returned. /// - If `y` is `±∞` and `x` is finite, `x` is returned. /// - If either argument is `NaN`, `NaN` is returned. - /// + /// /// This operator supports **multidirectional (i.e., NumPy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Mod(Tensor A, Tensor B, Optional fmod) { Object result = OnnxInterpreter.interpret(OnnxOps.Mod.class, List.of(A, B), List.of(fmod)); return (Tensor) result; } - - /// + + /// /// Compute one iteration of stochastic gradient update with momentum. /// This operator can conduct the optimization of multiple tensor variables. - /// + /// /// Let's define the behavior of this operator. As you can imagine, SG with momentum requires /// several parameters: - /// + /// /// - The learning-rate "R". /// - The update count "T". That is, the number of conducted training iterations. It should /// be zero in the first training iteration. @@ -2311,48 +2311,48 @@ public static Tensor Mod(Tensor A, Tensor B, Optional fmod) { /// - The scaling coefficient of current gradient "beta". /// - An attribute to choose either standard momentum or Nesterov's momentum "mode" should /// be used. - /// + /// /// For the sake of simplicity, assume that there is only one tensor (called "X") to be optimized. /// Other necessary inputs are "X"'s gradient (called "G") and "X"'s momentum (called "V"). This /// Momentum operator maps all these inputs to the new value of "X" (called "X_new") and its new /// momentum (called "V_new"). - /// + /// /// This operator supports two different momentum algorithms. Set the attribute "mode" to /// "nesterov" if Nesterov's momentum is desired. Otherwise, set the attribute "model" to /// "standard" to use standard momentum. Computation details are described subsequently. - /// + /// /// Let "+", "-", "*", and "/" are all element-wise operations with numpy-style broadcasting. - /// + /// /// Pseudo code for SG with standard momentum: - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||^2, where ||X|| is the sum of squared /// // values of all elements in X. /// G_regularized = norm_coefficient * X + G - /// + /// /// // In the first training iteration, beta should always be 1. /// beta_adjusted = T > 0 ? beta : 1 - /// + /// /// // Compute the current momentum based on previous momentum and the current gradient. /// V_new = alpha * V + beta_adjusted * G_regularized - /// + /// /// // Update X. /// X_new = X - R * V_new - /// + /// /// Pseudo code for SG with Nesterov's momentum: - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||^2, where ||X|| is the sum of squared /// // values of all elements in X. /// G_regularized = norm_coefficient * X + G; - /// + /// /// // In the first training iteration, beta should always be 1. /// beta_adjusted = T > 0 ? beta : 1 - /// + /// /// // Compute the current momentum based on previous momentum and the current gradient. /// V_new = alpha * V + beta_adjusted * G_regularized; - /// + /// /// // Compute final update direction and then update X. /// X_new = X - R * (G_regularized + alpha * V_new) - /// + /// /// If one assign this operators to optimize multiple inputs, for example, "X_1" and "X_2". The same /// pseudo code would be extended to handle all tensors jointly. More specifically, we can view "X" as a /// concatenation of "X_1" and "X_2" (of course, their gradient and accumulate gradient should @@ -2361,27 +2361,27 @@ public static List> Momentum(Tensor R, Tensor T, L Object result = OnnxInterpreter.interpret(OnnxOps.Momentum.class, List.of(R, T, inputs), List.of(mode, norm_coefficient, alpha, beta)); return (List>) result; } - - /// + + /// /// Performs element-wise binary multiplication (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Mul(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Mul.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Generate a tensor of samples from a multinomial distribution according to the probabilities /// of each of the possible outcomes. public static Tensor Multinomial(Tensor input, Optional seed, Optional sample_size, Optional dtype) { Object result = OnnxInterpreter.interpret(OnnxOps.Multinomial.class, List.of(input), List.of(seed, sample_size, dtype)); return (Tensor) result; } - - /// + + /// /// Neg takes one input data (Tensor) and produces one output data /// (Tensor) where each element flipped sign, y = -x, is applied to /// the tensor elementwise. @@ -2389,70 +2389,70 @@ public static Tensor Neg(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Neg.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// A NegativeLogLikelihoodLoss operator computes (weighted) negative log likelihood loss. /// Its "input" tensor has the shape of (N, C, d1, d2, ..., dk) where k >= 0. /// The "input" tensor contains log-probabilities for input[n, :, d_1, d_2,..., d_k] being in a class of [0, C). /// The operator's "target" input tensor has the shape of (N, d1, d2, ..., dk). It encodes class labels (one of C classes) /// or it may contain a special value (indicated by an attribute ignore_index) for N x d1 x d2 x ... x dk samples. /// The loss value for input[n, :, d_1, d_2,...d_k] being classified as class c = target[n][d_1][d_2]...[d_k] is computed as: - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = -input[n][c][d_1][d_2]...[d_k]. /// ``` - /// + /// /// When an optional "weight" is provided, the sample loss is calculated as: - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = -input[n][c][d_1][d_2]...[d_k] * weight[c]. /// ``` - /// + /// /// loss is zero for the case when target-value equals ignore_index. - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = 0, when target[n][d_1][d_2]...[d_k] = ignore_index /// ``` - /// + /// /// If "reduction" attribute is set to "none", the operator's output will be the above loss with shape (N, d1, d2, ..., dk). /// If "reduction" attribute is set to "mean" (the default attribute value), the output loss is (weight) averaged: - /// + /// /// ``` /// mean(loss), if "weight" is not provided, /// ``` - /// + /// /// or if weight is provided, - /// + /// /// ``` /// sum(loss) / sum(weight[target[n][d_1][d_2]...[d_k]]]), for all samples. /// ``` - /// + /// /// If "reduction" attribute is set to "sum", the output is a scalar: `sum(loss)`. - /// + /// /// See also https://pytorch.org/docs/stable/nn.html#torch.nn.NLLLoss. - /// + /// /// Example 1: - /// + /// /// ``` /// // negative log likelihood loss, "none" reduction /// N, C, d1 = 2, 3, 2 /// input = [[[1.0, 2.0], [2.0, 2.0], [3.0, 2.0]], /// [[0.0, 1.0], [2.0, 2.0], [1.0, 2]]] /// target = [[2, 1], [0, 2]] - /// + /// /// loss = np.zeros((N, d1)) /// for n in range(N): /// for d_1 in range(d1): /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] - /// + /// /// // print(loss) /// // [[-3. -2.] /// // [-0. -2.]] /// ``` - /// + /// /// Example 2: - /// + /// /// ``` /// // weighted negative log likelihood loss, sum reduction /// N, C, d1 = 2, 3, 2 @@ -2465,14 +2465,14 @@ public static Tensor Neg(Tensor X) { /// for d_1 in range(d1): /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] * weight[c] - /// + /// /// loss = np.sum(loss) /// // print(loss) /// // -1.1 /// ``` - /// + /// /// Example 3: - /// + /// /// ``` /// // weighted negative log likelihood loss, mean reduction /// N, C, d1 = 2, 3, 2 @@ -2487,7 +2487,7 @@ public static Tensor Neg(Tensor X) { /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] * weight[c] /// weight_total = weight_total + weight[c] - /// + /// /// loss = np.sum(loss) / weight_total /// // print(loss) /// // -1.57 @@ -2496,8 +2496,8 @@ public static Tensor NegativeLogLikelihoodLoss(Tensor input, Ten Object result = OnnxInterpreter.interpret(OnnxOps.NegativeLogLikelihoodLoss.class, List.of(input, target, weight), List.of(ignore_index, reduction)); return (Tensor) result; } - - /// + + /// /// Filter out boxes that have high intersection-over-union (IOU) overlap with previously selected boxes. /// Bounding boxes with score less than score_threshold are removed. Bounding box format is indicated by attribute center_point_box. /// Boxes are suppressed if their IOU with a previously selected box is strictly greater than iou_threshold (i.e., boxes with IOU exactly equal to the threshold are kept). @@ -2510,8 +2510,8 @@ public static Tensor NonMaxSuppression(Tensor boxes, Tensor Object result = OnnxInterpreter.interpret(OnnxOps.NonMaxSuppression.class, List.of(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold), List.of(center_point_box)); return (Tensor) result; } - - /// + + /// /// Returns the indices of the elements that are non-zero /// (in row-major order - by dimension). /// NonZero behaves similar to numpy.nonzero: @@ -2521,8 +2521,8 @@ public static Tensor NonZero(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.NonZero.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Normalize the input. There are three normalization modes, which have the corresponding formulas, /// defined using element-wise infix operators '/' and '^' and tensor-wide functions 'max' and 'sum':
///
@@ -2537,15 +2537,15 @@ public static Tensor Normalizer(Tensor X, Optional norm) { Object result = OnnxInterpreter.interpret(OnnxOps.Normalizer.class, List.of(X), List.of(norm)); return (Tensor) result; } - - /// + + /// /// Returns the negation of the input tensor element-wise. public static Tensor Not(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Not.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Produces a one-hot tensor based on inputs. /// The locations represented by the index values in the 'indices' input tensor will have 'on_value' /// and the other locations will have 'off_value' in the output tensor, where 'on_value' and 'off_value' @@ -2558,18 +2558,18 @@ public static Tensor Not(Tensor X) { /// as the type of the 'values' input. Any entries in the 'indices' input tensor with values outside /// the range [-depth, depth-1] will result in one-hot representation with all 'off_value' values in the /// output tensor. - /// + /// /// when axis = 0: /// output[input[i, j, k], i, j, k] = 1 for all i, j, k and 0 otherwise. - /// + /// /// when axis = -1: /// output[i, j, k, input[i, j, k]] = 1 for all i, j, k and 0 otherwise. public static Tensor OneHot(Tensor indices, Tensor depth, Tensor values, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.OneHot.class, List.of(indices, depth, values), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Replace each input element with an array of ones and zeros, where a single /// one is placed at the index of the category that was passed in. The total category count /// will determine the size of the extra dimension of the output array Y.
@@ -2582,16 +2582,16 @@ public static Tensor OneHotEncoder(Tensor X, Optional ca Object result = OnnxInterpreter.interpret(OnnxOps.OneHotEncoder.class, List.of(X), List.of(cats_strings, cats_int64s, zeros)); return (Tensor) result; } - - /// + + /// /// Constructs an optional-type value containing either an empty optional of a certain type specified by the attribute, /// or a non-empty value containing the input element. public static Optional Optional(Optional input, Optional type) { Object result = OnnxInterpreter.interpret(OnnxOps.Optional.class, List.of(input), List.of(type)); return (Optional) result; } - - /// + + /// /// If the input is a tensor or sequence type, it returns the input. /// If the input is an optional type, it outputs the element in the input. /// It is an error if the input is an empty optional-type (i.e. does not have an element) and the behavior is undefined in this case. @@ -2599,8 +2599,8 @@ public static V OptionalGetElement(O input) { Object result = OnnxInterpreter.interpret(OnnxOps.OptionalGetElement.class, List.of(input), List.of()); return (V) result; } - - /// + + /// /// Returns true if (1) the input is an optional-type and contains an element, /// or, (2) the input is a tensor or sequence type. /// If the input is not provided or is an empty optional-type, this op returns false. @@ -2608,18 +2608,18 @@ public static Tensor OptionalHasElement(Optional input) { Object result = OnnxInterpreter.interpret(OnnxOps.OptionalHasElement.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `or` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Or(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Or.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// PRelu takes input data (Tensor) and slope tensor as input, and produces one /// output data (Tensor) where the function `f(x) = slope * x for x < 0`, /// `f(x) = x for x >= 0`., is applied to the data tensor elementwise. @@ -2628,99 +2628,99 @@ public static Tensor PRelu(Tensor X, Tensor slope) { Object result = OnnxInterpreter.interpret(OnnxOps.PRelu.class, List.of(X, slope), List.of()); return (Tensor) result; } - - /// + + /// /// Given a tensor containing the data to be padded (`data`), a tensor containing the number of start and end pad values for axis (`pads`), (optionally) a `mode`, and (optionally) `constant_value`, /// a padded tensor (`output`) is generated. - /// + /// /// The four supported `modes` are (similar to corresponding modes supported by `numpy.pad`): - /// + /// /// 1) `constant`(default) - pads with a given constant value as specified by `constant_value` (which defaults to 0, empty string, or False) - /// + /// /// 2) `reflect` - pads with the reflection of the vector mirrored on the first and last values of the vector along each axis - /// + /// /// 3) `edge` - pads with the edge values of array - /// + /// /// 4) `wrap` - wrap-around padding as if the data tensor forms a torus - /// - /// + /// + /// /// Example 1 (`constant` mode): - /// + /// /// Insert 0 pads to the beginning of the second dimension. - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'constant' - /// + /// /// constant_value = 0.0 - /// + /// /// output = [ /// [0.0, 0.0, 1.0, 1.2], /// [0.0, 0.0, 2.3, 3.4], /// [0.0, 0.0, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 2 (`reflect` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'reflect' - /// + /// /// output = [ /// [1.0, 1.2, 1.0, 1.2], /// [2.3, 3.4, 2.3, 3.4], /// [4.5, 5.7, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 3 (`edge` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'edge' - /// + /// /// output = [ /// [1.0, 1.0, 1.0, 1.2], /// [2.3, 2.3, 2.3, 3.4], /// [4.5, 4.5, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 4 (`wrap` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [2, 1, 1, 1] - /// + /// /// mode = 'wrap' - /// + /// /// output = [ /// [3.4, 2.3, 3.4, 2.3], /// [5.7, 4.5, 5.7, 4.5], @@ -2734,8 +2734,8 @@ public static Tensor Pad(Tensor data, Tensor pads, Optiona Object result = OnnxInterpreter.interpret(OnnxOps.Pad.class, List.of(data, pads, constant_value, axes), List.of(mode)); return (Tensor) result; } - - /// + + /// /// Pow takes input data (Tensor) and exponent Tensor, and /// produces one output data (Tensor) where the function `f(x) = x^exponent`, /// is applied to the data tensor elementwise. @@ -2744,8 +2744,8 @@ public static Tensor Pow(Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.Pow.class, List.of(X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// The convolution operator consumes a quantized input tensor, its scale and zero point, /// a quantized filter, its scale and zero point, and output's scale and zero point, /// and computes the quantized output. Each scale and zero-point pair must have same shape. @@ -2757,8 +2757,8 @@ public static Tensor QLinearConv(Tensor x, Tensor x_ Object result = OnnxInterpreter.interpret(OnnxOps.QLinearConv.class, List.of(x, x_scale, x_zero_point, w, w_scale, w_zero_point, y_scale, y_zero_point, B), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); return (Tensor) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). /// It consumes two quantized input tensors, their scales and zero points, scale and zero point of output, /// and computes the quantized output. The quantization formula is y = saturate((x / y_scale) + y_zero_point). @@ -2774,12 +2774,12 @@ public static Tensor QLinearMatMul(Tensor a, Tensor Object result = OnnxInterpreter.interpret(OnnxOps.QLinearMatMul.class, List.of(a, a_scale, a_zero_point, b, b_scale, b_zero_point, y_scale, y_zero_point), List.of()); return (Tensor) result; } - - /// + + /// /// The linear quantization operator consumes a high-precision tensor, a scale, and a zero point to compute the /// low-precision/quantized tensor. The scale factor and zero point must have the same shape, determining the quantization /// granularity. The quantization formula is `y = saturate((x / y_scale) + y_zero_point)`. - /// + /// /// Saturation is done according to: /// - uint16: [0, 65535] /// - int16: [-32768, 32767] @@ -2789,14 +2789,14 @@ public static Tensor QLinearMatMul(Tensor a, Tensor /// - int4: [-8, 7] /// - uint2: [0, 3] /// - int2: [-2, 1] - /// + /// /// For `(x / y_scale)`, it rounds to the nearest even. Refer to https://en.wikipedia.org/wiki/Rounding for details. - /// + /// /// `y_zero_point` and `y` must have the same type. `y_zero_point` is usually not used for quantization to float8 and 4bit types, but the quantization /// formula remains the same for consistency, and the type of the attribute `y_zero_point` still determines the quantization type. /// `x` and `y_scale` are allowed to have different types. The type of `y_scale` determines the precision of the division operation between `x` and /// `y_scale`, unless the `precision` attribute is specified. - /// + /// /// There are three supported quantization granularities, determined by the shape of `y_scale`. /// In all cases, `y_zero_point` must have the same shape as `y_scale`. /// - Per-tensor (per-layer) quantization: `y_scale` is a scalar. @@ -2809,8 +2809,8 @@ public static Tensor QuantizeLinear(Tensor x, Tensor y_ Object result = OnnxInterpreter.interpret(OnnxOps.QuantizeLinear.class, List.of(x, y_scale, y_zero_point), List.of(output_dtype, saturate, precision, axis, block_size)); return (Tensor) result; } - - /// + + /// /// This is RMS normalization defined in ONNX as function as described in the paper https://arxiv.org/pdf/1910.07467. /// The overall computation can be split into two stages. The root mean squared norm is taken over the last D dimensions, /// where D is the dimension of normalized_shape. For example, if normalized_shape is (3, 5) (a 2-dimensional shape), @@ -2843,14 +2843,14 @@ public static Tensor RMSNormalization(Tensor X, Tensor scale, Op Object result = OnnxInterpreter.interpret(OnnxOps.RMSNormalization.class, List.of(X, scale), List.of(epsilon, stash_type, axis)); return (Tensor) result; } - + public record RNNResult(Tensor Y, Tensor Y_h) { } - /// + /// /// Computes an one-layer simple RNN. This operator is usually supported /// via some custom implementation such as CuDNN. - /// + /// /// Notations: - /// + /// /// * `X` - input tensor /// * `i` - input gate /// * `t` - time step (t-1 means previous time step) @@ -2864,15 +2864,15 @@ public record RNNResult(Tensor Y, Tensor Y_h) { } /// * `RBbi` - RR bias vectors for backward input gate /// * `H` - Hidden state /// * `num_directions` - 2 if direction == bidirectional else 1 - /// + /// /// Activation functions: - /// + /// /// * Relu(x) - max(0, x) /// * Tanh(x) - (1 - e^{-2x})/(1 + e^{-2x}) /// * Sigmoid(x) - 1/(1 + e^{-x}) - /// + /// /// NOTE: Below are optional - /// + /// /// * Affine(x) - alpha*x + beta /// * LeakyRelu(x) - x if x >= 0 else alpha * x /// * ThresholdedRelu(x) - x if x >= alpha else 0 @@ -2881,9 +2881,9 @@ public record RNNResult(Tensor Y, Tensor Y_h) { } /// * Elu(x) - x if x >= 0 else alpha*(e^x - 1) /// * Softsign(x) - x/(1 + |x|) /// * Softplus(x) - log(1 + e^x) - /// + /// /// Equations (Default: f=Tanh): - /// + /// /// * Ht = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Wbi + Rbi) /// This operator has **optional** inputs/outputs. See [the doc](IR.md) for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted. public static RNNResult RNN(Tensor X, Tensor W, Tensor R, Optional> B, Optional> sequence_lens, Optional> initial_h, Optional layout, Optional activation_alpha, Optional hidden_size, Optional activation_beta, Optional activations, Optional clip, Optional direction) { @@ -2891,12 +2891,12 @@ public static RNNResult RNN(Tensor X, Tensor W, Tensor R, Option Object[] resultArray = (Object[]) result; return new RNNResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Generate a tensor with random values drawn from a normal distribution. The shape /// of the tensor is specified by the `shape` argument and the parameter of the normal distribution /// specified by `mean` and `scale`. - /// + /// /// The data type is specified by the 'dtype' argument. The 'dtype' argument must /// be one of the data types specified in the 'DataType' enum field in the /// TensorProto message. @@ -2904,12 +2904,12 @@ public static Tensor RandomNormal(long[] shape, Optional seed, Opt Object result = OnnxInterpreter.interpret(OnnxOps.RandomNormal.class, List.of(), List.of(shape, seed, mean, scale, dtype)); return (Tensor) result; } - - /// + + /// /// Generate a tensor with random values drawn from a normal distribution. /// The shape of the output tensor is copied from the shape of the input tensor, /// and the parameters of the normal distribution are specified by `mean` and `scale`. - /// + /// /// The data type is specified by the 'dtype' argument, or copied from the input tensor if not provided. /// The 'dtype' argument must be one of the data types specified in the 'DataType' enum field in the /// TensorProto message, and be valid as an output type. @@ -2917,11 +2917,11 @@ public static Tensor RandomNormalLike(Tensor input, Optional) result; } - - /// + + /// /// Generate a tensor with random values drawn from a uniform distribution. The shape /// of the tensor is specified by the `shape` argument and the range by `low` and `high`. - /// + /// /// The data type is specified by the 'dtype' argument. The 'dtype' argument must /// be one of the data types specified in the 'DataType' enum field in the /// TensorProto message. @@ -2929,12 +2929,12 @@ public static Tensor RandomUniform(Optional high, long[] shape, Op Object result = OnnxInterpreter.interpret(OnnxOps.RandomUniform.class, List.of(), List.of(high, shape, seed, low, dtype)); return (Tensor) result; } - - /// + + /// /// Generate a tensor with random values drawn from a uniform distribution. /// The shape of the output tensor is copied from the shape of the input tensor, /// and the parameters of the uniform distribution are specified by `low` and `high`. - /// + /// /// The data type is specified by the 'dtype' argument, or copied from the input tensor if not provided. /// The 'dtype' argument must be one of the data types specified in the 'DataType' enum field in the /// TensorProto message and be valid as an output type. @@ -2942,11 +2942,11 @@ public static Tensor RandomUniformLike(Tensor input, Optional) result; } - - /// + + /// /// Generate a tensor containing a sequence of numbers that begin at `start` and extends by increments of `delta` /// up to `limit` (exclusive). - /// + /// /// The number of elements in the output of range is computed as below: /// ``` /// number_of_elements = max( ceil( (limit - start) / delta ) , 0 ) @@ -2967,7 +2967,7 @@ public static Tensor RandomUniformLike(Tensor input, Optional Tensor Range(Tensor start, Tensor limit, Tensor de Object result = OnnxInterpreter.interpret(OnnxOps.Range.class, List.of(start, limit, delta), List.of(stash_type)); return (Tensor) result; } - - /// + + /// /// Reciprocal takes one input data (Tensor) and produces one output data /// (Tensor) where the reciprocal is, y = 1/x, is applied to /// the tensor elementwise. @@ -2986,158 +2986,158 @@ public static Tensor Reciprocal(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Reciprocal.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Computes the L1 norm of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceL1(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceL1.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the L2 norm of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceL2(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceL2.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the log sum of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or undefined otherwise. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceLogSum(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceLogSum.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the log sum exponent of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or undefined otherwise. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceLogSumExp(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceLogSumExp.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the max of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or the minimum value of the data type otherwise. - /// - /// + /// + /// /// If the input data type is Boolean, the comparison should consider `False < True`. - /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMax(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMax.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the mean of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields undefined. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMean(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMean.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the min of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields plus infinity (if supported by the datatype) or the maximum value of the data type otherwise. - /// - /// + /// + /// /// If the input data type is Boolean, the comparison should consider `False < True`. - /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMin(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMin.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the product of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 1. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceProd(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceProd.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the sum of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceSum(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceSum.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the sum square of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceSumSquare(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceSumSquare.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - + /// RegexFullMatch performs a full regex match on each element of the input tensor. If an element fully matches the regex pattern specified as an attribute, the corresponding element in the output is True and it is False otherwise. [RE2](https://github.com/google/re2/wiki/Syntax) regex syntax is used. public static Tensor RegexFullMatch(Tensor X, Optional pattern) { Object result = OnnxInterpreter.interpret(OnnxOps.RegexFullMatch.class, List.of(X), List.of(pattern)); return (Tensor) result; } - - /// + + /// /// Relu takes one input data (Tensor) and produces one output data /// (Tensor) where the rectified linear function, y = max(0, x), is applied to /// the tensor elementwise. @@ -3145,8 +3145,8 @@ public static Tensor Relu(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Relu.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Reshape the input tensor similar to numpy.reshape. /// First input is the data tensor, second input is a shape tensor which specifies the output shape. It outputs the reshaped tensor. /// At most one dimension of the new shape can be -1. In this case, the value is @@ -3156,7 +3156,7 @@ public static Tensor Relu(Tensor X) { /// dimension will be set explicitly to zero (i.e. not taken from input tensor). /// Shape (second input) could be an empty shape, which means converting to a scalar. /// The input tensor's shape and the output tensor's shape are required to have the same number of elements. - /// + /// /// If the attribute 'allowzero' is set, it is invalid for the specified shape to /// contain both a zero value and -1, as the value of the dimension corresponding /// to -1 cannot be determined uniquely. @@ -3164,8 +3164,8 @@ public static Tensor Reshape(Tensor data, Tensor shape, Optional Object result = OnnxInterpreter.interpret(OnnxOps.Reshape.class, List.of(data, shape), List.of(allowzero)); return (Tensor) result; } - - /// + + /// /// Resize the input tensor. In general, it calculates every value in the output tensor as a weighted average of neighborhood (a.k.a. sampling locations) in the input tensor. /// Each dimension value of the output tensor is: /// ``` @@ -3176,14 +3176,14 @@ public static Tensor Resize(Tensor X, Optional> roi, Object result = OnnxInterpreter.interpret(OnnxOps.Resize.class, List.of(X, roi, scales, sizes), List.of(mode, extrapolation_value, nearest_mode, antialias, cubic_coeff_a, axes, coordinate_transformation_mode, keep_aspect_ratio_policy, exclude_outside)); return (Tensor) result; } - - /// + + /// /// Reverse batch of sequences having different lengths specified by `sequence_lens`. - /// + /// /// For each slice i iterating on batch axis, the operator reverses the first sequence_lens[i] elements on time axis, /// and copies elements whose index's beyond sequence_lens[i] to the output. So the output slice i contains reversed /// sequences on the first sequence_lens[i] elements, then have original values copied for the other elements. - /// + /// /// Example 1: /// input = [[0.0, 4.0, 8.0, 12.0], /// [1.0, 5.0, 9.0, 13.0], @@ -3192,12 +3192,12 @@ public static Tensor Resize(Tensor X, Optional> roi, /// sequence_lens = [4, 3, 2, 1] /// time_axis = 0 /// batch_axis = 1 - /// + /// /// output = [[3.0, 6.0, 9.0, 12.0], /// [2.0, 5.0, 8.0, 13.0], /// [1.0, 4.0, 10.0, 14.0], /// [0.0, 7.0, 11.0, 15.0]] - /// + /// /// Example 2: /// input = [[0.0, 1.0, 2.0, 3.0 ], /// [4.0, 5.0, 6.0, 7.0 ], @@ -3206,7 +3206,7 @@ public static Tensor Resize(Tensor X, Optional> roi, /// sequence_lens = [1, 2, 3, 4] /// time_axis = 1 /// batch_axis = 0 - /// + /// /// output = [[0.0, 1.0, 2.0, 3.0 ], /// [5.0, 4.0, 6.0, 7.0 ], /// [10.0, 9.0, 8.0, 11.0], @@ -3215,14 +3215,14 @@ public static Tensor ReverseSequence(Tensor input, Tensor sequen Object result = OnnxInterpreter.interpret(OnnxOps.ReverseSequence.class, List.of(input, sequence_lens), List.of(time_axis, batch_axis)); return (Tensor) result; } - - /// + + /// /// Region of Interest (RoI) align operation described in the /// [Mask R-CNN paper](https://arxiv.org/abs/1703.06870). /// RoiAlign consumes an input tensor X and region of interests (rois) /// to apply pooling across each RoI; it produces a 4-D tensor of shape /// (num_rois, C, output_height, output_width). - /// + /// /// RoiAlign is proposed to avoid the misalignment by removing /// quantizations while converting from original image into feature /// map and from feature map into RoI feature; in each ROI bin, @@ -3232,21 +3232,21 @@ public static Tensor RoiAlign(Tensor X, Tensor rois, Tensor) result; } - - /// + + /// /// RotaryEmbedding is the implementation of rotary positional embeddings (RoPE) based on the paper https://arxiv.org/pdf/2104.09864. /// The key advantage of RoPE is that it allows the model to understand both the absolute position of a token and the relative distances /// between tokens. This is achieved through a rotational mechanism where the extent of rotation is computed based on the token's absolute position (position_ids). - /// + /// /// The rotational mechanism is defined by sine and cosine functions that are used to represent the rotation angles. /// For each token in the sequence, its positional embedding is computed by rotating its embedding vector. This is done by splitting the /// embedding vector either into two halves or interleaving every alternate token and applying the rotation matrix to each half of the embedding vector. /// The rotation matrix is parameterized by the token's position in the sequence. The rotated halves of the embedding vector are concatenated /// to form the final positional embedding for each token. The rotated positional embeddings are used in the self-attention mechanism. /// The rotation ensures that the model captures both absolute and relative positional information. - /// + /// /// Rotary embeddings are defined using the following algorithm: - /// + /// /// ```python /// def rotary_embedding( /// input: np.ndarray, @@ -3271,7 +3271,7 @@ public static Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RotaryEmbedding(Tensor X, Tensor cos_cache, Te Object result = OnnxInterpreter.interpret(OnnxOps.RotaryEmbedding.class, List.of(X, cos_cache, sin_cache, position_ids), List.of(num_heads, rotary_embedding_dim, interleaved)); return (Tensor) result; } - - /// + + /// /// Round takes one input Tensor and rounds the values, element-wise, meaning /// it finds the nearest integer for each value. /// In case of halves, the rule is to round them to the nearest even integer. /// If input x is integral, +0, -0, NaN, or infinite, x itself is returned. /// The output tensor has the same shape and type as the input. - /// + /// /// Examples: /// ``` /// round([0.9]) = [1.0] @@ -3358,61 +3358,61 @@ public static Tensor Round(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Round.class, List.of(X), List.of()); return (Tensor) result; } - + /// Computes the Short-time Fourier Transform of the signal. public static Tensor STFT(Tensor signal, Tensor frame_step, Optional> window, Optional> frame_length, Optional onesided) { Object result = OnnxInterpreter.interpret(OnnxOps.STFT.class, List.of(signal, frame_step, window, frame_length), List.of(onesided)); return (Tensor) result; } - + public record SVMClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// Support Vector Machine classifier public static SVMClassifierResult SVMClassifier(Tensor X, Optional prob_b, Optional kernel_params, Optional kernel_type, Optional classlabels_ints, Optional post_transform, Optional rho, Optional coefficients, Optional support_vectors, Optional vectors_per_class, Optional prob_a, Optional classlabels_strings) { Object result = OnnxInterpreter.interpret(OnnxOps.SVMClassifier.class, List.of(X), List.of(prob_b, kernel_params, kernel_type, classlabels_ints, post_transform, rho, coefficients, support_vectors, vectors_per_class, prob_a, classlabels_strings)); Object[] resultArray = (Object[]) result; return new SVMClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Support Vector Machine regression prediction and one-class SVM anomaly detection. public static Tensor SVMRegressor(Tensor X, Optional kernel_type, Optional kernel_params, Optional n_supports, Optional rho, Optional post_transform, Optional coefficients, Optional support_vectors, Optional one_class) { Object result = OnnxInterpreter.interpret(OnnxOps.SVMRegressor.class, List.of(X), List.of(kernel_type, kernel_params, n_supports, rho, post_transform, coefficients, support_vectors, one_class)); return (Tensor) result; } - - /// + + /// /// Rescale input data, for example to standardize features by removing the mean and scaling to unit variance. public static Tensor Scaler(Tensor X, Optional offset, Optional scale) { Object result = OnnxInterpreter.interpret(OnnxOps.Scaler.class, List.of(X), List.of(offset, scale)); return (Tensor) result; } - - /// + + /// /// This operator is deprecated. Please use ScatterElements, which provides the same functionality. - /// + /// /// Scatter takes three inputs `data`, `updates`, and `indices` of the same /// rank r >= 1 and an optional attribute axis that identifies an axis of `data` /// (by default, the outer-most axis, that is axis 0). The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value /// to values specified by `updates` at specific index positions specified by /// `indices`. Its output shape is the same as the shape of `data`. - /// + /// /// For each entry in `updates`, the target index in `data` is obtained by combining /// the corresponding entry in `indices` with the index of the entry itself: the /// index-value for dimension = axis is obtained from the value of the corresponding /// entry in `indices` and the index-value for dimension != axis is obtained from the /// index of the entry itself. - /// + /// /// For instance, in a 2-D tensor case, the update corresponding to the [i][j] entry /// is performed as below: /// ``` /// output[indices[i][j]][j] = updates[i][j] if axis = 0, /// output[i][indices[i][j]] = updates[i][j] if axis = 1, /// ``` - /// + /// /// This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation. - /// + /// /// Example 1: /// ``` /// data = [ @@ -3446,21 +3446,21 @@ public static Tensor Scatter(Tensor data, Tensor indices, Object result = OnnxInterpreter.interpret(OnnxOps.Scatter.class, List.of(data, indices, updates), List.of(axis)); return (Tensor) result; } - - /// + + /// /// ScatterElements takes three inputs `data`, `updates`, and `indices` of the same /// rank r >= 1 and an optional attribute axis that identifies an axis of `data` /// (by default, the outer-most axis, that is axis 0). The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value /// to values specified by `updates` at specific index positions specified by /// `indices`. Its output shape is the same as the shape of `data`. - /// + /// /// For each entry in `updates`, the target index in `data` is obtained by combining /// the corresponding entry in `indices` with the index of the entry itself: the /// index-value for dimension = axis is obtained from the value of the corresponding /// entry in `indices` and the index-value for dimension != axis is obtained from the /// index of the entry itself. - /// + /// /// `reduction` allows specification of an optional reduction operation, which is applied to all values in `updates` /// tensor into `output` at the specified `indices`. /// In cases where `reduction` is set to "none", indices should not have duplicate entries: that is, if idx1 != idx2, @@ -3476,11 +3476,11 @@ public static Tensor Scatter(Tensor data, Tensor indices, /// output[i][indices[i][j]] = f(output[i][indices[i][j]], updates[i][j]) if axis = 1, /// ``` /// where the `f` is `+`, `*`, `max` or `min` as specified. - /// + /// /// This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation. - /// + /// /// (Opset 18 change): Adds max/min to the set of allowed reduction ops. - /// + /// /// Example 1: /// ``` /// data = [ @@ -3514,21 +3514,21 @@ public static Tensor ScatterElements(Tensor data, Tensor i Object result = OnnxInterpreter.interpret(OnnxOps.ScatterElements.class, List.of(data, indices, updates), List.of(reduction, axis)); return (Tensor) result; } - - /// + + /// /// ScatterND takes three inputs `data` tensor of rank r >= 1, `indices` tensor of rank q >= 1, /// and `updates` tensor of rank q + r - indices.shape[-1] - 1. The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value to values /// specified by `updates` at specific index positions specified by `indices`. Its output shape /// is the same as the shape of `data`. - /// + /// /// `indices` is an integer tensor. Let k denote indices.shape[-1], the last dimension in the shape of `indices`. /// `indices` is treated as a (q-1)-dimensional tensor of k-tuples, where each k-tuple is a partial-index into `data`. /// Hence, k can be a value at most the rank of `data`. When k equals rank(data), each update entry specifies an /// update to a single element of the tensor. When k is less than rank(data) each update entry specifies an /// update to a slice of the tensor. Index values are allowed to be negative, as per the usual /// convention for counting backwards from the end, but are expected in the valid range. - /// + /// /// `updates` is treated as a (q-1)-dimensional tensor of replacement-slice-values. Thus, the /// first (q-1) dimensions of updates.shape must match the first (q-1) dimensions of indices.shape. /// The remaining dimensions of `updates` correspond to the dimensions of the @@ -3536,39 +3536,39 @@ public static Tensor ScatterElements(Tensor data, Tensor i /// corresponding to the trailing (r-k) dimensions of `data`. Thus, the shape of `updates` /// must equal indices.shape[0:q-1] ++ data.shape[k:r-1], where ++ denotes the concatenation /// of shapes. - /// + /// /// The `output` is calculated via the following equation: - /// + /// /// ``` /// output = np.copy(data) /// update_indices = indices.shape[:-1] /// for idx in np.ndindex(update_indices): /// output[tuple(indices[idx])] = updates[idx] /// ``` - /// + /// /// The order of iteration in the above loop is not specified. /// In particular, indices should not have duplicate entries: that is, if idx1 != idx2, then indices[idx1] != indices[idx2]. /// This ensures that the output value does not depend on the iteration order. - /// + /// /// `reduction` allows specification of an optional reduction operation, which is applied to all values in `updates` /// tensor into `output` at the specified `indices`. /// In cases where `reduction` is set to "none", indices should not have duplicate entries: that is, if idx1 != idx2, /// then indices[idx1] != indices[idx2]. This ensures that the output value does not depend on the iteration order. /// When `reduction` is set to some reduction function `f`, `output` is calculated as follows: - /// + /// /// ``` /// output = np.copy(data) /// update_indices = indices.shape[:-1] /// for idx in np.ndindex(update_indices): /// output[tuple(indices[idx])] = f(output[tuple(indices[idx])], updates[idx]) /// ``` - /// + /// /// where the `f` is `+`, `*`, `max` or `min` as specified. - /// + /// /// This operator is the inverse of GatherND. - /// + /// /// (Opset 18 change): Adds max/min to the set of allowed reduction ops. - /// + /// /// Example 1: /// ``` /// data = [1, 2, 3, 4, 5, 6, 7, 8] @@ -3576,7 +3576,7 @@ public static Tensor ScatterElements(Tensor data, Tensor i /// updates = [9, 10, 11, 12] /// output = [1, 11, 3, 10, 9, 6, 7, 12] /// ``` - /// + /// /// Example 2: /// ``` /// data = [[[1, 2, 3, 4], [5, 6, 7, 8], [8, 7, 6, 5], [4, 3, 2, 1]], @@ -3595,8 +3595,8 @@ public static Tensor ScatterND(Tensor data, Tensor indices, Tens Object result = OnnxInterpreter.interpret(OnnxOps.ScatterND.class, List.of(data, indices, updates), List.of(reduction)); return (Tensor) result; } - - /// + + /// /// Selu takes one input data (Tensor) and produces one output data /// (Tensor) where the scaled exponential linear unit function, /// `y = gamma * (alpha * e^x - alpha) for x <= 0`, `y = gamma * x for x > 0`, @@ -3605,8 +3605,8 @@ public static Tensor Selu(Tensor X, Optional alpha, Optional) result; } - - /// + + /// /// Outputs a tensor copy from the tensor at 'position' in 'input_sequence'. /// Accepted range for 'position' is in `[-n, n - 1]`, where `n` is the number of tensors in 'input_sequence'. /// Negative value means counting positions from the back. @@ -3614,23 +3614,23 @@ public static Tensor SequenceAt(List> input_sequence, Ten Object result = OnnxInterpreter.interpret(OnnxOps.SequenceAt.class, List.of(input_sequence, position), List.of()); return (Tensor) result; } - - /// + + /// /// Construct a tensor sequence containing 'inputs' tensors. /// All tensors in 'inputs' must have the same data type. public static List> SequenceConstruct(List> inputs) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceConstruct.class, List.of(inputs), List.of()); return (List>) result; } - - /// + + /// /// Construct an empty tensor sequence, with given data type. public static List> SequenceEmpty(Optional dtype) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceEmpty.class, List.of(), List.of(dtype)); return (List>) result; } - - /// + + /// /// Outputs a tensor sequence that removes the tensor at 'position' from 'input_sequence'. /// Accepted range for 'position' is in `[-n, n - 1]`, where `n` is the number of tensors in 'input_sequence'. /// Negative value means counting positions from the back. @@ -3639,8 +3639,8 @@ public static List> SequenceErase(List> input_sequenc Object result = OnnxInterpreter.interpret(OnnxOps.SequenceErase.class, List.of(input_sequence, position), List.of()); return (List>) result; } - - /// + + /// /// Outputs a tensor sequence that inserts 'tensor' into 'input_sequence' at 'position'. /// 'tensor' must have the same data type as 'input_sequence'. /// Accepted range for 'position' is in `[-n, n]`, where `n` is the number of tensors in 'input_sequence'. @@ -3650,15 +3650,15 @@ public static List> SequenceInsert(List> input_seq Object result = OnnxInterpreter.interpret(OnnxOps.SequenceInsert.class, List.of(input_sequence, tensor, position), List.of()); return (List>) result; } - - /// + + /// /// Produces a scalar(tensor of empty shape) containing the number of tensors in 'input_sequence'. public static Tensor SequenceLength(List> input_sequence) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceLength.class, List.of(input_sequence), List.of()); return (Tensor) result; } - - /// + + /// /// Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor. /// Optional attributes start and end can be used to compute a slice of the input tensor's shape. /// If start axis is omitted, the slice starts from axis 0. @@ -3670,27 +3670,27 @@ public static Tensor SequenceLength(List> input_sequence) { /// negative axis). Thus, specifying any end value > r is equivalent to specifying an end /// value of r, and specifying any start value < -r is equivalent to specifying a start /// value of 0. If start > end, the result will be an empty shape. - /// + /// /// Examples: - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// No attributes specified. /// Output: [2, 3, 4] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// start: -1 /// Output: [4] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// end: -1 /// Output: [2, 3] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// start: 1 @@ -3701,8 +3701,8 @@ public static Tensor Shape(Tensor data, Optional start, Optio Object result = OnnxInterpreter.interpret(OnnxOps.Shape.class, List.of(data), List.of(start, end)); return (Tensor) result; } - - /// + + /// /// Shrink takes one input data (Tensor) and produces one Tensor output, /// having same datatype and shape with input. It has two attributes, lambd and /// bias. The formula of this operator is: If x < -lambd, y = x + bias; @@ -3711,8 +3711,8 @@ public static Tensor Shrink(Tensor input, Optional lambd, Optio Object result = OnnxInterpreter.interpret(OnnxOps.Shrink.class, List.of(input), List.of(lambd, bias)); return (Tensor) result; } - - /// + + /// /// Sigmoid takes one input data (Tensor) and produces one output data /// (Tensor) where the sigmoid function, y = 1 / (1 + exp(-x)), is applied to the /// tensor elementwise. @@ -3720,72 +3720,72 @@ public static Tensor Sigmoid(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Sigmoid.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Calculate the sign of the given input tensor element-wise. /// If input > 0, output 1. if input < 0, output -1. if input == 0, output 0. public static Tensor Sign(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sign.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the sine of the given input tensor, element-wise. public static Tensor Sin(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sin.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic sine of the given input tensor element-wise. public static Tensor Sinh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sinh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Takes a tensor as input and outputs a int64 scalar that equals to the total number of elements of the input tensor. public static Tensor Size(Tensor data) { Object result = OnnxInterpreter.interpret(OnnxOps.Size.class, List.of(data), List.of()); return (Tensor) result; } - - /// + + /// /// Produces a slice of the input tensor along multiple axes. Similar to numpy: /// https://numpy.org/doc/stable/user/basics.indexing.html?highlight=slice#slicing-and-striding - /// + /// /// Slice uses the `starts`, `ends`, `axes` and `steps` inputs to select a sub-tensor /// of its input `data` tensor. - /// + /// /// An effective `starts[i]`, `ends[i]`, and `steps[i]` must be computed for each `i` /// in `[0, ... r-1]` where `r = rank(input)` as follows: - /// + /// /// If `axes` are omitted, they are set to `[0, ..., r-1]`. /// If `steps` are omitted, they are set to `[1, ..., 1]` of length `len(starts)` - /// + /// /// The effective values are initialized as `start[i] = 0`, `ends[i] = dims[i]` where /// `dims` are the dimensions of `input` and `steps[i] = 1`. - /// + /// /// All negative elements of `axes` are made non-negative by adding `r` to them, where /// `r =rank(input)`. - /// + /// /// All negative values in `starts[i]` and `ends[i]` have `dims[axes[i]]` added to them, /// where `dims` are the dimensions of `input`. Then `start[axes[i]]` is the adjusted /// `starts[i]` is clamped into the range `[0, dims[axes[i]]]` for positive stepping /// and `[0, dims[axes[i]]-1]` for negative stepping. - /// + /// /// The clamping for the adjusted `ends[i]` depends on the sign of `steps[i]` and must /// accommodate copying 0 through `dims[axes[i]]` elements, so for positive stepping /// `ends[axes[i]]` is clamped to `[0, dims[axes[i]]]`, while for negative stepping it /// is clamped to `[-1, dims[axes[i]]-1]`. - /// + /// /// Finally, `steps[axes[i]] = steps[i]`. - /// + /// /// For slicing to the end of a dimension with unknown size, it is recommended to pass /// in `INT_MAX` when slicing forward and 'INT_MIN' when slicing backward. - /// + /// /// Example 1: - /// + /// /// ``` /// data = [ /// [1, 2, 3, 4], @@ -3799,9 +3799,9 @@ public static Tensor Size(Tensor data) { /// [5, 7], /// ] /// ``` - /// + /// /// Example 2: - /// + /// /// ``` /// data = [ /// [1, 2, 3, 4], @@ -3817,12 +3817,12 @@ public static Tensor Slice(Tensor data, Tensor starts, Ten Object result = OnnxInterpreter.interpret(OnnxOps.Slice.class, List.of(data, starts, ends, axes, steps), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the normalized exponential values for the given input: - /// - /// Softmax(input, axis) = Exp(input) / ReduceSum(Exp(input), axis=axis, keepdims=1) - /// + /// + /// Softmax(input, axis) = Exp(input) / ReduceSum(Exp(input), axis=axis, keepdims=1) + /// /// The "axis" attribute indicates the dimension along which Softmax /// will be performed. The output tensor has the same shape /// and contains the Softmax values of the corresponding input. @@ -3830,7 +3830,7 @@ public static Tensor Softmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Softmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - + public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_prob) { } /// Loss function that measures the softmax cross entropy /// between 'scores' and 'labels'. @@ -3839,12 +3839,12 @@ public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_p /// If the input is N-D tensor with shape (N, C, D1, D2, ..., Dk), /// the loss tensor L may have (N, D1, D2, ..., Dk) as its shape and L[i,][j_1][j_2]...[j_k] denotes a scalar element in L. /// After L is available, this operator can optionally do a reduction operator. - /// + /// /// * shape(scores): (N, C) where C is the number of classes, or (N, C, D1, D2,..., Dk), /// with K >= 1 in case of K-dimensional loss. /// * shape(labels): (N) where each value is 0 <= labels[i] <= C-1, or (N, D1, D2,..., Dk), /// with K >= 1 in case of K-dimensional loss. - /// + /// /// The loss for one sample, l_i, can calculated as follows: /// ``` /// l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk], where i is the index of classes. @@ -3853,21 +3853,21 @@ public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_p /// ``` /// l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk] * weights[c], if 'weights' is provided. /// ``` - /// + /// /// loss is zero for the case when label-value equals ignore_index. /// ``` /// l[i][d1][d2]...[dk] = 0, when labels[n][d1][d2]...[dk] = ignore_index /// ``` - /// + /// /// where: /// ``` /// p = Softmax(scores) /// y = Log(p) /// c = labels[i][d1][d2]...[dk] /// ``` - /// + /// /// Finally, L is optionally reduced: - /// + /// /// * If reduction = 'none', the output is L with shape (N, D1, D2, ..., Dk). /// * If reduction = 'sum', the output is scalar: Sum(L). /// * If reduction = 'mean', the output is scalar: ReduceMean(L), or if weight is provided: `ReduceSum(L) / ReduceSum(W)`, @@ -3877,8 +3877,8 @@ public static SoftmaxCrossEntropyLossResult SoftmaxCrossEntropyLoss Object[] resultArray = (Object[]) result; return new SoftmaxCrossEntropyLossResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Softplus takes one input data (Tensor) and produces one output data /// (Tensor) where the softplus function, y = ln(exp(x) + 1), is applied to /// the tensor elementwise. @@ -3886,14 +3886,14 @@ public static Tensor Softplus(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Softplus.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the softsign (x/(1+|x|)) of the given input tensor element-wise. public static Tensor Softsign(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Softsign.class, List.of(input), List.of()); return (Tensor) result; } - + /// SpaceToDepth rearranges blocks of spatial data into depth. More specifically, /// this op outputs a copy of the input tensor where values from the height and width dimensions /// are moved to the depth dimension. @@ -3901,7 +3901,7 @@ public static Tensor SpaceToDepth(Tensor input, long blocksize) { Object result = OnnxInterpreter.interpret(OnnxOps.SpaceToDepth.class, List.of(input), List.of(blocksize)); return (Tensor) result; } - + /// Split a tensor into a list of tensors, along the specified 'axis'. /// Either input 'split' or the attribute 'num_outputs' should be specified, but not both. /// If the attribute 'num_outputs' is specified, then the tensor is split into equal sized parts. @@ -3911,8 +3911,8 @@ public static List> Split(Tensor input, Optional> Object result = OnnxInterpreter.interpret(OnnxOps.Split.class, List.of(input, split), List.of(num_outputs, axis)); return (List>) result; } - - /// + + /// /// Split a tensor into a sequence of tensors, along the specified 'axis'. /// Lengths of the parts can be specified using the optional argument 'split'. /// If the argument `split' is not specified, a default scalar value of 1 @@ -3929,8 +3929,8 @@ public static List> SplitToSequence(Tensor input, Optiona Object result = OnnxInterpreter.interpret(OnnxOps.SplitToSequence.class, List.of(input, split), List.of(keepdims, axis)); return (List>) result; } - - /// + + /// /// Square root takes one input data (Tensor) and produces one output data /// (Tensor) where the square root is, y = x^0.5, is applied to /// the tensor elementwise. If x is negative, then it will return NaN. @@ -3938,8 +3938,8 @@ public static Tensor Sqrt(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Sqrt.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Remove single-dimensional entries from the shape of a tensor. /// Takes an input `axes` with a list of axes to squeeze. /// If `axes` is not provided, all the single dimensions will be removed from @@ -3948,14 +3948,14 @@ public static Tensor Squeeze(Tensor data, Optional> axes) Object result = OnnxInterpreter.interpret(OnnxOps.Squeeze.class, List.of(data, axes), List.of()); return (Tensor) result; } - + /// StringConcat concatenates string tensors elementwise (with NumPy-style broadcasting support) public static Tensor StringConcat(Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.StringConcat.class, List.of(X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// StringNormalization performs string operations for basic cleaning. /// This operator has only one input (denoted by X) and only one output /// (denoted by Y). This operator first examines the elements in the X, @@ -3969,31 +3969,31 @@ public static Tensor StringNormalizer(Tensor X, Optional i Object result = OnnxInterpreter.interpret(OnnxOps.StringNormalizer.class, List.of(X), List.of(is_case_sensitive, locale, stopwords, case_change_action)); return (Tensor) result; } - + public record StringSplitResult(Tensor Y, Tensor Z) { } /// StringSplit splits a string tensor's elements into substrings based on a delimiter attribute and a maxsplit attribute. - /// + /// /// The first output of this operator is a tensor of strings representing the substrings from splitting each input string on the `delimiter` substring. This tensor has one additional rank compared to the input tensor in order to store the substrings for each input element (where the input tensor is not empty). Note that, in order to ensure the same number of elements are present in the final dimension, this tensor will pad empty strings as illustrated in the examples below. Consecutive delimiters are not grouped together and are deemed to delimit empty strings, except if the `delimiter` is unspecified or is the empty string (""). In the case where the `delimiter` is unspecified or the empty string, consecutive whitespace characters are regarded as a single separator and leading or trailing whitespace is removed in the output. - /// + /// /// The second output tensor represents the number of substrings generated. `maxsplit` can be used to limit the number of splits performed - after the `maxsplit`th split if the string is not fully split, the trailing suffix of input string after the final split point is also added. For elements where fewer splits are possible than specified in `maxsplit`, it has no effect. public static StringSplitResult StringSplit(Tensor X, Optional delimiter, Optional maxsplit) { Object result = OnnxInterpreter.interpret(OnnxOps.StringSplit.class, List.of(X), List.of(delimiter, maxsplit)); Object[] resultArray = (Object[]) result; return new StringSplitResult((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Performs element-wise binary subtraction (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Sub(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Sub.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Element-wise sum of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -4001,42 +4001,42 @@ public static Tensor Sum(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Sum.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// Swish function takes one input data (Tensor) and produces one output data (Tensor) of the same shape, /// where $Swish(x) = x * sigmoid(alpha * x)$. public static Tensor Swish(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.Swish.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Calculates the tangent of the given input tensor, element-wise. public static Tensor Tan(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Tan.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic tangent of the given input tensor element-wise. public static Tensor Tanh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Tanh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// TensorScatter is a generic tensor update operation, motivated by the requirements for KV cache updates for Attention /// ops commonly found in LLMs. It is a functional operation that models an in-place update to a KV cache buffer. - /// + /// /// The past and present cache tensors have the same shape (batch_size, D1, D2, ..., max_sequence_length, ..., Dn), with /// the sequence dimension (indicated by the `axis` attribute) being max_sequence_length, so the sizes of these tensors do /// not need to grow between iterations. The `update` tensor's shape only differs from the cache tensors in the sequence /// dimension: (batch_size, D1, D2, ..., sequence_length, ..., Dn), where sequence_length <= max_sequence_length. - /// + /// /// The optional `write_indices` input indicates the write index for each sample in the batch, assumed to be zero /// if not provided. When the `mode` attribute is set to "circular", the write index is modulo max_sequence_length. /// The operation can be described using the following pseudocode: - /// + /// /// ``` /// for prefix_idx in np.ndindex(past_cache.shape[:axis]): /// batch_idx = prefix_idx[0] @@ -4047,7 +4047,7 @@ public static Tensor Tanh(Tensor input) { /// update_idx = (*prefix_idx, sequence_idx) /// present_cache[cache_idx] = update[update_idx] /// ``` - /// + /// /// During the prefill phase of attention, only the first two inputs are needed. During the decode phase, `write_indices` /// is also needed so that the incoming key or value update can be appended after the last valid token for each sample /// in the batch. @@ -4055,14 +4055,14 @@ public static Tensor TensorScatter(Tensor past_cache, Tensor update Object result = OnnxInterpreter.interpret(OnnxOps.TensorScatter.class, List.of(past_cache, update, write_indices), List.of(mode, axis)); return (Tensor) result; } - - /// + + /// /// This transform extracts n-grams from the input sequence and save them as a vector. Input can /// be either a 1-D or 2-D tensor. For 1-D input, output is the n-gram representation of that input. /// For 2-D input, the output is also a 2-D tensor whose i-th row is the n-gram representation of the i-th input row. /// More specifically, if input shape is [C], the corresponding output shape would be [max(ngram_indexes) + 1]. /// If input shape is [N, C], this operator produces a [N, max(ngram_indexes) + 1]-tensor. - /// + /// /// In contrast to standard n-gram extraction, here, the indexes of extracting an n-gram from the original /// sequence are not necessarily consecutive numbers. The discontinuity between indexes are controlled by the number of skips. /// If the number of skips is 2, we should skip two tokens when scanning through the original sequence. @@ -4070,26 +4070,26 @@ public static Tensor TensorScatter(Tensor past_cache, Tensor update /// The associated 2-grams are [94, 12] and [17, 28] respectively indexed by [0, 3] and [1, 4]. /// If the number of skips becomes 0, the 2-grams generated are [94, 17], [17, 36], [36, 12], [12, 28] /// indexed by [0, 1], [1, 2], [2, 3], [3, 4], respectively. - /// + /// /// The output vector (denoted by Y) stores the count of each n-gram; /// Y[ngram_indexes[i]] indicates the times that the i-th n-gram is found. The attribute ngram_indexes is used to determine the mapping /// between index i and the corresponding n-gram's output coordinate. If pool_int64s is [94, 17, 17, 36], ngram_indexes is [1, 0], /// ngram_counts=[0, 0], then the Y[0] (first element in Y) and Y[1] (second element in Y) are the counts of [17, 36] and [94, 17], /// respectively. An n-gram which cannot be found in pool_strings/pool_int64s should be ignored and has no effect on the output. /// Note that we may consider all skips up to S when generating the n-grams. - /// + /// /// The examples used above are true if mode is "TF". If mode is "IDF", all the counts larger than 1 would be truncated to 1 and /// the i-th element in weights would be used to scale (by multiplication) the count of the i-th n-gram in pool. If mode is "TFIDF", /// this operator first computes the counts of all n-grams and then scale them by the associated values in the weights attribute. - /// + /// /// Only one of pool_strings and pool_int64s can be set. If pool_int64s is set, the input should be an integer tensor. /// If pool_strings is set, the input must be a string tensor. public static Tensor TfIdfVectorizer(Tensor X, long[] ngram_counts, long min_gram_length, Optional pool_strings, String mode, long max_gram_length, long max_skip_count, Optional pool_int64s, Optional weights, long[] ngram_indexes) { Object result = OnnxInterpreter.interpret(OnnxOps.TfIdfVectorizer.class, List.of(X), List.of(ngram_counts, min_gram_length, pool_strings, mode, max_gram_length, max_skip_count, pool_int64s, weights, ngram_indexes)); return (Tensor) result; } - - /// + + /// /// ThresholdedRelu takes one input data (Tensor) and produces one output data /// (Tensor) where the rectified linear function, y = x for x > alpha, y = 0 otherwise, /// is applied to the tensor elementwise. @@ -4097,7 +4097,7 @@ public static Tensor ThresholdedRelu(Tensor X, Optional alpha) Object result = OnnxInterpreter.interpret(OnnxOps.ThresholdedRelu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - + /// Constructs a tensor by tiling a given tensor. /// This is the same as function `tile` in Numpy, but no broadcast. /// For example A = [[1, 2], [3, 4]], B = [1, 2], tile(A, B) = [[1, 2, 1, 2], [3, 4, 3, 4]] @@ -4105,22 +4105,22 @@ public static Tensor Tile(Tensor input, Tensor repeats) { Object result = OnnxInterpreter.interpret(OnnxOps.Tile.class, List.of(input, repeats), List.of()); return (Tensor) result; } - + public record TopKResult(Tensor Values, Tensor Indices) { } - /// + /// /// Retrieve the top-K largest or smallest elements along a specified axis. Given an input tensor of /// shape [a_0, a_1, ..., a_{n-1}] and integer argument k, return two outputs: - /// + /// /// * Value tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}] /// which contains the values of the top k elements along the specified axis /// * Index tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}] which /// contains the indices of the top k elements (original indices from the input /// tensor). - /// + /// /// * If "largest" is 1 (the default value) then the k largest elements are returned. /// * If "sorted" is 1 (the default value) then the resulting k elements will be sorted. /// * If "sorted" is 0, order of returned 'Values' and 'Indices' are undefined. - /// + /// /// Given two equivalent values, this operator uses the indices along the axis as /// a tiebreaker. That is, the element with the lower index will appear first. public static TopKResult TopK(Tensor X, Tensor K, Optional largest, Optional sorted, Optional axis) { @@ -4128,8 +4128,8 @@ public static TopKResult TopK(Tensor X, Tensor K, Optional Object[] resultArray = (Object[]) result; return new TopKResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Returns a transpose of the input tensor. (Similar to `numpy.transpose`). /// The optional attribute `perm` must be a permutation of the dimensions of /// the input tensor. Axis `i` of the output tensor corresponds to the axis @@ -4144,17 +4144,17 @@ public static Tensor Transpose(Tensor data, Optional perm) { Object result = OnnxInterpreter.interpret(OnnxOps.Transpose.class, List.of(data), List.of(perm)); return (Tensor) result; } - - /// + + /// /// Tree Ensemble operator. Returns the regressed values for each input in a batch. /// Inputs have dimensions `[N, F]` where `N` is the input batch size and `F` is the number of input features. /// Outputs have dimensions `[N, num_targets]` where `N` is the batch size and `num_targets` is the number of targets, which is a configurable attribute. - /// + /// /// The encoding of this attribute is split along interior nodes and the leaves of the trees. Notably, attributes with the prefix `nodes_*` are associated with interior nodes, and attributes with the prefix `leaf_*` are associated with leaves. /// The attributes `nodes_*` must all have the same length and encode a sequence of tuples, as defined by taking all the `nodes_*` fields at a given position. - /// + /// /// All fields prefixed with `leaf_*` represent tree leaves, and similarly define tuples of leaves and must have identical length. - /// + /// /// This operator can be used to implement both the previous `TreeEnsembleRegressor` and `TreeEnsembleClassifier` nodes. /// The `TreeEnsembleRegressor` node maps directly to this node and requires changing how the nodes are represented. /// The `TreeEnsembleClassifier` node can be implemented by adding a `ArgMax` node after this node to determine the top class. @@ -4163,9 +4163,9 @@ public static Tensor TreeEnsemble(Tensor X, Optional aggregate_f Object result = OnnxInterpreter.interpret(OnnxOps.TreeEnsemble.class, List.of(X), List.of(aggregate_function, nodes_hitrates, nodes_featureids, nodes_falseleafs, post_transform, nodes_trueleafs, nodes_modes, nodes_falsenodeids, nodes_truenodeids, leaf_weights, leaf_targetids, tree_roots, n_targets, nodes_missing_value_tracks_true, membership_values, nodes_splits)); return (Tensor) result; } - + public record TreeEnsembleClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// This operator is DEPRECATED. Please use TreeEnsemble with provides similar functionality. /// In order to determine the top class, the ArgMax node can be applied to the output of TreeEnsemble. /// To encode class labels, use a LabelEncoder operator. @@ -4185,8 +4185,8 @@ public static TreeEnsembleClassifierResult TreeEnsembleClassifier(T Object[] resultArray = (Object[]) result; return new TreeEnsembleClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// This operator is DEPRECATED. Please use TreeEnsemble instead which provides the same /// functionality.
/// Tree Ensemble regressor. Returns the regressed values for each input in N.
@@ -4205,8 +4205,8 @@ public static Tensor TreeEnsembleRegressor(Tensor X, Optional) result; } - - /// + + /// /// Given a 2-D matrix or batches of 2-D matrices, returns the upper or lower triangular part of the tensor(s). /// The attribute "upper" determines whether the upper or lower part is retained. If set to true, /// the upper triangular matrix is retained. Lower triangular matrix is retained otherwise. @@ -4223,22 +4223,22 @@ public static Tensor Trilu(Tensor input, Optional> k, Opt Object result = OnnxInterpreter.interpret(OnnxOps.Trilu.class, List.of(input, k), List.of(upper)); return (Tensor) result; } - + public record UniqueResult(Tensor Y, Tensor indices, Tensor inverse_indices, Tensor counts) { } - /// + /// /// Find the unique elements of a tensor. When an optional attribute 'axis' is provided, unique subtensors sliced along the 'axis' are returned. /// Otherwise the input tensor is flattened and unique values of the flattened tensor are returned. - /// + /// /// This operator returns the unique values or sliced unique subtensors of the input tensor and three optional outputs. /// The first output tensor 'Y' contains all unique values or subtensors of the input. /// The second optional output tensor 'indices' contains indices of 'Y' elements' first occurrence in 'X'. /// The third optional output tensor 'inverse_indices' contains, for elements of 'X', its corresponding indices in 'Y'. /// The fourth optional output tensor 'counts' contains the count of each element of 'Y' in the input. - /// + /// /// Outputs are either sorted in ascending order or optionally in the order of the first occurrence of the values in the input. - /// + /// /// https://docs.scipy.org/doc/numpy/reference/generated/numpy.unique.html - /// + /// /// Example 1: /// ``` /// input_X = [2, 1, 1, 3, 4, 3] @@ -4249,7 +4249,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 1, 1, 2, 3, 2] /// output_counts = [1, 2, 2, 1] /// ``` - /// + /// /// Example 2: /// ``` /// input_X = [[1, 3], [2, 3]] @@ -4260,7 +4260,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 2, 1, 2] /// output_counts = [1, 1, 2] /// ``` - /// + /// /// Example 3: /// ``` /// input_X = [[1, 0, 0], [1, 0, 0], [2, 3, 4]] @@ -4271,7 +4271,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 0, 1] /// output_counts = [2, 1] /// ``` - /// + /// /// Example 4: /// ``` /// input_x = [[[1., 1.], [0., 1.], [2., 1.], [0., 1.]], @@ -4279,7 +4279,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// attribute_sorted = 1 /// attribute_axis = 1 /// ``` - /// + /// /// intermediate data are presented below for better understanding: /// there are 4 subtensors sliced along axis 1 of input_x (shape = (2, 4, 2)): /// ``` @@ -4288,37 +4288,37 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// [[2, 1], [2, 1]], /// [[0, 1], [0, 1]]. /// ``` - /// + /// /// there are 3 unique subtensors: /// ``` /// [[1, 1], [1, 1]], /// [[0, 1], [0, 1]], /// [[2, 1], [2, 1]]. /// ``` - /// + /// /// sorted unique subtensors: /// ``` /// B: [[0, 1], [0, 1]], /// [[1, 1], [1, 1]], /// [[2, 1], [2, 1]]. /// ``` - /// + /// /// output_Y is constructed from B: /// ``` /// [[[0. 1.], [1. 1.], [2. 1.]], /// [[0. 1.], [1. 1.], [2. 1.]]] /// ``` - /// + /// /// output_indices is to map from B to A: /// ``` /// [1, 0, 2] /// ``` - /// + /// /// output_inverse_indices is to map from A to B: /// ``` /// [1, 0, 2, 0] /// ``` - /// + /// /// output_counts: /// ``` /// [2, 1, 1] @@ -4328,14 +4328,14 @@ public static UniqueResult Unique(Tensor X, Optional sorted, Opt Object[] resultArray = (Object[]) result; return new UniqueResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2], (Tensor)resultArray[3]); } - - /// + + /// /// Insert single-dimensional entries to the shape of an input tensor (`data`). /// Takes one required input `axes` - which contains a list of dimension indices and this operator will insert a dimension of value `1` into the corresponding index of the output tensor (`expanded`). - /// + /// /// For example, given an input tensor (`data`) of shape [3, 4, 5], then /// Unsqueeze(data, axes=[0, 4]) outputs a tensor (`expanded`) containing same data as `data` but with shape [1, 3, 4, 5, 1]. - /// + /// /// The input `axes` should not contain any duplicate entries. It is an error if it contains duplicates. /// The rank of the output tensor (`output_rank`) is the rank of the input tensor (`data`) plus the number of values in `axes`. /// Each value in `axes` should be within the (inclusive) range [-output_rank , output_rank - 1]. @@ -4344,8 +4344,8 @@ public static Tensor Unsqueeze(Tensor data, Tensor axes) { Object result = OnnxInterpreter.interpret(OnnxOps.Unsqueeze.class, List.of(data, axes), List.of()); return (Tensor) result; } - - /// + + /// /// Upsample the input tensor. /// Each dimension value of the output tensor is: /// output_dimension = floor(input_dimension * scale). @@ -4353,30 +4353,30 @@ public static Tensor Upsample(Tensor X, Tensor scales, Optional Object result = OnnxInterpreter.interpret(OnnxOps.Upsample.class, List.of(X, scales), List.of(mode)); return (Tensor) result; } - - /// + + /// /// Return elements, either from X or Y, depending on condition. /// Where behaves like /// [numpy.where](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html) /// with three parameters. - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Where(Tensor condition, Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.Where.class, List.of(condition, X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `xor` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Xor(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Xor.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Creates a map from the input and the attributes.
/// The values are provided by the input tensor, while the keys are specified by the attributes. /// Must provide keys in either classlabels_strings or classlabels_int64s (but not both).
@@ -4385,5 +4385,5 @@ public static List> ZipMap(Tensor X, Optional c Object result = OnnxInterpreter.interpret(OnnxOps.ZipMap.class, List.of(X), List.of(classlabels_int64s, classlabels_strings)); return (List>) result; } - + } diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/Tensor.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/Tensor.java index f42be63494b..122e6178e07 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/Tensor.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/Tensor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,6 +61,9 @@ class DataType(enum.IntEnum): UINT4 = 21 INT4 = 22 FLOAT4E2M1 = 23 + FLOAT8E8M0 = 24 + UINT2 = 25 + INT2 = 26 */ public class Tensor extends OnnxNumber { @@ -244,7 +247,11 @@ public enum ElementType { FLOAT8E5M2FNUZ(20, Object.class), UINT4(21, Object.class), INT4(22, Object.class), - FLOAT4E2M1(23, Object.class); + FLOAT4E2M1(23, Object.class), + FLOAT8E8M0(24, Object.class), + UINT2(25, Object.class), + INT2(26, Object.class) + ; final int id; final Class type; @@ -264,8 +271,8 @@ public String onnxName() { public int bitSize() { return switch (this) { - case INT4, UINT4, FLOAT4E2M1 -> 4; - case UINT8, INT8, BOOL, FLOAT8E4M3FN, FLOAT8E4M3FNUZ, FLOAT8E5M2, FLOAT8E5M2FNUZ -> 8; + case INT2, INT4, UINT2, UINT4, FLOAT4E2M1 -> 4; + case UINT8, INT8, BOOL, FLOAT8E4M3FN, FLOAT8E4M3FNUZ, FLOAT8E5M2, FLOAT8E5M2FNUZ, FLOAT8E8M0 -> 8; case UINT16, INT16, FLOAT16, BFLOAT16 -> 16; case UINT32, INT32, FLOAT -> 32; case UINT64, INT64, DOUBLE, COMPLEX64 -> 64; diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java index fa0974f620f..da6cf0058a2 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java @@ -249,17 +249,55 @@ public void prompt(String prompt, Consumer outputConsumer) { try { call(OgaTokenizerEncode(tokenizer, arena.allocateFrom(prompt), inputTokens)); LOG.log(System.Logger.Level.DEBUG, "Tokenizer encode"); - call(OgaGenerator_AppendTokenSequences(generator, inputTokens)); - LOG.log(System.Logger.Level.DEBUG, "Generator loop"); - while (!OgaGenerator_IsDone(generator)) { - call(OgaGenerator_GenerateNextToken(generator)); - int nextToken = call(OgaGenerator_GetNextTokens(generator, ret, count)).get(C_INT, 0); - String response = call(OgaTokenizerStreamDecode(tokenizerStream, nextToken, ret)).getString(0); - outputConsumer.accept(response); - } - outputConsumer.accept("\n"); - LOG.log(System.Logger.Level.DEBUG, "Tokenizer stream decoded"); + generate(inputTokens, generator, outputConsumer); + } finally { + OgaDestroySequences(inputTokens); + } + } + + private void generate(MemorySegment inputTokens, MemorySegment generator, Consumer outputConsumer) { + call(OgaGenerator_AppendTokenSequences(generator, inputTokens)); + LOG.log(System.Logger.Level.DEBUG, "Generator loop"); + while (!OgaGenerator_IsDone(generator)) { + call(OgaGenerator_GenerateNextToken(generator)); + int nextToken = call(OgaGenerator_GetNextTokens(generator, ret, count)).get(C_INT, 0); + String response = call(OgaTokenizerStreamDecode(tokenizerStream, nextToken, ret)).getString(0); + outputConsumer.accept(response); + } + outputConsumer.accept("\n"); + LOG.log(System.Logger.Level.DEBUG, "Tokenizer stream decoded"); + } + + /** + * Runs generator with the provided prompt and feeds decoded response to the provided consumer. + * @param prompt Text prompt to tokenize and append to the LLM model input. + * @param maxNewTokens Maximum number of output tokens generated. + * @param outputConsumer Consumer receiving decoded model response from the model generator. + */ + public void prompt(String prompt, int maxNewTokens, Consumer outputConsumer) { + if (maxNewTokens < 0) { + throw new IllegalArgumentException("maxNewTokens must be above 0, found " + maxNewTokens); + } + LOG.log(System.Logger.Level.DEBUG, "Create sequences"); + var inputTokens = call(OgaCreateSequences(ret)); + + MemorySegment localGeneratorParams = null; + MemorySegment localGenerator = MemorySegment.NULL; + try { + call(OgaTokenizerEncode(tokenizer, arena.allocateFrom(prompt), inputTokens)); + LOG.log(System.Logger.Level.DEBUG, "Tokenizer encode"); + long promptTokens = OgaSequencesGetSequenceCount(inputTokens, 0L); + long maxLength = Math.addExact(promptTokens, maxNewTokens); + localGeneratorParams = call(OgaCreateGeneratorParams(model, ret)); + call(OgaGeneratorParamsSetSearchNumber(localGeneratorParams, arena.allocateFrom("max_length"), maxLength)); + localGenerator = call(OgaCreateGenerator(model, localGeneratorParams, ret)); + + generate(inputTokens, localGenerator, outputConsumer); } finally { + if (!localGeneratorParams.equals(MemorySegment.NULL)) + OgaDestroyGeneratorParams(localGeneratorParams); + if (!localGenerator.equals(MemorySegment.NULL)) + OgaDestroyGenerator(localGenerator); OgaDestroySequences(inputTokens); } } diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/TensorDataStream.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/TensorDataStream.java index 3e56f96694d..f8e98fd7e66 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/TensorDataStream.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/TensorDataStream.java @@ -27,6 +27,7 @@ import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; import java.nio.channels.FileChannel; +import java.util.Arrays; import java.util.stream.LongStream; import oracle.code.onnx.Tensor; @@ -50,8 +51,7 @@ public Tensor nextTensor(Tensor.ElementType type, long... shape) { long size = type.bitSize() * LongStream.of(shape).reduce(1L, (a, b) -> a * b) / 8L; if (offset + size > data.byteSize()) { throw new IllegalArgumentException("Tensor data file '" + dataFilePath + "' is too small:requested " - + size + " bytes of offset " + offset + " for tensor shape " - + LongStream.of(shape).mapToObj(Long::toString).toString() + + size + " bytes of offset " + offset + " for tensor shape " + Arrays.toString(shape) + ", but the mapped data contains only " + data.byteSize() + " bytes."); } Tensor tensor = new Tensor<>(arena, data.asSlice(offset, size), type, shape); diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxType.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxType.java index 91a29c952da..9a0a3cbb3ed 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxType.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/ir/OnnxType.java @@ -637,7 +637,7 @@ public ExternalizedCodeType externalize() { @Override public int id() { - return 23; + return 24; } } diff --git a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java index 2ed71c8eddf..5e0e67b2325 100644 --- a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java +++ b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java @@ -35,12 +35,13 @@ public static void main(String... args) throws Exception { Path modelRoot = Path.of(LlamaDemo.class.getResource("LlamaDemo.class").toURI()).getParent(); try (Arena arena = Arena.ofConfined()) { + int maxNewTokens = 128; var modelInstance = new LlamaModel(arena); try (OnnxGenRuntimeSession session = OnnxGenRuntimeSession.buildFromCodeReflection(MethodHandles.lookup(), modelInstance, "forward", modelRoot, "model.onnx", "model.data")) { session.prompt(""" <|start_header_id|>user<|end_header_id|>Hello, tell me a joke.<|eot_id|> <|start_header_id|>assistant<|end_header_id|> - """, System.out::print); + """, maxNewTokens, System.out::print); } } } diff --git a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java index b72c2891ff4..c1a759bafa6 100644 --- a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java +++ b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java @@ -42,8 +42,8 @@ public final class LlamaModel { ACCURACY_LEVEL = 4, VOCAB_SIZE = 128256, HEAD_SIZE = 64, - HIDEN_SIZE = 2048, - KV_HIDEN_SIZE = 512, + HIDDEN_SIZE = 2048, + KV_KV_HIDDEN_SIZE = 512, CONTEXT_SIZE = 131072, INTERMEDIATE_SIZE = 8192; public static final float EPSILON = 1.0E-5f, @@ -75,29 +75,30 @@ public LlamaModel(Arena arena) throws IOException { kvShape = Tensor.ofFlat(arena, 1L, NUM_KEY_VALUE_HEADS, -1L, HEAD_SIZE); var modelData = new TensorDataStream(arena, LlamaModel.class.getResource("model_q4.onnx_data").getPath()); - tokensWeights = modelData.nextTensor(FLOAT, VOCAB_SIZE, HIDEN_SIZE); - initWeight = modelData.nextTensor(FLOAT, HIDEN_SIZE); + tokensWeights = modelData.nextTensor(FLOAT, VOCAB_SIZE, HIDDEN_SIZE); + initWeight = modelData.nextTensor(FLOAT, HIDDEN_SIZE); cosCache = modelData.nextTensor(FLOAT, CONTEXT_SIZE, HEAD_SIZE / 2); sinCache = modelData.nextTensor(FLOAT, CONTEXT_SIZE, HEAD_SIZE / 2); + for (int i = 0; i < LAYERS; i++) { - postAttentionWeights[i] = modelData.nextTensor(FLOAT, HIDEN_SIZE); - inputWeights[i] = modelData.nextTensor(FLOAT, HIDEN_SIZE); + postAttentionWeights[i] = modelData.nextTensor(FLOAT, HIDDEN_SIZE); + inputWeights[i] = modelData.nextTensor(FLOAT, HIDDEN_SIZE); } for (int i = 0; i < LAYERS; i++) { - attnQWeight[i] = modelData.nextTensor(UINT8, HIDEN_SIZE, HEAD_SIZE, 16); - attnQScales[i] = modelData.nextTensor(FLOAT, HIDEN_SIZE, HEAD_SIZE); - attnKWeight[i] = modelData.nextTensor(UINT8, KV_HIDEN_SIZE, HEAD_SIZE, 16); - attnKScales[i] = modelData.nextTensor(FLOAT, KV_HIDEN_SIZE, HEAD_SIZE); - attnVWeight[i] = modelData.nextTensor(UINT8, KV_HIDEN_SIZE, HEAD_SIZE, 16); - attnVScales[i] = modelData.nextTensor(FLOAT, KV_HIDEN_SIZE, HEAD_SIZE); - attnOWeight[i] = modelData.nextTensor(UINT8, HIDEN_SIZE, HEAD_SIZE, 16); - attnOScales[i] = modelData.nextTensor(FLOAT, HIDEN_SIZE, HEAD_SIZE); + attnQWeight[i] = modelData.nextTensor(UINT8, HIDDEN_SIZE, HEAD_SIZE, 16); + attnQScales[i] = modelData.nextTensor(FLOAT, HIDDEN_SIZE, HEAD_SIZE); + attnKWeight[i] = modelData.nextTensor(UINT8, KV_KV_HIDDEN_SIZE, HEAD_SIZE, 16); + attnKScales[i] = modelData.nextTensor(FLOAT, KV_KV_HIDDEN_SIZE, HEAD_SIZE); + attnVWeight[i] = modelData.nextTensor(UINT8, KV_KV_HIDDEN_SIZE, HEAD_SIZE, 16); + attnVScales[i] = modelData.nextTensor(FLOAT, KV_KV_HIDDEN_SIZE, HEAD_SIZE); + attnOWeight[i] = modelData.nextTensor(UINT8, HIDDEN_SIZE, HEAD_SIZE, 16); + attnOScales[i] = modelData.nextTensor(FLOAT, HIDDEN_SIZE, HEAD_SIZE); mlpGateWeight[i] = modelData.nextTensor(UINT8, INTERMEDIATE_SIZE, HEAD_SIZE, 16); mlpGateScales[i] = modelData.nextTensor(FLOAT, INTERMEDIATE_SIZE, HEAD_SIZE); mlpUpWeight[i] = modelData.nextTensor(UINT8, INTERMEDIATE_SIZE, HEAD_SIZE, 16); mlpUpScales[i] = modelData.nextTensor(FLOAT, INTERMEDIATE_SIZE, HEAD_SIZE); - mlpDownWeight[i] = modelData.nextTensor(UINT8, HIDEN_SIZE, 256, 16); - mlpDownScales[i] = modelData.nextTensor(FLOAT, HIDEN_SIZE, 256); + mlpDownWeight[i] = modelData.nextTensor(UINT8, HIDDEN_SIZE, 256, 16); + mlpDownScales[i] = modelData.nextTensor(FLOAT, HIDDEN_SIZE, 256); } } @@ -120,13 +121,13 @@ public ForwardResponse forward(Tensor inputIds, Tensor attentionMask for (int i = 0; i < LAYERS; i++) { GroupQueryAttention attn = GroupQueryAttention(MatMulNBits(input, attnQWeight[i], - attnQScales[i], empty(), empty(), empty(), HIDEN_SIZE, HIDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE), + attnQScales[i], empty(), empty(), empty(), HIDDEN_SIZE, HIDDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE), of(MatMulNBits(input, attnKWeight[i], - attnKScales[i], empty(), empty(), empty(), HIDEN_SIZE, KV_HIDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE)), + attnKScales[i], empty(), empty(), empty(), HIDDEN_SIZE, KV_KV_HIDDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE)), of(MatMulNBits(input, attnVWeight[i], - attnVScales[i], empty(), empty(), empty(), HIDEN_SIZE, KV_HIDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE)), + attnVScales[i], empty(), empty(), empty(), HIDDEN_SIZE, KV_KV_HIDDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE)), of(pastKey[i]), of(pastValue[i]), amSL, @@ -138,21 +139,21 @@ attnVScales[i], empty(), empty(), empty(), HIDEN_SIZE, KV_HIDEN_SIZE, of(ACCURAC skipBias, MatMulNBits(attn.output(), attnOWeight[i], - attnOScales[i], empty(), empty(), empty(), HIDEN_SIZE, HIDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE), + attnOScales[i], empty(), empty(), empty(), HIDDEN_SIZE, HIDDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE), postAttentionWeights[i], empty(), of(EPSILON)); Tensor mlpGateProj = MatMulNBits(postAttnLayernorm.output(), mlpGateWeight[i], - mlpGateScales[i], empty(), empty(), empty(), HIDEN_SIZE, INTERMEDIATE_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE); + mlpGateScales[i], empty(), empty(), empty(), HIDDEN_SIZE, INTERMEDIATE_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE); SkipSimplifiedLayerNormalization norm = SkipSimplifiedLayerNormalization(postAttnLayernorm.input_skip_bias_sum(), MatMulNBits(Mul(Mul(mlpGateProj, Sigmoid(mlpGateProj)), MatMulNBits(postAttnLayernorm.output(), mlpUpWeight[i], - mlpUpScales[i], empty(), empty(), empty(), HIDEN_SIZE, INTERMEDIATE_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE)), + mlpUpScales[i], empty(), empty(), empty(), HIDDEN_SIZE, INTERMEDIATE_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE)), mlpDownWeight[i], - mlpDownScales[i], empty(), empty(), empty(), INTERMEDIATE_SIZE, HIDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE), + mlpDownScales[i], empty(), empty(), empty(), INTERMEDIATE_SIZE, HIDDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE), inputWeights[i], empty(), of(EPSILON)); input = norm.output(); From de0d00507e5c86834fd89f4009c40ccf8ce6e987 Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Thu, 16 Jul 2026 07:23:08 +0200 Subject: [PATCH 12/18] Fix rename typo for constant. Signed-off-by: Ana-Maria Mihalceanu --- .../test/java/oracle/code/onnx/llm/LlamaModel.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java index c1a759bafa6..da6c2c607f0 100644 --- a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java +++ b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaModel.java @@ -43,7 +43,7 @@ public final class LlamaModel { VOCAB_SIZE = 128256, HEAD_SIZE = 64, HIDDEN_SIZE = 2048, - KV_KV_HIDDEN_SIZE = 512, + KV_HIDDEN_SIZE = 512, CONTEXT_SIZE = 131072, INTERMEDIATE_SIZE = 8192; public static final float EPSILON = 1.0E-5f, @@ -87,10 +87,10 @@ public LlamaModel(Arena arena) throws IOException { for (int i = 0; i < LAYERS; i++) { attnQWeight[i] = modelData.nextTensor(UINT8, HIDDEN_SIZE, HEAD_SIZE, 16); attnQScales[i] = modelData.nextTensor(FLOAT, HIDDEN_SIZE, HEAD_SIZE); - attnKWeight[i] = modelData.nextTensor(UINT8, KV_KV_HIDDEN_SIZE, HEAD_SIZE, 16); - attnKScales[i] = modelData.nextTensor(FLOAT, KV_KV_HIDDEN_SIZE, HEAD_SIZE); - attnVWeight[i] = modelData.nextTensor(UINT8, KV_KV_HIDDEN_SIZE, HEAD_SIZE, 16); - attnVScales[i] = modelData.nextTensor(FLOAT, KV_KV_HIDDEN_SIZE, HEAD_SIZE); + attnKWeight[i] = modelData.nextTensor(UINT8, KV_HIDDEN_SIZE, HEAD_SIZE, 16); + attnKScales[i] = modelData.nextTensor(FLOAT, KV_HIDDEN_SIZE, HEAD_SIZE); + attnVWeight[i] = modelData.nextTensor(UINT8, KV_HIDDEN_SIZE, HEAD_SIZE, 16); + attnVScales[i] = modelData.nextTensor(FLOAT, KV_HIDDEN_SIZE, HEAD_SIZE); attnOWeight[i] = modelData.nextTensor(UINT8, HIDDEN_SIZE, HEAD_SIZE, 16); attnOScales[i] = modelData.nextTensor(FLOAT, HIDDEN_SIZE, HEAD_SIZE); mlpGateWeight[i] = modelData.nextTensor(UINT8, INTERMEDIATE_SIZE, HEAD_SIZE, 16); @@ -124,10 +124,10 @@ public ForwardResponse forward(Tensor inputIds, Tensor attentionMask attnQScales[i], empty(), empty(), empty(), HIDDEN_SIZE, HIDDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE), of(MatMulNBits(input, attnKWeight[i], - attnKScales[i], empty(), empty(), empty(), HIDDEN_SIZE, KV_KV_HIDDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE)), + attnKScales[i], empty(), empty(), empty(), HIDDEN_SIZE, KV_HIDDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE)), of(MatMulNBits(input, attnVWeight[i], - attnVScales[i], empty(), empty(), empty(), HIDDEN_SIZE, KV_KV_HIDDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE)), + attnVScales[i], empty(), empty(), empty(), HIDDEN_SIZE, KV_HIDDEN_SIZE, of(ACCURACY_LEVEL), BITS, BLOCK_SIZE)), of(pastKey[i]), of(pastValue[i]), amSL, From 9baea9fef34b3fc457e358338ab891ee9ccba302 Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Thu, 16 Jul 2026 07:42:16 +0200 Subject: [PATCH 13/18] Fix trailing whitespace. Signed-off-by: Ana-Maria Mihalceanu --- .../java/oracle/code/onnx/OnnxOperators.java | 1722 ++++++++--------- 1 file changed, 861 insertions(+), 861 deletions(-) diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java index 013b7e18d94..3cef838114c 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/OnnxOperators.java @@ -34,10 +34,10 @@ @SuppressWarnings({"unchecked", "OptionalUsedAsFieldOrParameterType"}) public final class OnnxOperators extends ExplicitOnnxOperators { - + private OnnxOperators() {} - - /// + + /// /// Absolute takes one input data (Tensor) and produces one output data /// (Tensor) where absolute value, y = abs(x), is applied to /// the tensor elementwise. @@ -45,34 +45,34 @@ public static Tensor Abs(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Abs.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the arccosine (inverse of cosine) of the given input tensor, element-wise. public static Tensor Acos(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Acos.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic arccosine of the given input tensor element-wise. public static Tensor Acosh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Acosh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Compute one iteration of ADAGRAD, a stochastic gradient based optimization /// algorithm. This operator can conduct the optimization of multiple tensor variables. - /// + /// /// Let's define the behavior of this operator. As you can imagine, ADAGRAD requires /// some parameters: - /// + /// /// - The initial learning-rate "R". /// - The update count "T". That is, the number of training iterations conducted. /// - A L2-norm regularization coefficient "norm_coefficient". /// - A learning-rate decay factor "decay_factor". /// - A small constant "epsilon" to avoid dividing-by-zero. - /// + /// /// At each ADAGRAD iteration, the optimized tensors are moved along a direction /// computed based on their estimated gradient and accumulated squared gradient. Assume /// that only a single tensor "X" is updated by this operator. We need the value of "X", @@ -82,32 +82,32 @@ public static Tensor Acosh(Tensor input) { /// corresponding output tensors are the new value of "X" (called "X_new"), and then /// the new accumulated squared gradient (called "H_new"). Those outputs are computed /// from the given inputs following the pseudo code below. - /// + /// /// Let "+", "-", "*", and "/" are all element-wise arithmetic operations with /// numpy-style broadcasting support. The pseudo code to compute those outputs is: - /// + /// /// // Compute a scalar learning-rate factor. At the first update of X, T is generally /// // 0 (0-based update index) or 1 (1-based update index). /// r = R / (1 + T * decay_factor); - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||_2^2, where ||X||_2 is the 2-norm. /// G_regularized = norm_coefficient * X + G; - /// + /// /// // Compute new accumulated squared gradient. /// H_new = H + G_regularized * G_regularized; - /// + /// /// // Compute the adaptive part of per-coordinate learning rate. Note that Sqrt(...) /// // computes element-wise square-root. /// H_adaptive = Sqrt(H_new) + epsilon - /// + /// /// // Compute the new value of "X". /// X_new = X - r * G_regularized / H_adaptive; - /// + /// /// If one assign this operators to optimize multiple inputs, for example, "X_1" and "X_2", the same /// pseudo code may be extended to handle all tensors jointly. More specifically, we can view "X" as a /// concatenation of "X_1" and "X_2" (of course, their gradient and accumulate gradient should /// be concatenated too) and then just reuse the entire pseudo code. - /// + /// /// Note that ADAGRAD was first proposed in http://jmlr.org/papers/volume12/duchi11a/duchi11a.pdf. /// In that reference paper, this operator is a special case of the Figure 1's composite mirror /// descent update. @@ -115,86 +115,86 @@ public static List> Adagrad(Tensor R, Tensor T, Li Object result = OnnxInterpreter.interpret(OnnxOps.Adagrad.class, List.of(R, T, inputs), List.of(epsilon, decay_factor, norm_coefficient)); return (List>) result; } - - /// + + /// /// Compute one iteration of Adam, a stochastic gradient based optimization /// algorithm. This operator can conduct the optimization of multiple tensor variables. - /// + /// /// Let's define the behavior of this operator. First of all, Adam requires /// some parameters: - /// + /// /// - The learning-rate "R". /// - The update count "T". That is, the number of training iterations conducted. /// - A L2-norm regularization coefficient "norm_coefficient". /// - A small constant "epsilon" to avoid dividing-by-zero. /// - Two coefficients, "alpha" and "beta". - /// + /// /// At each Adam iteration, the optimized tensors are moved along a direction /// computed based on their exponentially-averaged historical gradient and /// exponentially-averaged historical squared gradient. Assume that only a tensor /// "X" is being optimized. The rest of required information is - /// + /// /// - the value of "X", /// - "X"'s gradient (denoted by "G"), /// - "X"'s exponentially-averaged historical gradient (denoted by "V"), and /// - "X"'s exponentially-averaged historical squared gradient (denoted by "H"). - /// + /// /// Some of those parameters are passed into this operator as input tensors and others /// are stored as this operator's attributes. Specifically, this operator's input tensor /// list is ["R", "T", "X", "G", "V", "H"]. That is, "R" is the first input, "T" is /// the second input, and so on. Other parameters are given as attributes because they /// are constants. Moreover, the corresponding output tensors are - /// + /// /// - the new value of "X" (called "X_new"), /// - the new exponentially-averaged historical gradient (denoted by "V_new"), and /// - the new exponentially-averaged historical squared gradient (denoted by "H_new"). - /// + /// /// Those outputs are computed following the pseudo code below. - /// + /// /// Let "+", "-", "*", and "/" are all element-wise arithmetic operations with /// numpy-style broadcasting support. The pseudo code to compute those outputs is: - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||_2^2, where ||X||_2 is the 2-norm. /// G_regularized = norm_coefficient * X + G - /// + /// /// // Update exponentially-averaged historical gradient. /// V_new = alpha * V + (1 - alpha) * G_regularized - /// + /// /// // Update exponentially-averaged historical squared gradient. /// H_new = beta * H + (1 - beta) * G_regularized * G_regularized - /// + /// /// // Compute the element-wise square-root of H_new. V_new will be element-wisely /// // divided by H_sqrt for a better update direction. /// H_sqrt = Sqrt(H_new) + epsilon - /// + /// /// // Compute learning-rate. Note that "alpha**T"/"beta**T" is alpha's/beta's T-th power. /// R_adjusted = T > 0 ? R * Sqrt(1 - beta**T) / (1 - alpha**T) : R - /// + /// /// // Compute new value of "X". /// X_new = X - R_adjusted * V_new / H_sqrt - /// + /// /// // Post-update regularization. /// X_final = (1 - norm_coefficient_post) * X_new - /// + /// /// If there are multiple inputs to be optimized, the pseudo code will be applied /// independently to each of them. public static List> Adam(Tensor R, Tensor T, List> inputs, Optional epsilon, Optional norm_coefficient_post, Optional norm_coefficient, Optional alpha, Optional beta) { Object result = OnnxInterpreter.interpret(OnnxOps.Adam.class, List.of(R, T, inputs), List.of(epsilon, norm_coefficient_post, norm_coefficient, alpha, beta)); return (List>) result; } - - /// + + /// /// Performs element-wise binary addition (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Add(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Add.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Generates a 2D or 3D flow field (sampling grid), given a batch of affine matrices theta /// (https://pytorch.org/docs/stable/generated/torch.nn.functional.affine_grid.html). /// An affine matrix `theta` is applied to a position tensor represented in its homogeneous expression. Here is an example in 3D: @@ -206,10 +206,10 @@ public static Tensor Add(Tensor A, Tensor B) { /// ``` /// where `(x, y, z)` is the position in the original space, `(x', y', z')` is the position in the output space. /// The last row is always `[0, 0, 0, 1]` and is not stored in the affine matrix. Therefore we have `theta` of shape `(N, 2, 3)` for 2D or `(N, 3, 4)` for 3D. - /// + /// /// Input `size` is used to define grid of positions evenly spaced in the original 2D or 3D space, with dimensions ranging from `-1` to `1`. /// The output `grid` contains positions in the output space. - /// + /// /// When `align_corners=1`, consider `-1` and `1` to refer to the centers of the corner pixels (mark `v` in illustration). /// ``` /// v v v v @@ -226,18 +226,18 @@ public static Tensor AffineGrid(Tensor theta, Tensor size, Op Object result = OnnxInterpreter.interpret(OnnxOps.AffineGrid.class, List.of(theta, size), List.of(align_corners)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `and` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor And(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.And.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Computes the indices of the max elements of the input tensor's element along the /// provided axis. The resulting tensor has the same rank as the input if keepdims equals 1. /// If keepdims equals 0, then the resulting tensor has the reduced dimension pruned. @@ -249,8 +249,8 @@ public static Tensor ArgMax(Tensor data, Optional keepdims, O Object result = OnnxInterpreter.interpret(OnnxOps.ArgMax.class, List.of(data), List.of(keepdims, select_last_index, axis)); return (Tensor) result; } - - /// + + /// /// Computes the indices of the min elements of the input tensor's element along the /// provided axis. The resulting tensor has the same rank as the input if keepdims equals 1. /// If keepdims equals 0, then the resulting tensor has the reduced dimension pruned. @@ -262,65 +262,65 @@ public static Tensor ArgMin(Tensor data, Optional keepdims, O Object result = OnnxInterpreter.interpret(OnnxOps.ArgMin.class, List.of(data), List.of(keepdims, select_last_index, axis)); return (Tensor) result; } - - /// + + /// /// Select elements of the input tensor based on the indices passed.
/// The indices are applied to the last axes of the tensor. public static Tensor ArrayFeatureExtractor(Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.ArrayFeatureExtractor.class, List.of(X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the arcsine (inverse of sine) of the given input tensor, element-wise. public static Tensor Asin(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Asin.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic arcsine of the given input tensor element-wise. public static Tensor Asinh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Asinh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the arctangent (inverse of tangent) of the given input tensor, element-wise. public static Tensor Atan(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Atan.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic arctangent of the given input tensor element-wise. public static Tensor Atanh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Atanh.class, List.of(input), List.of()); return (Tensor) result; } - + public record AttentionResult(Tensor Y, Tensor present_key, Tensor present_value, Tensor qk_matmul_output) { } - /// - /// + /// + /// /// Computes scaled dot product attention on query, key and value tensors, using an optional attention mask if passed. - /// + /// /// This operator covers self and cross variants of the attention operation based on sequence lengths of K, Q and V. - /// + /// /// For self attention, `kv_sequence_length` equals to `q_sequence_length`. - /// + /// /// For cross attention, query and key might have different lengths. - /// + /// /// This operator also covers the 3 following variants based on the number of heads: /// 1) Multi-headed Attention (MHA): Described in the paper https://arxiv.org/pdf/1706.03762, `q_num_heads = kv_num_heads`. /// 2) Group-query Attention (GQA): Described in the paper https://arxiv.org/pdf/2305.13245, `q_num_heads > kv_num_heads`, `q_num_heads % kv_num_heads == 0`. /// 3) Multi-query Attention (MQA): Described in the paper https://arxiv.org/pdf/1911.02150, `q_num_heads > kv_num_heads`, `kv_num_heads=1`. - /// + /// /// Attention bias to be added is calculated based on `attn_mask` input and `is_causal` attribute: /// 1) `attn_mask`: A boolean mask where a value of `True` indicates that the element should take part in attention or a float mask of the same type as query, key, value that is added to the attention score. /// 2) If `is_causal` is set to `1`, attention scores above the diagonal are masked out, regardless of the `attn_mask` input. - /// + /// /// With respect to KV cache update, this operator allows the following two use cases: - /// + /// /// 1) Cache update happens inside the Attention operator. In this case, the `K` and `V` inputs contain only the incoming /// tokens for the current autoregressive step, and the four optional inputs/outputs past and present key and value are /// all needed. The Attention op performs a Concat operation on the past and incoming key and value to form the present @@ -332,10 +332,10 @@ public record AttentionResult(Tensor Y, Tensor present_key, Tens /// provided to indicate the number of non-padding tokens in each sample of the batch to save unnecessary computation. /// Here, the kv_sequence dimension of `attn_mask` can be shorter than `K` and `V`, but still needs to be at least as long /// as the maximum value of `nonpad_kv_seqlen`. - /// + /// /// Both past and present state key/values are optional. They shall be used together, and not allowed to use only one of them. /// The following pattern is applied to the Q, K and V inputs after appropriate reshaping of K and V inputs based on sequence lengths and num heads provided: - /// + /// /// ``` /// The following pattern is applied by this operator: /// Q K V @@ -361,8 +361,8 @@ public static AttentionResult Attention(Tensor Q, Tensor Object[] resultArray = (Object[]) result; return new AttentionResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2], (Tensor)resultArray[3]); } - - /// + + /// /// AveragePool consumes an input tensor X and applies average pooling across /// the tensor according to kernel sizes, stride sizes, and pad lengths. /// average pooling consisting of computing the average on all values of a @@ -378,7 +378,7 @@ public static AttentionResult Attention(Tensor Q, Tensor /// output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1) /// ``` /// if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`. Sliding windows that would start in the right padded region are ignored. - /// + /// /// `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled: /// ``` /// VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i]) @@ -394,14 +394,14 @@ public static AttentionResult Attention(Tensor Q, Tensor /// pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i] /// ``` /// The output of each pooling window is divided by the number of elements (exclude pad when attribute count_include_pad is zero). - /// + /// public static Tensor AveragePool(Tensor X, Optional pads, Optional dilations, Optional auto_pad, Optional count_include_pad, Optional ceil_mode, Optional strides, long[] kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.AveragePool.class, List.of(X), List.of(pads, dilations, auto_pad, count_include_pad, ceil_mode, strides, kernel_shape)); return (Tensor) result; } - + public record BatchNormalizationResult(Tensor Y, Tensor running_mean, Tensor running_var) { } - /// + /// /// Carries out batch normalization as described in the paper /// https://arxiv.org/abs/1502.03167. Depending on the mode it is being run, /// There are five required inputs 'X', 'scale', 'B', 'input_mean' and @@ -410,16 +410,16 @@ public record BatchNormalizationResult(Tensor Y, Tensor running_me /// statistics in inference mode (training_mode=False, default), /// and the running statistics in training mode (training_mode=True). /// There are multiple cases for the number of outputs, which we list below: - /// + /// /// * Output case #1: Y, running_mean, running_var (training_mode=True) /// * Output case #2: Y (training_mode=False) - /// + /// /// When training_mode=False, extra outputs are invalid. /// The outputs are updated as follows when training_mode=True: /// ``` /// running_mean = input_mean * momentum + current_mean * (1 - momentum) /// running_var = input_var * momentum + current_var * (1 - momentum) - /// + /// /// Y = (X - current_mean) / sqrt(current_var + epsilon) * scale + B /// ``` /// where: @@ -430,14 +430,14 @@ public record BatchNormalizationResult(Tensor Y, Tensor running_me /// Notice that `ReduceVar` refers to the population variance, and it equals to /// `sum(sqrd(x_i - x_avg)) / N` /// where `N` is the population size (this formula does not use sample size `N - 1`). - /// + /// /// The computation of ReduceMean and ReduceVar uses float to avoid overflow for float16 inputs. - /// + /// /// When training_mode=False: /// ``` /// Y = (X - input_mean) / sqrt(input_var + epsilon) * scale + B /// ``` - /// + /// /// For previous (depreciated) non-spatial cases, implementors are suggested /// to flatten the input shape to (N x C * D1 * D2 * ... * Dn) before a BatchNormalization Op. /// This operator has **optional** inputs/outputs. See [the doc](IR.md) for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted. @@ -446,31 +446,31 @@ public static BatchNormalizationResult BatchNormalization(Ten Object[] resultArray = (Object[]) result; return new BatchNormalizationResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// Draws binary random numbers (0 or 1) from a Bernoulli distribution. The input tensor should be a tensor /// containing probabilities p (a value in the range [0,1]) to be used for drawing the binary random number, /// where an output of 1 is produced with probability p and an output of 0 is produced with probability (1-p). - /// + /// /// This operator is non-deterministic and may not produce the same values in different /// implementations (even if a seed is specified). public static Tensor Bernoulli(Tensor input, Optional seed, Optional dtype) { Object result = OnnxInterpreter.interpret(OnnxOps.Bernoulli.class, List.of(input), List.of(seed, dtype)); return (Tensor) result; } - - /// + + /// /// Maps the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value. public static Tensor Binarizer(Tensor X, Optional threshold) { Object result = OnnxInterpreter.interpret(OnnxOps.Binarizer.class, List.of(X), List.of(threshold)); return (Tensor) result; } - - /// + + /// /// Reinterprets the binary representation of a tensor as a different data type, /// specified by the 'to' attribute. Unlike Cast, BitCast preserves the exact bit /// pattern without any value conversion. - /// + /// /// The target data type must have the same bit-width as the input data type. /// The output tensor has the same shape as the input tensor. /// All types except string are supported. Implementations must treat the @@ -479,8 +479,8 @@ public static Tensor BitCast(Tensor input, long to) { Object result = OnnxInterpreter.interpret(OnnxOps.BitCast.class, List.of(input), List.of(to)); return (Tensor) result; } - - /// + + /// /// Bitwise shift operator performs element-wise operation. For each input element, if the /// attribute "direction" is "RIGHT", this operator moves its binary representation toward /// the right side so that the input value is effectively decreased. If the attribute "direction" @@ -489,7 +489,7 @@ public static Tensor BitCast(Tensor input, long to) { /// Y specifies the amounts of shifting. For example, if "direction" is "Right", X is [1, 4], /// and S is [1, 1], the corresponding output Z would be [0, 2]. If "direction" is "LEFT" with /// X=[1, 2] and S=[1, 2], the corresponding output Y would be [2, 8]. - /// + /// /// Because this operator supports Numpy-style broadcasting, X's and Y's shapes are /// not necessarily identical. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -497,57 +497,57 @@ public static Tensor BitShift(Tensor X, Tensor Y, String direction) Object result = OnnxInterpreter.interpret(OnnxOps.BitShift.class, List.of(X, Y), List.of(direction)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulting from performing the bitwise `and` operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor BitwiseAnd(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseAnd.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the bitwise not of the input tensor element-wise. public static Tensor BitwiseNot(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseNot.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulting from performing the bitwise `or` operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor BitwiseOr(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseOr.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulting from performing the bitwise `xor` operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor BitwiseXor(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.BitwiseXor.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Generates a Blackman window as described in the paper https://ieeexplore.ieee.org/document/1455106. public static Tensor BlackmanWindow(Tensor size, Optional periodic, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.BlackmanWindow.class, List.of(size), List.of(periodic, output_datatype)); return (Tensor) result; } - - /// + + /// /// The operator casts the elements of a given input tensor to a data type /// specified by the 'to' argument and returns an output tensor of the same size in /// the converted type. The 'to' argument must be one of the data types specified /// in the 'DataType' enum field in the TensorProto message. - /// + /// /// Casting from string tensor in plain (e.g., "3.14" and "1000") and scientific numeric representations /// (e.g., "1e-5" and "1E8") to float types is supported. For example, converting string "100.5" to an integer may /// yield result 100. There are some string literals reserved for special floating-point values; @@ -557,15 +557,15 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// to string tensors, plain floating-point representation (such as "314.15926") would be used. /// Converting non-numerical-literal string such as "Hello World!" is an undefined behavior. Cases /// of converting string representing floating-point arithmetic value, such as "2.718", to INT is an undefined behavior. - /// + /// /// Conversion from a numerical type to any numerical type is always allowed. /// User must be aware of precision loss and value change caused by range difference between two types. /// For example, a 64-bit float 3.1415926459 may be round to a 32-bit float 3.141592. Similarly, converting /// an integer 36 to Boolean may produce 1 because we truncate bits which can't be stored in the targeted type. - /// + /// /// In more detail, the conversion among numerical types should follow these rules /// if the destination type is not a float 8 type. - /// + /// /// * Casting from floating point to: /// * floating point: +/- infinity if OOR (out of range). /// * fixed point: undefined if OOR. @@ -579,12 +579,12 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// * floating point: `{1.0, 0.0}`. /// * fixed point: `{1, 0}`. /// * bool: no change. - /// + /// /// Float 8 types (E4M3FN, E4M3FNUZ, E5M2, E5M2FNUZ) were introduced to speed up the training of /// deep models. By default the conversion of a float *x* obeys /// to the following rules. `[x]` means the value rounded to /// the target mantissa width. - /// + /// /// | x | E4M3FN | E4M3FNUZ | E5M2 | E5M2FNUZ | /// | ----------------- | -------- | -------- | -------- | -------- | /// | 0 | 0 | 0 | 0 | 0 | @@ -595,10 +595,10 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// | \[x\] > FLT_MAX | FLT_MAX | FLT_MAX | FLT_MAX | FLT_MAX | /// | \[x\] \< -FLT_MAX | -FLT_MAX | -FLT_MAX | -FLT_MAX | -FLT_MAX | /// | else | RNE | RNE | RNE | RNE | - /// + /// /// The behavior changes if the parameter 'saturate' is set to False. /// The rules then become: - /// + /// /// | x | E4M3FN | E4M3FNUZ | E5M2 | E5M2FNUZ | /// | ----------------- | ------ | -------- | ---- | -------- | /// | 0 | 0 | 0 | 0 | 0 | @@ -610,12 +610,12 @@ public static Tensor BlackmanWindow(Tensor size, Optional /// | \[x\] > FLT_MAX | NaN | NaN | Inf | NaN | /// | \[x\] \< -FLT_MAX | NaN | NaN | -Inf | NaN | /// | else | RNE | RNE | RNE | RNE | - /// + /// /// FLOAT8E8M0 type was introduced to enable [Microscaling (MX) formats](https://www.opencompute.org/documents/ocp-microscaling-formats-mx-v1-0-spec-final-pdf). /// When casting to FLOAT8E8M0, the rounding behavior can be specified using the `round_mode` and `saturate` attributes. /// The current CUDA behavior is to round up and saturate. Casting negative values to FLOAT8E8M0 gives undefined behavior. /// The following table describes the casting behavior of special values to FLOAT8E8M0 in the two most common cases. - /// + /// /// | x | saturate + up | non-saturate + nearest | /// | ----------------- | ------------- | --------------------- | /// | 0 | 0 | NaN | @@ -629,8 +629,8 @@ public static Tensor Cast(Tensor input, Optional saturate Object result = OnnxInterpreter.interpret(OnnxOps.Cast.class, List.of(input), List.of(saturate, to, round_mode)); return (Tensor) result; } - - /// + + /// /// The operator casts the elements of a given input tensor (the first input) to /// the same data type as the elements of the second input tensor. /// See documentation of the Cast operator for further details. @@ -638,8 +638,8 @@ public static Tensor CastLike(Tensor input, Tensor target_t Object result = OnnxInterpreter.interpret(OnnxOps.CastLike.class, List.of(input, target_type), List.of(saturate, round_mode)); return (Tensor) result; } - - /// + + /// /// Converts a map to a tensor.
The map key must be an int64 and the values will be ordered /// in ascending order based on this key.
The operator supports dense packing or sparse packing. /// If using sparse packing, the key cannot exceed the max_map-1 value. @@ -647,8 +647,8 @@ public static Tensor CastMap(Map X, Optional map_ Object result = OnnxInterpreter.interpret(OnnxOps.CastMap.class, List.of(X), List.of(map_form, cast_to, max_map)); return (Tensor) result; } - - /// + + /// /// Converts strings to integers and vice versa.
/// Two sequences of equal length are used to map between integers and strings, /// with strings and integers at the same index detailing the mapping.
@@ -661,34 +661,34 @@ public static Tensor CategoryMapper(Tensor X, Optional Object result = OnnxInterpreter.interpret(OnnxOps.CategoryMapper.class, List.of(X), List.of(cats_int64s, cats_strings, default_int64, default_string)); return (Tensor) result; } - + public record CausalConvWithStateResult(Tensor output, Tensor present_state) { } - /// - /// + /// + /// /// Stateful causal 1D depthwise convolution. - /// + /// /// Used by Gated DeltaNet (Qwen3.5) and Mamba (Jamba, FalconMamba) as a preprocessing step. /// Replaces the 3-op pattern (Concat + Conv + Slice) with a single fused operation. - /// + /// /// The convolution is causal (looks only at current and past positions) and depthwise /// (each channel is convolved independently with its own kernel). - /// + /// /// The input, weight, past_state, output, and present_state tensors are rank-3 with /// shape (batch_size, channels, length). The optional bias input is rank-1 with /// shape (channels). For higher-dimensional data, use Reshape nodes before and /// after this operator to pack extra dimensions into the batch or channel axis. - /// + /// /// Weight layout: (channels, 1, k) for depthwise convolution. /// The carry state stores the last (k-1) positions for incremental decode. - /// + /// /// The optional activation attribute supports fused SiLU/Swish activation. public static CausalConvWithStateResult CausalConvWithState(Tensor input, Tensor weight, Optional> bias, Optional> past_state, Optional activation) { Object result = OnnxInterpreter.interpret(OnnxOps.CausalConvWithState.class, List.of(input, weight, bias, past_state), List.of(activation)); Object[] resultArray = (Object[]) result; return new CausalConvWithStateResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Ceil takes one input data (Tensor) and produces one output data /// (Tensor) where the ceil is, y = ceil(x), is applied to /// the tensor elementwise. If x is integral, +0, -0, NaN, or infinite, x itself is returned. @@ -696,12 +696,12 @@ public static Tensor Ceil(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Ceil.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Continuously Differentiable Exponential Linear Units: /// Perform the linear unit element-wise on the input tensor X /// using formula: - /// + /// /// ``` /// max(0,x) + min(0,alpha*(exp(x/alpha)-1)) /// ``` @@ -709,28 +709,28 @@ public static Tensor Celu(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.Celu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Center crop or pad an input to given dimensions. - /// + /// /// The crop/pad dimensions can be specified for a subset of the `axes`; unspecified dimensions will remain unchanged. - /// + /// /// If the input dimensions are larger than the target crop dimensions, a centered cropping window will be extracted /// from the input. The starting value for the cropping window is rounded down, which means that if the difference /// between the input shape and the crop shape is odd, the cropping window will be shifted half a pixel to the left /// of the input center. - /// + /// /// If the input dimensions are smaller than the target crop dimensions, the input will be padded equally on both sides /// to center it in the output. In cases where the total number of padding pixels is odd, an additional pixel will be /// added to the right side. - /// + /// /// The padding value used is zero. public static Tensor CenterCropPad(Tensor input_data, Tensor shape, Optional axes) { Object result = OnnxInterpreter.interpret(OnnxOps.CenterCropPad.class, List.of(input_data, shape), List.of(axes)); return (Tensor) result; } - - /// + + /// /// Clip operator limits the given input within an interval. The interval is /// specified by the inputs 'min' and 'max'. They default to /// numeric_limits::lowest() and numeric_limits::max(), respectively. @@ -740,14 +740,14 @@ public static Tensor Clip(Tensor input, Optional> min, Optio Object result = OnnxInterpreter.interpret(OnnxOps.Clip.class, List.of(input, min, max), List.of()); return (Tensor) result; } - - /// + + /// /// The operator rearranges column blocks back into a multidimensional image - /// + /// /// Col2Im behaves similarly to PyTorch's fold https://pytorch.org/docs/stable/generated/torch.nn.Fold.html, /// but it only supports *batched* multi-dimensional image tensors. /// Another implementation in Python with N-dimension support can be found at https://github.com/f-dangel/unfoldNd/. - /// + /// /// NOTE: /// Although specifying image_shape looks redundant because it could be calculated from /// convolution formulas, it is required as input for more advanced scenarios as explained @@ -756,24 +756,24 @@ public static Tensor Col2Im(Tensor input, Tensor image_shape, Te Object result = OnnxInterpreter.interpret(OnnxOps.Col2Im.class, List.of(input, image_shape, block_shape), List.of(pads, dilations, strides)); return (Tensor) result; } - - /// + + /// /// Selects slices from an input tensor along a given axis where condition evaluates to True for each axis index. /// In case axis is not provided, input is flattened before elements are selected. /// Compress behaves like numpy.compress: https://docs.scipy.org/doc/numpy/reference/generated/numpy.compress.html - /// + /// public static Tensor Compress(Tensor input, Tensor condition, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Compress.class, List.of(input, condition), List.of(axis)); return (Tensor) result; } - + /// Concatenate a list of tensors into a single tensor. All input tensors must have the same shape, except for the dimension size of the axis to concatenate on. public static Tensor Concat(List> inputs, long axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Concat.class, List.of(inputs), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Concatenate a sequence of tensors into a single tensor. /// All input tensors must have the same shape, except for the dimension size of the axis to concatenate on. /// By default 'new_axis' is 0, the behavior is similar to numpy.concatenate. @@ -782,78 +782,78 @@ public static Tensor ConcatFromSequence(List> input_sequence Object result = OnnxInterpreter.interpret(OnnxOps.ConcatFromSequence.class, List.of(input_sequence), List.of(axis, new_axis)); return (Tensor) result; } - - /// + + /// /// This operator produces a constant tensor. Exactly one of the provided attributes, either value, sparse_value, /// or value_* must be specified. public static Tensor Constant(Optional value_int, Optional value_floats, Optional value_strings, Optional value_float, Optional value_string, Optional value_ints, Optional sparse_value, Optional value) { Object result = OnnxInterpreter.interpret(OnnxOps.Constant.class, List.of(), List.of(value_int, value_floats, value_strings, value_float, value_string, value_ints, sparse_value, value)); return (Tensor) result; } - - /// + + /// /// Generate a tensor with given value and shape. public static Tensor ConstantOfShape(Tensor input, Optional value) { Object result = OnnxInterpreter.interpret(OnnxOps.ConstantOfShape.class, List.of(input), List.of(value)); return (Tensor) result; } - - /// + + /// /// The convolution operator consumes an input tensor and a filter, and /// computes the output. public static Tensor Conv(Tensor X, Tensor W, Optional> B, Optional pads, Optional dilations, Optional auto_pad, Optional strides, Optional group, Optional kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.Conv.class, List.of(X, W, B), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); return (Tensor) result; } - - /// + + /// /// The integer convolution operator consumes an input tensor, its zero-point, a filter, and its zero-point, /// and computes the output. The production MUST never overflow. The accumulation may overflow if and only if in 32 bits. public static Tensor ConvInteger(Tensor x, Tensor w, Optional> x_zero_point, Optional> w_zero_point, Optional pads, Optional dilations, Optional auto_pad, Optional strides, Optional group, Optional kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.ConvInteger.class, List.of(x, w, x_zero_point, w_zero_point), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); return (Tensor) result; } - - /// + + /// /// The convolution transpose operator consumes an input tensor and a filter, /// and computes the output. - /// + /// /// If the pads parameter is provided the shape of the output is calculated via the following equation: - /// + /// /// output_shape[i] = stride[i] * (input_size[i] - 1) + output_padding[i] + ((kernel_shape[i] - 1) * dilations[i] + 1) - pads[start_i] - pads[end_i] - /// + /// /// output_shape can also be explicitly specified in which case pads values are auto generated using these equations: - /// + /// /// total_padding[i] = stride[i] * (input_size[i] - 1) + output_padding[i] + ((kernel_shape[i] - 1) * dilations[i] + 1) - output_shape[i] /// If (auto_pads == SAME_UPPER): pads[start_i] = total_padding[i]/2; pads[end_i] = total_padding[i] - (total_padding[i]/2) /// Else: pads[start_i] = total_padding[i] - (total_padding[i]/2); pads[end_i] = (total_padding[i]/2). - /// - /// + /// + /// public static Tensor ConvTranspose(Tensor X, Tensor W, Optional> B, Optional output_shape, Optional pads, Optional dilations, Optional auto_pad, Optional strides, Optional group, Optional kernel_shape, Optional output_padding) { Object result = OnnxInterpreter.interpret(OnnxOps.ConvTranspose.class, List.of(X, W, B), List.of(output_shape, pads, dilations, auto_pad, strides, group, kernel_shape, output_padding)); return (Tensor) result; } - - /// + + /// /// Calculates the cosine of the given input tensor, element-wise. public static Tensor Cos(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Cos.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic cosine of the given input tensor element-wise. public static Tensor Cosh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Cosh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Performs cumulative product of the input elements along the given axis. /// By default, it will do the product inclusively meaning the first element is copied as is. /// Through an `exclusive` attribute, this behavior can change to exclude the first element. /// It can also perform product in the opposite direction of the axis. For that, set `reverse` attribute to 1. - /// + /// /// Example: /// ``` /// input_x = [1, 2, 3] @@ -868,18 +868,18 @@ public static Tensor Cosh(Tensor input) { /// reverse=1 /// output = [6, 3, 1] /// ``` - /// + /// public static Tensor CumProd(Tensor x, Tensor axis, Optional exclusive, Optional reverse) { Object result = OnnxInterpreter.interpret(OnnxOps.CumProd.class, List.of(x, axis), List.of(exclusive, reverse)); return (Tensor) result; } - - /// + + /// /// Performs cumulative sum of the input elements along the given axis. /// By default, it will do the sum inclusively meaning the first element is copied as is. /// Through an `exclusive` attribute, this behavior can change to exclude the first element. /// It can also perform summation in the opposite direction of the axis. For that, set `reverse` attribute to 1. - /// + /// /// Example: /// ``` /// input_x = [1, 2, 3] @@ -894,59 +894,59 @@ public static Tensor CumProd(Tensor x, Tensor axis, Optional Tensor CumSum(Tensor x, Tensor axis, Optional exclusive, Optional reverse) { Object result = OnnxInterpreter.interpret(OnnxOps.CumSum.class, List.of(x, axis), List.of(exclusive, reverse)); return (Tensor) result; } - + /// Computes the discrete Fourier Transform (DFT) of the input. - /// + /// /// Assuming the input has shape `[M, N]`, where `N` is the dimension over which the /// DFT is computed and `M` denotes the conceptual "all other dimensions," /// the DFT `y[m, k]` of shape `[M, N]` is defined as - /// + /// /// $$y[m, k] = \sum_{n=0}^{N-1} e^{-2 \pi j \frac{k n}{N} } x[m, n] ,$$ - /// + /// /// and the inverse transform is defined as - /// + /// /// $$x[m, n] = \frac{1}{N} \sum_{k=0}^{N-1} e^{2 \pi j \frac{k n}{N} } y[m, k] ,$$ - /// + /// /// where $j$ is the imaginary unit. - /// + /// /// The actual shape of the output is specified in the "output" section. - /// + /// /// Reference: https://docs.scipy.org/doc/scipy/tutorial/fft.html public static Tensor DFT(Tensor input, Optional> dft_length, Optional> axis, Optional inverse, Optional onesided) { Object result = OnnxInterpreter.interpret(OnnxOps.DFT.class, List.of(input, dft_length, axis), List.of(inverse, onesided)); return (Tensor) result; } - - /// + + /// /// Performs deformable convolution as described in https://arxiv.org/abs/1703.06211 and https://arxiv.org/abs/1811.11168. /// This operator specification supports the general N-D case. Note that most common use cases have 2D or 3D data. public static Tensor DeformConv(Tensor X, Tensor W, Tensor offset, Optional> B, Optional> mask, Optional pads, Optional dilations, Optional strides, Optional offset_group, Optional group, Optional kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.DeformConv.class, List.of(X, W, offset, B, mask), List.of(pads, dilations, strides, offset_group, group, kernel_shape)); return (Tensor) result; } - + /// DepthToSpace rearranges (permutes) data from depth into blocks of spatial data. /// This is the reverse transformation of SpaceToDepth. More specifically, this op outputs a copy of /// the input tensor where values from the depth dimension are moved in spatial blocks to the height /// and width dimensions. By default, `mode` = `DCR`. /// In the DCR mode, elements along the depth dimension from the input tensor are rearranged in the /// following order: depth, column, and then row. The output y is computed from the input x as below: - /// + /// /// ``` /// b, c, h, w = x.shape /// tmp = np.reshape(x, [b, blocksize, blocksize, c // (blocksize**2), h, w]) /// tmp = np.transpose(tmp, [0, 3, 4, 1, 5, 2]) /// y = np.reshape(tmp, [b, c // (blocksize**2), h * blocksize, w * blocksize]) /// ``` - /// + /// /// In the CRD mode, elements along the depth dimension from the input tensor are rearranged in the /// following order: column, row, and the depth. The output y is computed from the input x as below: - /// + /// /// ``` /// b, c, h, w = x.shape /// tmp = np.reshape(x, [b, c // (blocksize ** 2), blocksize, blocksize, h, w]) @@ -957,14 +957,14 @@ public static Tensor DepthToSpace(Tensor input, Optional mode, Object result = OnnxInterpreter.interpret(OnnxOps.DepthToSpace.class, List.of(input), List.of(mode, blocksize)); return (Tensor) result; } - - /// + + /// /// The linear dequantization operator. It consumes a quantized tensor, a scale, and a zero point to compute the /// full-precision tensor. The dequantization formula is `y = (x - x_zero_point) * x_scale`. `x_scale` and `x_zero_point` /// must have the same shape, determining the quantization's granularity: a scalar for per-tensor/per-layer quantization, /// a 1-D tensor for per-axis quantization, or have a rank identical to the input for blocked quantization. /// See QuantizeLinear for details on quantization granularity. - /// + /// /// `x_zero_point` and `x` must have the same type. `x` and `y` must have the same shape. In the case of dequantizing /// `int32`, there's no zero point (zero point is supposed to be 0). /// `zero-point` is usually not used in the case of float8 and 4-bit types quantization, but the dequantization formula remains the same @@ -974,8 +974,8 @@ public static Tensor DequantizeLinear(Tensor x, Tensor Object result = OnnxInterpreter.interpret(OnnxOps.DequantizeLinear.class, List.of(x, x_scale, x_zero_point), List.of(output_dtype, axis, block_size)); return (Tensor) result; } - - /// + + /// /// Det calculates determinant of a square matrix or batches of square matrices. /// Det takes one input tensor of shape `[*, M, M]`, where `*` is zero or more batch dimensions, /// and the inner-most 2 dimensions form square matrices. @@ -985,8 +985,8 @@ public static Tensor Det(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Det.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Uses an index mapping to convert a dictionary to an array.
/// Given a dictionary, each key is looked up in the vocabulary attribute corresponding to /// the key type. The index into the vocabulary array at which the key is found is then @@ -998,26 +998,26 @@ public static Tensor Det(Tensor X) { /// Any keys not present in the input dictionary, will be zero in the output array.
/// For example: if the ``string_vocabulary`` parameter is set to ``["a", "c", "b", "z"]``, /// then an input of ``{"a": 4, "c": 8}`` will produce an output of ``[4, 8, 0, 0]``. - /// + /// public static Tensor DictVectorizer(Map X, Optional string_vocabulary, Optional int64_vocabulary) { Object result = OnnxInterpreter.interpret(OnnxOps.DictVectorizer.class, List.of(X), List.of(string_vocabulary, int64_vocabulary)); return (Tensor) result; } - - /// + + /// /// Performs element-wise binary division (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// For integer inputs, the result is computed using truncating division (rounding toward zero). /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Div(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Div.class, List.of(A, B), List.of()); return (Tensor) result; } - + public record DropoutResult(Tensor output, Tensor mask) { } - /// + /// /// Dropout takes an input floating-point tensor, an optional input ratio (floating-point scalar) and an optional input training_mode (boolean scalar). It produces two tensor outputs, /// output (floating-point tensor) and mask (optional `Tensor`). If `training_mode` is true then the output Y will be a random dropout; /// Note that this Dropout scales the masked input data by the following equation, so to convert the trained model into inference mode, @@ -1035,34 +1035,34 @@ public static DropoutResult Dropout(Tensor data, Optional((Tensor)resultArray[0], (Tensor)resultArray[1]); } - + public record DynamicQuantizeLinearResult(Tensor y, Tensor y_scale, Tensor y_zero_point) { } - /// + /// /// A Function to fuse calculation for Scale, Zero Point and FP32->8Bit conversion of FP32 Input data. /// Outputs Scale, ZeroPoint and Quantized Input for a given FP32 Input. /// Scale is calculated as: /// ``` /// y_scale = (maximum(0, max(x)) - minimum(0, min(x))) / (qmax - qmin) /// ``` - /// + /// /// * where qmax and qmin are max and min values for quantization range i.e. [0, 255] in case of uint8 /// * data range is adjusted to include 0. - /// + /// /// Zero point is calculated as: /// ``` /// intermediate_zero_point = qmin - min(x)/y_scale /// y_zero_point = cast(round(saturate(intermediate_zero_point))) /// ``` - /// + /// /// * where qmax and qmin are max and min values for quantization range .i.e [0, 255] in case of uint8 /// * for saturation, it saturates to [0, 255] if it's uint8, or [-127, 127] if it's int8. Right now only uint8 is supported. /// * rounding to nearest ties to even. - /// + /// /// Data quantization formula is: /// ``` /// y = saturate (round (x / y_scale) + y_zero_point) /// ``` - /// + /// /// * for saturation, it saturates to [0, 255] if it's uint8, or [-127, 127] if it's int8. Right now only uint8 is supported. /// * rounding to nearest ties to even. public static DynamicQuantizeLinearResult DynamicQuantizeLinear(Tensor x) { @@ -1070,29 +1070,29 @@ public static DynamicQuantizeLinearResult DynamicQuantizeLinear(Tensor x) Object[] resultArray = (Object[]) result; return new DynamicQuantizeLinearResult((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// An einsum of the form `term1, term2 -> output-term` produces an output tensor using the following equation - /// + /// /// ``` /// output[output-term] = reduce-sum( input1[term1] * input2[term2] ) /// ``` - /// + /// /// where the reduce-sum performs a summation over all the indices occurring in the input terms (term1, term2) /// that do not occur in the output-term. - /// + /// /// The Einsum operator evaluates algebraic tensor operations on a sequence of tensors, using the Einstein summation /// convention. The equation string contains a comma-separated sequence of lower case letters. Each term corresponds to /// an operand tensor, and the characters within the terms correspond to operands dimensions. - /// + /// /// This sequence may be followed by "->" to separate the left and right hand side of the equation. /// If the equation contains "->" followed by the right-hand side, the explicit (not classical) form of the Einstein /// summation is performed, and the right-hand side indices indicate output tensor dimensions. In other cases, /// output indices are (implicitly) set to the alphabetically sorted sequence of indices appearing exactly once in the /// equation. - /// + /// /// When a dimension character is repeated in the left-hand side, it represents summation along the dimension. - /// + /// /// The equation may contain ellipsis ("...") to enable broadcasting. Ellipsis must indicate a fixed number of dimensions. /// Specifically, every occurrence of ellipsis in the equation must represent the same number of dimensions. /// The right-hand side may contain exactly one ellipsis. In implicit mode, the ellipsis dimensions are set to the @@ -1101,8 +1101,8 @@ public static Tensor Einsum(List> Inputs, String equation) { Object result = OnnxInterpreter.interpret(OnnxOps.Einsum.class, List.of(Inputs), List.of(equation)); return (Tensor) result; } - - /// + + /// /// Elu takes one input data (Tensor) and produces one output data /// (Tensor) where the function `f(x) = alpha * (exp(x) - 1.) for x < /// 0`, `f(x) = x for x >= 0`., is applied to the tensor elementwise. @@ -1110,32 +1110,32 @@ public static Tensor Elu(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.Elu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `equal` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Equal(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Equal.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Computes the error function of the given input tensor element-wise. public static Tensor Erf(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Erf.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the exponential of the given input tensor, element-wise. public static Tensor Exp(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Exp.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Broadcast the input tensor following the given shape and the broadcast rule. /// The broadcast rule is similar to numpy.array(input) * numpy.ones(shape): /// Dimensions are right alignment; @@ -1148,8 +1148,8 @@ public static Tensor Expand(Tensor input, Tensor shape) { Object result = OnnxInterpreter.interpret(OnnxOps.Expand.class, List.of(input, shape), List.of()); return (Tensor) result; } - - /// + + /// /// Generate a 2D tensor (matrix) with ones on the diagonal and zeros everywhere else. Only 2D /// tensors are supported, i.e. input T1 must be of rank 2. The shape of the output tensor is the /// same as the input tensor. The data type can be specified by the 'dtype' argument. If @@ -1161,8 +1161,8 @@ public static Tensor EyeLike(Tensor input, Optional dtype Object result = OnnxInterpreter.interpret(OnnxOps.EyeLike.class, List.of(input), List.of(dtype, k)); return (Tensor) result; } - - /// + + /// /// Concatenates input tensors into one continuous output.
/// All input shapes are 2-D and are concatenated along the second dimension. 1-D tensors are treated as [1,C]. /// Inputs are copied to the output maintaining the order of the input arguments.
@@ -1171,8 +1171,8 @@ public static Tensor FeatureVectorizer(List> X, Optional< Object result = OnnxInterpreter.interpret(OnnxOps.FeatureVectorizer.class, List.of(X), List.of(inputdimensions)); return (Tensor) result; } - - /// + + /// /// Flattens the input tensor into a 2D matrix. If input tensor has shape /// (d_0, d_1, ... d_n) then the output will have shape /// (d_0 X d_1 ... d_(axis-1), d_axis X d_(axis+1) ... X dn). @@ -1180,8 +1180,8 @@ public static Tensor Flatten(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Flatten.class, List.of(input), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Floor takes one input data (Tensor) and produces one output data /// (Tensor) where the floor is, y = floor(x), is applied to /// the tensor elementwise. If x is integral, +0, -0, NaN, or infinite, x itself is returned. @@ -1189,14 +1189,14 @@ public static Tensor Floor(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Floor.class, List.of(X), List.of()); return (Tensor) result; } - + public record GRUResult(Tensor Y, Tensor Y_h) { } - /// + /// /// Computes an one-layer GRU. This operator is usually supported via some custom /// implementation such as CuDNN. - /// + /// /// Notations: - /// + /// /// * `X` - input tensor /// * `z` - update gate /// * `r` - reset gate @@ -1212,16 +1212,16 @@ public record GRUResult(Tensor Y, Tensor Y_h) { } /// * `RBb[zrh]` - R bias vectors for backward update, reset, and hidden gates /// * `H` - Hidden state /// * `num_directions` - 2 if direction == bidirectional else 1 - /// + /// /// Activation functions: - /// + /// /// * Relu(x) - max(0, x) /// * Tanh(x) - (1 - e^{-2x})/(1 + e^{-2x}) /// * Sigmoid(x) - 1/(1 + e^{-x}) - /// + /// /// NOTE: /// Below are optional - /// + /// /// * Affine(x) - alpha * x + beta /// * LeakyRelu(x) - x if x >= 0 else alpha * x /// * ThresholdedRelu(x) - x if x >= alpha else 0 @@ -1230,9 +1230,9 @@ public record GRUResult(Tensor Y, Tensor Y_h) { } /// * Elu(x) - x if x >= 0 else alpha * (e^x - 1) /// * Softsign(x) - x/(1 + |x|) /// * Softplus(x) - log(1 + e^x) - /// + /// /// Equations (Default: f=Sigmoid, g=Tanh): - /// + /// /// * zt = f(Xt*(Wz^T) + Ht-1*(Rz^T) + Wbz + Rbz) /// * rt = f(Xt*(Wr^T) + Ht-1*(Rr^T) + Wbr + Rbr) /// * ht = g(Xt*(Wh^T) + (rt (.) Ht-1)*(Rh^T) + Rbh + Wbh) # default, when linear_before_reset = 0 @@ -1244,18 +1244,18 @@ public static GRUResult GRU(Tensor X, Tensor W, Tensor R, Option Object[] resultArray = (Object[]) result; return new GRUResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Given `data` tensor of rank r >= 1, and `indices` tensor of rank q, gather /// entries of the axis dimension of `data` (by default outer-most one as axis=0) indexed by `indices`, and concatenates /// them in an output tensor of rank q + (r - 1). - /// + /// /// It is an indexing operation that indexes into the input `data` along a single (specified) axis. /// Each entry in `indices` produces a `r-1` dimensional slice of the input tensor. /// The entire operation produces, conceptually, a `q`-dimensional tensor of `r-1` dimensional slices, /// which is arranged into a `q + (r-1)`-dimensional tensor, with the `q` dimensions taking the /// place of the original `axis` that is being indexed into. - /// + /// /// The following few examples illustrate how `Gather` works for specific shapes of `data`, /// `indices`, and given value of `axis`: /// | data shape | indices shape | axis | output shape | output equation | @@ -1264,10 +1264,10 @@ public static GRUResult GRU(Tensor X, Tensor W, Tensor R, Option /// | (P, Q, R) | ( ) (a scalar) | 1 | (P, R) | output[p, r] = data[p, indices, r] | /// | (P, Q) | (R, S) | 0 | (R, S, Q) | output[r, s, q] = data[ [indices[r, s], q] | /// | (P, Q) | (R, S) | 1 | (P, R, S) | output[p, r, s] = data[ p, indices[r, s]] | - /// + /// /// More generally, if `axis = 0`, let `k = indices[i_{0}, ..., i_{q-1}]` /// then `output[i_{0}, ..., i_{q-1}, j_{0}, ..., j_{r-2}] = input[k , j_{0}, ..., j_{r-2}]`: - /// + /// /// ``` /// data = [ /// [1.0, 1.2], @@ -1289,10 +1289,10 @@ public static GRUResult GRU(Tensor X, Tensor W, Tensor R, Option /// ], /// ] /// ``` - /// + /// /// If `axis = 1`, let `k = indices[i_{0}, ..., i_{q-1}]` /// then `output[j_{0}, i_{0}, ..., i_{q-1}, j_{1}, ..., j_{r-2}] = input[j_{0}, k, j_{1}, ..., j_{r-2}]`: - /// + /// /// ``` /// data = [ /// [1.0, 1.2, 1.9], @@ -1313,9 +1313,9 @@ public static Tensor Gather(Tensor data, Tensor indices, O Object result = OnnxInterpreter.interpret(OnnxOps.Gather.class, List.of(data, indices), List.of(axis)); return (Tensor) result; } - - /// - /// + + /// + /// /// GatherElements takes two inputs `data` and `indices` of the same rank r >= 1 /// and an optional attribute `axis` that identifies an axis of `data` /// (by default, the outer-most axis, that is axis 0). It is an indexing operation @@ -1323,7 +1323,7 @@ public static Tensor Gather(Tensor data, Tensor indices, O /// positions determined by elements of the `indices` tensor. /// Its output shape is the same as the shape of `indices` and consists of one value /// (gathered from the `data`) for each element in `indices`. - /// + /// /// For instance, in the 3-D case (r = 3), the output produced is determined /// by the following equations: /// ``` @@ -1331,9 +1331,9 @@ public static Tensor Gather(Tensor data, Tensor indices, O /// out[i][j][k] = input[i][index[i][j][k]][k] if axis = 1, /// out[i][j][k] = input[i][j][index[i][j][k]] if axis = 2, /// ``` - /// + /// /// This operator is also the inverse of ScatterElements. It is similar to Torch's gather operation. - /// + /// /// Example 1: /// ``` /// data = [ @@ -1371,86 +1371,86 @@ public static Tensor GatherElements(Tensor data, Tensor in Object result = OnnxInterpreter.interpret(OnnxOps.GatherElements.class, List.of(data, indices), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Given `data` tensor of rank `r` >= 1, `indices` tensor of rank `q` >= 1, and `batch_dims` integer `b`, this operator gathers /// slices of `data` into an output tensor of rank `q + r - indices_shape[-1] - 1 - b`. - /// + /// /// `indices` is an q-dimensional integer tensor, best thought of as a `(q-1)`-dimensional tensor of index-tuples into `data`, /// where each element defines a slice of `data` - /// + /// /// `batch_dims` (denoted as `b`) is an integer indicating the number of batch dimensions, i.e the leading `b` number of dimensions of /// `data` tensor and `indices` are representing the batches, and the gather starts from the `b+1` dimension. - /// + /// /// Some salient points about the inputs' rank and shape: - /// + /// /// 1) r >= 1 and q >= 1 are to be honored. There is no dependency condition to be met between ranks `r` and `q` - /// + /// /// 2) The first `b` dimensions of the shape of `indices` tensor and `data` tensor must be equal. - /// + /// /// 3) b < min(q, r) is to be honored. - /// + /// /// 4) The `indices_shape[-1]` should have a value between 1 (inclusive) and rank `r-b` (inclusive) - /// + /// /// 5) All values in `indices` are expected to be within bounds [-s, s-1] along axis of size `s` (i.e.) `-data_shape[i] <= indices[...,i] <= data_shape[i] - 1`. /// It is an error if any of the index values are out of bounds. - /// + /// /// The output is computed as follows: - /// + /// /// The output tensor is obtained by mapping each index-tuple in the `indices` tensor to the corresponding slice of the input `data`. - /// + /// /// 1) If `indices_shape[-1] > r-b` => error condition - /// + /// /// 2) If `indices_shape[-1] == r-b`, since the rank of `indices` is `q`, `indices` can be thought of as `N` `(q-b-1)`-dimensional tensors /// containing 1-D tensors of dimension `r-b`, where `N` is an integer equals to the product of 1 and all the elements in the batch dimensions /// of the indices_shape. Let us think of each such `r-b` ranked tensor as `indices_slice`. Each *scalar value* corresponding to `data[0:b-1,indices_slice]` /// is filled into the corresponding location of the `(q-b-1)`-dimensional tensor to form the `output` tensor (Example 1 below) - /// + /// /// 3) If `indices_shape[-1] < r-b`, since the rank of `indices` is `q`, `indices` can be thought of as `N` `(q-b-1)`-dimensional tensor /// containing 1-D tensors of dimension `< r-b`. Let us think of each such tensors as `indices_slice`. Each *tensor slice* corresponding /// to `data[0:b-1, indices_slice , :]` is filled into the corresponding location of the `(q-b-1)`-dimensional tensor /// to form the `output` tensor (Examples 2, 3, 4 and 5 below) - /// + /// /// This operator is the inverse of `ScatterND`. - /// + /// /// **Example 1** - /// + /// /// ``` /// batch_dims = 0 /// data = [[0,1],[2,3]] # data_shape = [2, 2] /// indices = [[0,0],[1,1]] # indices_shape = [2, 2] /// output = [0,3] # output_shape = [2] /// ``` - /// + /// /// **Example 2** - /// + /// /// ``` /// batch_dims = 0 /// data = [[0,1],[2,3]] # data_shape = [2, 2] /// indices = [[1],[0]] # indices_shape = [2, 1] /// output = [[2,3],[0,1]] # output_shape = [2, 2] /// ``` - /// + /// /// **Example 3** - /// + /// /// ``` /// batch_dims = 0 /// data = [[[0,1],[2,3]],[[4,5],[6,7]]] # data_shape = [2, 2, 2] /// indices = [[0,1],[1,0]] # indices_shape = [2, 2] /// output = [[2,3],[4,5]] # output_shape = [2, 2] /// ``` - /// + /// /// **Example 4** - /// + /// /// ``` /// batch_dims = 0 /// data = [[[0,1],[2,3]],[[4,5],[6,7]]] # data_shape = [2, 2, 2] /// indices = [[[0,1]],[[1,0]]] # indices_shape = [2, 1, 2] /// output = [[[2,3]],[[4,5]]] # output_shape = [2, 1, 2] /// ``` - /// + /// /// **Example 5** - /// + /// /// ``` /// batch_dims = 1 /// data = [[[0,1],[2,3]],[[4,5],[6,7]]] # data_shape = [2, 2, 2] @@ -1461,8 +1461,8 @@ public static Tensor GatherND(Tensor data, Tensor indices, Optio Object result = OnnxInterpreter.interpret(OnnxOps.GatherND.class, List.of(data, indices), List.of(batch_dims)); return (Tensor) result; } - - /// + + /// /// Gelu takes one input data (Tensor) and produces one /// output data (Tensor) where the gaussian error linear units function, /// $y = 0.5 * x * (1 + erf(x/sqrt(2)))$ is applied to the tensor elementwise. @@ -1473,13 +1473,13 @@ public static Tensor Gelu(Tensor X, Optional approximate) { Object result = OnnxInterpreter.interpret(OnnxOps.Gelu.class, List.of(X), List.of(approximate)); return (Tensor) result; } - + /// General Matrix multiplication: /// https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3 - /// + /// /// * A' = transpose(A) if transA else A /// * B' = transpose(B) if transB else B - /// + /// /// Compute Y = alpha * A' * B' + beta * C, where input tensor A has shape (M, K) or (K, M), /// input tensor B has shape (K, N) or (N, K), input tensor C is broadcastable to shape (M, N), /// and output tensor Y has shape (M, N). A will be transposed before doing the @@ -1490,8 +1490,8 @@ public static Tensor Gemm(Tensor A, Tensor B, Optional> C Object result = OnnxInterpreter.interpret(OnnxOps.Gemm.class, List.of(A, B, C), List.of(alpha, transB, beta, transA)); return (Tensor) result; } - - /// + + /// /// GlobalAveragePool consumes an input tensor X and applies average pooling across /// the values in the same channel. This is equivalent to AveragePool with kernel size /// equal to the spatial dimension of input tensor. @@ -1499,8 +1499,8 @@ public static Tensor GlobalAveragePool(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.GlobalAveragePool.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// GlobalLpPool consumes an input tensor X and applies lp pool pooling across /// the values in the same channel. This is equivalent to LpPool with kernel size /// equal to the spatial dimension of input tensor. @@ -1508,8 +1508,8 @@ public static Tensor GlobalLpPool(Tensor X, Optional p) { Object result = OnnxInterpreter.interpret(OnnxOps.GlobalLpPool.class, List.of(X), List.of(p)); return (Tensor) result; } - - /// + + /// /// GlobalMaxPool consumes an input tensor X and applies max pooling across /// the values in the same channel. This is equivalent to MaxPool with kernel size /// equal to the spatial dimension of input tensor. @@ -1517,12 +1517,12 @@ public static Tensor GlobalMaxPool(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.GlobalMaxPool.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Gradient operator computes the partial derivatives of a specific tensor w.r.t. /// some other tensors. This operator is widely used in gradient-based training /// algorithms. To illustrate its use, let's consider a computation graph, - /// + /// /// ``` /// X -----. /// | @@ -1532,12 +1532,12 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// Z /// ``` - /// + /// /// , where W and Z are trainable tensors. Note that operators' attributes are /// omitted for the sake of simplicity. Let dY/dW (dY/dZ) be the gradient of /// Y with respect to W (Z). The user can compute gradient by inserting Gradient /// operator to form another graph shown below. - /// + /// /// ``` /// W --> Conv --> H --> Gemm --> Y /// | ^ ^ @@ -1554,21 +1554,21 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---------------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// By definition, the tensor "y" is a function of independent variables in "xs" /// and "zs". Since we only compute the gradient of "y" w.r.t. the differentiable /// variables in "xs", this Gradient only outputs dY/dW and dY/dZ. Note that "H" /// cannot appear in "xs" and "zs". The reason is that "H" can be determined by /// tensors "W" and "X" and therefore "H" is not an independent variable. - /// + /// /// All outputs are optional. If needed, for example, user can assign an empty /// string to the 1st output name of that Gradient to skip the generation of dY/dW. /// Note that the concept of optional outputs can also be found in ONNX's RNN, GRU, /// and LSTM. - /// + /// /// Gradient operator can compute derivative against intermediate tensors. For /// example, the gradient of Y with respect to H can be done via - /// + /// /// ``` /// W --> Conv --> H --> Gemm --> Y /// ^ | ^ @@ -1584,20 +1584,20 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---------------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// It is possible to represent high-order differentiation using Gradient operators. /// For example, given the following linear model: - /// + /// /// ``` /// W --> Gemm --> Y --> Loss --> O /// ^ ^ /// | | /// X L /// ``` - /// + /// /// To compute the 2nd order derivative of O with respect to W (denoted by /// d^2O/dW^2), one can do - /// + /// /// ``` /// W --> Gemm --> Y --> Loss --> O /// | ^ ^ @@ -1615,20 +1615,20 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '---> d^2O/dW^2 (2nd output of Gradient) /// ``` - /// + /// /// The tensors named in attributes "xs", "zs", and "y" define the differentiated /// computation graph, and the inputs to Gradient node define the values at /// which the gradient is computed. We can feed different tensors to the identified /// graph. For example, one can compute the gradient of Y with respect to H at /// a specific value of H, H_1, by providing that value as an input to the Gradient /// node. - /// + /// /// ``` /// W --> Conv --> H --> Gemm --> Y /// ^ ^ /// | | /// X Z - /// + /// /// Z_1 (2nd input of Gradient) /// | /// v @@ -1636,7 +1636,7 @@ public static Tensor GlobalMaxPool(Tensor X) { /// | /// '------------------------------> dY/dZ (2nd output of Gradient) /// ``` - /// + /// /// When the inputs of Gradient are the tensors named in "xs" and "zs", the /// computation can be optimized. More specifically, intermediate variables in /// forward pass can be reused if the gradient is computed via reverse-mode @@ -1645,43 +1645,43 @@ public static List> Gradient(List> Inputs, String Object result = OnnxInterpreter.interpret(OnnxOps.Gradient.class, List.of(Inputs), List.of(y, zs, xs)); return (List>) result; } - - /// + + /// /// Returns the tensor resulted from performing the `greater` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Greater(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Greater.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `greater_equal` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor GreaterOrEqual(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.GreaterOrEqual.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Given an input `X` and a flow-field `grid`, computes the output `Y` using `X` values and pixel locations from the `grid`. /// For spatial input `X` with shape (N, C, H, W), the `grid` will have shape (N, H_out, W_out, 2), /// the output `Y` will have shape (N, C, H_out, W_out). For volumetric input `X` with shape (N, C, D, H, W), /// the `grid` will have shape (N, D_out, H_out, W_out, 3), the output `Y` will have shape (N, C, D_out, H_out, W_out). /// More generally, for an input `X` of rank r+2 with shape (N, C, d1, d2, ..., dr), /// the `grid` will have shape (N, D1_out, D2_out, ..., Dr_out, r), the output `Y` will have shape (N, C, D1_out, D2_out, ..., Dr_out). - /// + /// /// The tensor `X` contains values at centers of square pixels (voxels, etc) locations such as (n, c, d1_in, d2_in, ..., dr_in). /// The (n, d1_out, d2_out, ..., dr_out, :) values from the tensor `grid` are the normalized positions for interpolating the values /// at the (n, c, d1_out, d2_out, ..., dr_out) locations from the output tensor `Y` using a specified interpolation method (the mode) /// and a padding mode (for `grid` positions falling outside the 2-dimensional image). - /// + /// /// For example, the values in `grid[n, h_out, w_out, :]` are size-2 vectors specifying normalized positions in the 2-dimensional space of `X`. /// They are used to interpolate output values of `Y[n, c, h_out, w_out]`. - /// + /// /// The GridSample operator is often used in doing grid generator and sampler in the /// [Spatial Transformer Networks](https://arxiv.org/abs/1506.02025). /// See also in [torch.nn.functional.grid_sample](https://pytorch.org/docs/stable/generated/torch.nn.functional.grid_sample.html). @@ -1689,11 +1689,11 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti Object result = OnnxInterpreter.interpret(OnnxOps.GridSample.class, List.of(X, grid), List.of(mode, align_corners, padding_mode)); return (Tensor) result; } - - /// + + /// /// A GroupNormalization function. Carries out group normalization as described in /// the paper https://arxiv.org/abs/1803.08494 - /// + /// /// This operator transforms input according to /// ``` /// y = scale * (x - mean) / sqrt(variance + epsilon) + bias, @@ -1702,7 +1702,7 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti /// `scale` and `bias` should be specified for each channel. The number of /// groups `num_groups` should be divisible by the number of channels so that there are /// an equal number of channels per group. - /// + /// /// The overall computation has two stages: the first stage normalizes the elements to /// have zero mean and unit variance for each instance in each group, and the second /// stage scales and shifts the results of the first stage. The floating-point precision @@ -1710,7 +1710,7 @@ public static Tensor GridSample(Tensor X, Tensor grid, Opti /// if `stash_type` is 1, the operator casts all input variables to 32-bit float, /// performs the computation, and finally casts the normalized results back to the /// original type of `X`. The second stage does not depend on `stash_type`. - /// + /// /// When the number of groups is the same as the number of channels, this operator is /// equivalent to InstanceNormalization. When there is only one group, this operator /// is equivalent to LayerNormalization. @@ -1718,22 +1718,22 @@ public static Tensor GroupNormalization(Tensor X, Tensor scale, Ten Object result = OnnxInterpreter.interpret(OnnxOps.GroupNormalization.class, List.of(X, scale, bias), List.of(epsilon, stash_type, num_groups)); return (Tensor) result; } - - /// + + /// /// Generates a Hamming window as described in the paper https://ieeexplore.ieee.org/document/1455106. public static Tensor HammingWindow(Tensor size, Optional periodic, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.HammingWindow.class, List.of(size), List.of(periodic, output_datatype)); return (Tensor) result; } - - /// + + /// /// Generates a Hann window as described in the paper https://ieeexplore.ieee.org/document/1455106. public static Tensor HannWindow(Tensor size, Optional periodic, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.HannWindow.class, List.of(size), List.of(periodic, output_datatype)); return (Tensor) result; } - - /// + + /// /// HardSigmoid takes one input data (Tensor) and produces one output data /// (Tensor) where the HardSigmoid function, y = max(0, min(1, alpha * x + beta)), /// is applied to the tensor elementwise. @@ -1741,8 +1741,8 @@ public static Tensor HardSigmoid(Tensor X, Optional alpha, Opti Object result = OnnxInterpreter.interpret(OnnxOps.HardSigmoid.class, List.of(X), List.of(alpha, beta)); return (Tensor) result; } - - /// + + /// /// HardSwish takes one input data (Tensor) and produces one output data (Tensor) where /// the HardSwish function, y = x * max(0, min(1, alpha * x + beta)) = x * HardSigmoid(x), /// where alpha = 1/6 and beta = 0.5, is applied to the tensor elementwise. @@ -1750,12 +1750,12 @@ public static Tensor HardSwish(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.HardSwish.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the hardmax values for the given input: - /// + /// /// Hardmax(element in input, axis) = 1 if the element is the first maximum value along the specified axis, 0 otherwise - /// + /// /// The "axis" attribute indicates the dimension along which Hardmax /// will be performed. The output tensor has the same shape /// and contains the Hardmax values of the corresponding input. @@ -1763,13 +1763,13 @@ public static Tensor Hardmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Hardmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - + /// Identity operator public static V Identity(V input) { Object result = OnnxInterpreter.interpret(OnnxOps.Identity.class, List.of(input), List.of()); return (V) result; } - + /// Loads and decodes and image from a file. If it can't decode for any reason (e.g. corrupted encoded /// stream, invalid format, it will return an empty matrix). /// The following image formats are supported: @@ -1797,8 +1797,8 @@ public static Tensor ImageDecoder(Tensor encoded_stream, Optional) result; } - - /// + + /// /// Replaces inputs that equal one value with another, leaving all other elements alone.
/// This operator is typically used to replace missing values in situations where they have a canonical /// representation, such as -1, 0, NaN, or some extreme value.
@@ -1811,53 +1811,53 @@ public static Tensor Imputer(Tensor X, Optional replaced_value_i Object result = OnnxInterpreter.interpret(OnnxOps.Imputer.class, List.of(X), List.of(replaced_value_int64, replaced_value_float, imputed_value_int64s, imputed_value_floats)); return (Tensor) result; } - - /// + + /// /// Carries out instance normalization as described in the paper /// https://arxiv.org/abs/1607.08022. - /// + /// /// y = scale * (x - mean) / sqrt(variance + epsilon) + B, /// where mean and variance are computed per instance per channel. public static Tensor InstanceNormalization(Tensor input, Tensor scale, Tensor B, Optional epsilon) { Object result = OnnxInterpreter.interpret(OnnxOps.InstanceNormalization.class, List.of(input, scale, B), List.of(epsilon)); return (Tensor) result; } - + /// Map infinity to true and other values to false. public static Tensor IsInf(Tensor X, Optional detect_negative, Optional detect_positive) { Object result = OnnxInterpreter.interpret(OnnxOps.IsInf.class, List.of(X), List.of(detect_negative, detect_positive)); return (Tensor) result; } - + /// Returns which elements of the input are NaN. public static Tensor IsNaN(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.IsNaN.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Local Response Normalization proposed in the [AlexNet paper](https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf). /// It normalizes over local input regions. /// The local region is defined across the channels. For an element `X[n, c, d1, ..., dk]` in a tensor /// of shape `(N x C x D1 x D2, ..., Dk)`, its region is /// `{X[n, i, d1, ..., dk] | max(0, c - floor((size - 1) / 2)) <= i <= min(C - 1, c + ceil((size - 1) / 2))}`. - /// + /// /// `square_sum[n, c, d1, ..., dk] = sum(X[n, i, d1, ..., dk] ^ 2)`, /// where `max(0, c - floor((size - 1) / 2)) <= i <= min(C - 1, c + ceil((size - 1) / 2))`. - /// + /// /// `Y[n, c, d1, ..., dk] = X[n, c, d1, ..., dk] / (bias + alpha / size * square_sum[n, c, d1, ..., dk] ) ^ beta` public static Tensor LRN(Tensor X, long size, Optional alpha, Optional bias, Optional beta) { Object result = OnnxInterpreter.interpret(OnnxOps.LRN.class, List.of(X), List.of(size, alpha, bias, beta)); return (Tensor) result; } - + public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } - /// + /// /// Computes an one-layer LSTM. This operator is usually supported via some /// custom implementation such as CuDNN. - /// + /// /// Notations: - /// + /// /// * `X` - input tensor /// * `i` - input gate /// * `o` - output gate @@ -1876,15 +1876,15 @@ public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } /// * `PB[iof]` - P peephole weight vector for backward input, output, and forget gates /// * `H` - Hidden state /// * `num_directions` - 2 if direction == bidirectional else 1 - /// + /// /// Activation functions: - /// + /// /// * Relu(x) - max(0, x) /// * Tanh(x) - (1 - e^{-2x})/(1 + e^{-2x}) /// * Sigmoid(x) - 1/(1 + e^{-x}) - /// + /// /// NOTE: Below are optional - /// + /// /// * Affine(x) - alpha*x + beta /// * LeakyRelu(x) - x if x >= 0 else alpha * x /// * ThresholdedRelu(x) - x if x >= alpha else 0 @@ -1893,9 +1893,9 @@ public record LSTMResult(Tensor Y, Tensor Y_h, Tensor Y_c) { } /// * Elu(x) - x if x >= 0 else alpha*(e^x - 1) /// * Softsign(x) - x/(1 + |x|) /// * Softplus(x) - log(1 + e^x) - /// + /// /// Equations (Default: f=Sigmoid, g=Tanh, h=Tanh): - /// + /// /// * it = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Pi (.) Ct-1 + Wbi + Rbi) /// * ft = f(Xt*(Wf^T) + Ht-1*(Rf^T) + Pf (.) Ct-1 + Wbf + Rbf) /// * ct = g(Xt*(Wc^T) + Ht-1*(Rc^T) + Wbc + Rbc) @@ -1908,8 +1908,8 @@ public static LSTMResult LSTM(Tensor X, Tensor W, Tensor R, Opti Object[] resultArray = (Object[]) result; return new LSTMResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// Maps each element in the input tensor to another value.
/// The mapping is determined by the two parallel attributes, 'keys_*' and /// 'values_*' attribute. The i-th value in the specified 'keys_*' attribute @@ -1933,9 +1933,9 @@ public static Tensor LabelEncoder(Tensor X, Optional Object result = OnnxInterpreter.interpret(OnnxOps.LabelEncoder.class, List.of(X), List.of(values_strings, keys_int64s, keys_tensor, keys_strings, default_float, keys_floats, default_tensor, default_int64, values_tensor, values_int64s, default_string, values_floats)); return (Tensor) result; } - + public record LayerNormalizationResult(Tensor Y, Tensor Mean, Tensor InvStdDev) { } - /// + /// /// This is layer normalization defined in ONNX as function. /// The overall computation can be split into two stages. /// The first stage is standardization, which makes the @@ -1982,8 +1982,8 @@ public static LayerNormalizationResult LayerNormalization(Tensor Object[] resultArray = (Object[]) result; return new LayerNormalizationResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2]); } - - /// + + /// /// LeakyRelu takes input data (Tensor) and an argument alpha, and produces one /// output data (Tensor) where the function `f(x) = alpha * x for x < 0`, /// `f(x) = x for x >= 0`, is applied to the data tensor elementwise. @@ -1991,50 +1991,50 @@ public static Tensor LeakyRelu(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.LeakyRelu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `less` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Less(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Less.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `less_equal` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor LessOrEqual(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.LessOrEqual.class, List.of(A, B), List.of()); return (Tensor) result; } - + public record LinearAttentionResult(Tensor output, Tensor present_state) { } - /// + /// /// Unified linear attention operator for autoregressive decoding (T=1) and prefill (T>1). - /// + /// /// The query, key, value, and (where applicable) decay/beta inputs use 3D packed format /// [B, T, H*D], where heads are flattened into the last dimension; q_num_heads and /// kv_num_heads are always required and are used to unpack to 4D internally for computation. /// The optional past_state and present_state are 4D with shape (B, H_kv, d_k, d_v). - /// + /// /// Group-query attention (GQA) is supported: q_num_heads must be a positive multiple of /// kv_num_heads. When q_num_heads == kv_num_heads this reduces to multi-headed linear /// attention; when q_num_heads > kv_num_heads each KV head (and its recurrent state) is /// shared by `q_num_heads / kv_num_heads` query heads (multi-query attention is the /// special case kv_num_heads == 1). - /// + /// /// The update_rule attribute selects the recurrence type: /// - "linear": S_t = S_{t-1} + k_t ⊗ v_t; o_t = scale * q_t^T S_t /// - "gated": S_t = exp(g_t) * S_{t-1} + k_t ⊗ v_t; o_t = scale * q_t^T S_t /// - "delta": S_t = S_{t-1} + β_t * k_t ⊗ (v_t - S_{t-1}^T k_t); o_t = scale * q_t^T S_t /// - "gated_delta": S_t = exp(g_t) * S_{t-1} + β_t * k_t ⊗ (v_t - exp(g_t) * S_{t-1}^T k_t); o_t = scale * q_t^T S_t - /// + /// /// where g_t is the decay (in log-space), β_t is the update rate, and ⊗ denotes outer product. - /// + /// /// Semantics: Equivalent to running the recurrent update sequentially for each token, /// but may be implemented using chunk-parallel algorithms for GPU efficiency. public static LinearAttentionResult LinearAttention(Tensor query, Tensor key, Tensor value, Optional> past_state, Optional> decay, Optional> beta, Optional chunk_size, Optional update_rule, Optional scale, long q_num_heads, long kv_num_heads) { @@ -2042,17 +2042,17 @@ public static LinearAttentionResult LinearAttention(Tensor query Object[] resultArray = (Object[]) result; return new LinearAttentionResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - + public record LinearClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// Linear classifier public static LinearClassifierResult LinearClassifier(Tensor X, Optional classlabels_ints, Optional post_transform, float[] coefficients, Optional multi_class, Optional intercepts, Optional classlabels_strings) { Object result = OnnxInterpreter.interpret(OnnxOps.LinearClassifier.class, List.of(X), List.of(classlabels_ints, post_transform, coefficients, multi_class, intercepts, classlabels_strings)); Object[] resultArray = (Object[]) result; return new LinearClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Generalized linear regression evaluation.
/// If targets is set to 1 (default) then univariate regression is performed.
/// If targets is set to M then M sets of coefficients must be passed in as a sequence @@ -2063,19 +2063,19 @@ public static Tensor LinearRegressor(Tensor X, Optional po Object result = OnnxInterpreter.interpret(OnnxOps.LinearRegressor.class, List.of(X), List.of(post_transform, coefficients, targets, intercepts)); return (Tensor) result; } - - /// + + /// /// Calculates the natural log of the given input tensor, element-wise. public static Tensor Log(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Log.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the log of softmax values for the given input: - /// + /// /// LogSoftmax(input, axis) = Log(Softmax(input, axis=axis)) - /// + /// /// The "axis" attribute indicates the dimension along which LogSoftmax /// will be performed. The output tensor has the same shape /// and contains the LogSoftmax values of the corresponding input. @@ -2083,8 +2083,8 @@ public static Tensor LogSoftmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.LogSoftmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Given a matrix, apply Lp-normalization along the provided axis. /// The output is computed as: `output = input / Lp_norm(input, axis)`. /// When the Lp norm is zero (i.e., all elements along the axis are zero), @@ -2093,8 +2093,8 @@ public static Tensor LpNormalization(Tensor input, Optional p, O Object result = OnnxInterpreter.interpret(OnnxOps.LpNormalization.class, List.of(input), List.of(p, axis)); return (Tensor) result; } - - /// + + /// /// LpPool consumes an input tensor X and applies Lp pooling across /// the tensor according to kernel sizes, stride sizes, and pad lengths. /// Lp pooling consisting of computing the Lp norm on all values of a subset @@ -2108,7 +2108,7 @@ public static Tensor LpNormalization(Tensor input, Optional p, O /// output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - {kernelSpatialShape}) / strides_spatial_shape[i] + 1) /// ``` /// if ceil_mode is enabled `pad_shape[i]` is the sum of pads along axis `i`. - /// + /// /// `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following: /// ``` /// VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - {kernelSpatialShape} + 1) / strides_spatial_shape[i]) @@ -2122,23 +2122,23 @@ public static Tensor LpPool(Tensor X, Optional p, Optional) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). public static Tensor MatMul(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.MatMul.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). /// The production MUST never overflow. The accumulation may overflow if and only if in 32 bits. public static Tensor MatMulInteger(Tensor A, Tensor B, Optional> a_zero_point, Optional> b_zero_point) { Object result = OnnxInterpreter.interpret(OnnxOps.MatMulInteger.class, List.of(A, B, a_zero_point, b_zero_point), List.of()); return (Tensor) result; } - - /// + + /// /// Element-wise max of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2146,9 +2146,9 @@ public static Tensor Max(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Max.class, List.of(data_0), List.of()); return (Tensor) result; } - + public record MaxPoolResult(Tensor Y, Tensor Indices) { } - /// + /// /// MaxPool consumes an input tensor X and applies max pooling across /// the tensor according to kernel sizes, stride sizes, and pad lengths. /// max pooling consisting of computing the max on all values of a @@ -2164,7 +2164,7 @@ public record MaxPoolResult(Tensor Y, Tensor Indices) { } /// output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - dilation[i] * (kernel_shape[i] - 1) - 1) / strides_spatial_shape[i] + 1) /// ``` /// if ceil_mode is enabled. `pad_shape[i]` is the sum of pads along axis `i`. Sliding windows that would start in the right padded region are ignored. - /// + /// /// `auto_pad` is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following when ceil_mode is enabled: /// ``` /// VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) + 1) / strides_spatial_shape[i]) @@ -2179,15 +2179,15 @@ public record MaxPoolResult(Tensor Y, Tensor Indices) { } /// ``` /// pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + ((kernel_spatial_shape[i] - 1) * dilations[i] + 1) - input_spatial_shape[i] /// ``` - /// The output of each pooling window is maximum number of elements exclude pad. - /// + /// The output of each pooling window is maximum number of elements exclude pad. + /// public static MaxPoolResult MaxPool(Tensor X, Optional pads, Optional dilations, Optional auto_pad, Optional ceil_mode, Optional storage_order, Optional strides, long[] kernel_shape) { Object result = OnnxInterpreter.interpret(OnnxOps.MaxPool.class, List.of(X), List.of(pads, dilations, auto_pad, ceil_mode, storage_order, strides, kernel_shape)); Object[] resultArray = (Object[]) result; return new MaxPoolResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// ROI max pool consumes an input tensor X and region of interests (RoIs) to /// apply max pooling across each RoI, to produce output 4-D tensor of shape /// (num_rois, channels, pooled_shape[0], pooled_shape[1]). @@ -2195,23 +2195,23 @@ public static Tensor MaxRoiPool(Tensor X, Tensor rois, Optional) result; } - - /// + + /// /// MaxUnpool essentially computes the partial inverse of the MaxPool op. /// The input information to this op is typically the output information from a MaxPool op. The first /// input tensor X is the tensor that needs to be unpooled, which is typically the pooled tensor (first output) /// from MaxPool. The second input tensor, I, contains the indices to the (locally maximal) elements corresponding /// to the elements in the first input tensor X. Input tensor I is typically the second output of the MaxPool op. /// The third (optional) input is a tensor that specifies the output size of the unpooling operation. - /// + /// /// MaxUnpool is intended to do 'partial' inverse of the MaxPool op. 'Partial' because all the non-maximal /// values from the original input to MaxPool are set to zero in the output of the MaxUnpool op. Pooling /// the result of an unpooling operation should give back the original input to the unpooling op. - /// + /// /// MaxUnpool can produce the same output size for several input sizes, which makes unpooling op ambiguous. /// The third input argument, output_size, is meant to disambiguate the op and produce output tensor of /// known/predictable size. - /// + /// /// In addition to the inputs, MaxUnpool takes three attributes, namely kernel_shape, strides, and pads, /// which define the exact unpooling op. The attributes typically have the same values as the corresponding /// pooling op that the unpooling op is trying to invert. @@ -2219,8 +2219,8 @@ public static Tensor MaxUnpool(Tensor X, Tensor I, Optional) result; } - - /// + + /// /// Element-wise mean of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2228,30 +2228,30 @@ public static Tensor Mean(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Mean.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// A MeanVarianceNormalization Function: Perform mean variance normalization /// on the input tensor X using formula: `(X-EX)/sqrt(E(X-EX)^2)` public static Tensor MeanVarianceNormalization(Tensor X, Optional axes) { Object result = OnnxInterpreter.interpret(OnnxOps.MeanVarianceNormalization.class, List.of(X), List.of(axes)); return (Tensor) result; } - - /// + + /// /// Generate a MelWeightMatrix that can be used to re-weight a Tensor containing a linearly sampled frequency spectra (from DFT or STFT) into num_mel_bins frequency information based on the [lower_edge_hertz, upper_edge_hertz] range on the mel scale. /// This function defines the mel scale in terms of a frequency in hertz according to the following formula: - /// + /// /// mel(f) = 2595 * log10(1 + f/700) - /// + /// /// In the returned matrix, all the triangles (filterbanks) have a peak value of 1.0. - /// + /// /// The returned MelWeightMatrix can be used to right-multiply a spectrogram S of shape [frames, num_spectrogram_bins] of linear scale spectrum values (e.g. STFT magnitudes) to generate a "mel spectrogram" M of shape [frames, num_mel_bins]. public static Tensor MelWeightMatrix(Tensor num_mel_bins, Tensor dft_length, Tensor sample_rate, Tensor lower_edge_hertz, Tensor upper_edge_hertz, Optional output_datatype) { Object result = OnnxInterpreter.interpret(OnnxOps.MelWeightMatrix.class, List.of(num_mel_bins, dft_length, sample_rate, lower_edge_hertz, upper_edge_hertz), List.of(output_datatype)); return (Tensor) result; } - - /// + + /// /// Element-wise min of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -2259,12 +2259,12 @@ public static Tensor Min(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Min.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// Mish: A Self Regularized Non-Monotonic Neural Activation Function. - /// + /// /// Perform the linear unit element-wise on the input tensor X using formula: - /// + /// /// ``` /// mish(x) = x * tanh(softplus(x)) = x * tanh(ln(1 + e^{x})) /// ``` @@ -2272,14 +2272,14 @@ public static Tensor Mish(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Mish.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Performs an element-wise binary modulo operation. /// The semantics and supported data types depend on the value of the `fmod` attribute which must be `0` (default), or `1`. - /// + /// /// If the `fmod` attribute is set to `0`, `T` is constrained to integer data types and the semantics follow that of the Python `%`-operator. /// The sign of the result is that of the divisor. - /// + /// /// If `fmod` is set to `1`, the behavior of this operator follows that of the `fmod` function in C and `T` is constrained to floating point data types. /// The result of this operator is the remainder of the division operation `x / y` where `x` and `y` are respective elements of `A` and `B`. The result is exactly the value `x - n * y`, where `n` is `x / y` with its fractional part truncated. /// The returned value has the same sign as `x` (except if `x` is `-0`) and is less or equal to `|y|` in magnitude. @@ -2289,20 +2289,20 @@ public static Tensor Mish(Tensor X) { /// - If `y` is `±0` and `x` is not `NaN`, `NaN` should be returned. /// - If `y` is `±∞` and `x` is finite, `x` is returned. /// - If either argument is `NaN`, `NaN` is returned. - /// + /// /// This operator supports **multidirectional (i.e., NumPy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Mod(Tensor A, Tensor B, Optional fmod) { Object result = OnnxInterpreter.interpret(OnnxOps.Mod.class, List.of(A, B), List.of(fmod)); return (Tensor) result; } - - /// + + /// /// Compute one iteration of stochastic gradient update with momentum. /// This operator can conduct the optimization of multiple tensor variables. - /// + /// /// Let's define the behavior of this operator. As you can imagine, SG with momentum requires /// several parameters: - /// + /// /// - The learning-rate "R". /// - The update count "T". That is, the number of conducted training iterations. It should /// be zero in the first training iteration. @@ -2311,48 +2311,48 @@ public static Tensor Mod(Tensor A, Tensor B, Optional fmod) { /// - The scaling coefficient of current gradient "beta". /// - An attribute to choose either standard momentum or Nesterov's momentum "mode" should /// be used. - /// + /// /// For the sake of simplicity, assume that there is only one tensor (called "X") to be optimized. /// Other necessary inputs are "X"'s gradient (called "G") and "X"'s momentum (called "V"). This /// Momentum operator maps all these inputs to the new value of "X" (called "X_new") and its new /// momentum (called "V_new"). - /// + /// /// This operator supports two different momentum algorithms. Set the attribute "mode" to /// "nesterov" if Nesterov's momentum is desired. Otherwise, set the attribute "model" to /// "standard" to use standard momentum. Computation details are described subsequently. - /// + /// /// Let "+", "-", "*", and "/" are all element-wise operations with numpy-style broadcasting. - /// + /// /// Pseudo code for SG with standard momentum: - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||^2, where ||X|| is the sum of squared /// // values of all elements in X. /// G_regularized = norm_coefficient * X + G - /// + /// /// // In the first training iteration, beta should always be 1. /// beta_adjusted = T > 0 ? beta : 1 - /// + /// /// // Compute the current momentum based on previous momentum and the current gradient. /// V_new = alpha * V + beta_adjusted * G_regularized - /// + /// /// // Update X. /// X_new = X - R * V_new - /// + /// /// Pseudo code for SG with Nesterov's momentum: - /// + /// /// // Add gradient of 0.5 * norm_coefficient * ||X||^2, where ||X|| is the sum of squared /// // values of all elements in X. /// G_regularized = norm_coefficient * X + G; - /// + /// /// // In the first training iteration, beta should always be 1. /// beta_adjusted = T > 0 ? beta : 1 - /// + /// /// // Compute the current momentum based on previous momentum and the current gradient. /// V_new = alpha * V + beta_adjusted * G_regularized; - /// + /// /// // Compute final update direction and then update X. /// X_new = X - R * (G_regularized + alpha * V_new) - /// + /// /// If one assign this operators to optimize multiple inputs, for example, "X_1" and "X_2". The same /// pseudo code would be extended to handle all tensors jointly. More specifically, we can view "X" as a /// concatenation of "X_1" and "X_2" (of course, their gradient and accumulate gradient should @@ -2361,27 +2361,27 @@ public static List> Momentum(Tensor R, Tensor T, L Object result = OnnxInterpreter.interpret(OnnxOps.Momentum.class, List.of(R, T, inputs), List.of(mode, norm_coefficient, alpha, beta)); return (List>) result; } - - /// + + /// /// Performs element-wise binary multiplication (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Mul(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Mul.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Generate a tensor of samples from a multinomial distribution according to the probabilities /// of each of the possible outcomes. public static Tensor Multinomial(Tensor input, Optional seed, Optional sample_size, Optional dtype) { Object result = OnnxInterpreter.interpret(OnnxOps.Multinomial.class, List.of(input), List.of(seed, sample_size, dtype)); return (Tensor) result; } - - /// + + /// /// Neg takes one input data (Tensor) and produces one output data /// (Tensor) where each element flipped sign, y = -x, is applied to /// the tensor elementwise. @@ -2389,70 +2389,70 @@ public static Tensor Neg(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Neg.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// A NegativeLogLikelihoodLoss operator computes (weighted) negative log likelihood loss. /// Its "input" tensor has the shape of (N, C, d1, d2, ..., dk) where k >= 0. /// The "input" tensor contains log-probabilities for input[n, :, d_1, d_2,..., d_k] being in a class of [0, C). /// The operator's "target" input tensor has the shape of (N, d1, d2, ..., dk). It encodes class labels (one of C classes) /// or it may contain a special value (indicated by an attribute ignore_index) for N x d1 x d2 x ... x dk samples. /// The loss value for input[n, :, d_1, d_2,...d_k] being classified as class c = target[n][d_1][d_2]...[d_k] is computed as: - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = -input[n][c][d_1][d_2]...[d_k]. /// ``` - /// + /// /// When an optional "weight" is provided, the sample loss is calculated as: - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = -input[n][c][d_1][d_2]...[d_k] * weight[c]. /// ``` - /// + /// /// loss is zero for the case when target-value equals ignore_index. - /// + /// /// ``` /// loss[n][d_1][d_2]...[d_k] = 0, when target[n][d_1][d_2]...[d_k] = ignore_index /// ``` - /// + /// /// If "reduction" attribute is set to "none", the operator's output will be the above loss with shape (N, d1, d2, ..., dk). /// If "reduction" attribute is set to "mean" (the default attribute value), the output loss is (weight) averaged: - /// + /// /// ``` /// mean(loss), if "weight" is not provided, /// ``` - /// + /// /// or if weight is provided, - /// + /// /// ``` /// sum(loss) / sum(weight[target[n][d_1][d_2]...[d_k]]]), for all samples. /// ``` - /// + /// /// If "reduction" attribute is set to "sum", the output is a scalar: `sum(loss)`. - /// + /// /// See also https://pytorch.org/docs/stable/nn.html#torch.nn.NLLLoss. - /// + /// /// Example 1: - /// + /// /// ``` /// // negative log likelihood loss, "none" reduction /// N, C, d1 = 2, 3, 2 /// input = [[[1.0, 2.0], [2.0, 2.0], [3.0, 2.0]], /// [[0.0, 1.0], [2.0, 2.0], [1.0, 2]]] /// target = [[2, 1], [0, 2]] - /// + /// /// loss = np.zeros((N, d1)) /// for n in range(N): /// for d_1 in range(d1): /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] - /// + /// /// // print(loss) /// // [[-3. -2.] /// // [-0. -2.]] /// ``` - /// + /// /// Example 2: - /// + /// /// ``` /// // weighted negative log likelihood loss, sum reduction /// N, C, d1 = 2, 3, 2 @@ -2465,14 +2465,14 @@ public static Tensor Neg(Tensor X) { /// for d_1 in range(d1): /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] * weight[c] - /// + /// /// loss = np.sum(loss) /// // print(loss) /// // -1.1 /// ``` - /// + /// /// Example 3: - /// + /// /// ``` /// // weighted negative log likelihood loss, mean reduction /// N, C, d1 = 2, 3, 2 @@ -2487,7 +2487,7 @@ public static Tensor Neg(Tensor X) { /// c = target[n][d_1] /// loss[n][d_1] = -input[n][c][d_1] * weight[c] /// weight_total = weight_total + weight[c] - /// + /// /// loss = np.sum(loss) / weight_total /// // print(loss) /// // -1.57 @@ -2496,8 +2496,8 @@ public static Tensor NegativeLogLikelihoodLoss(Tensor input, Ten Object result = OnnxInterpreter.interpret(OnnxOps.NegativeLogLikelihoodLoss.class, List.of(input, target, weight), List.of(ignore_index, reduction)); return (Tensor) result; } - - /// + + /// /// Filter out boxes that have high intersection-over-union (IOU) overlap with previously selected boxes. /// Bounding boxes with score less than score_threshold are removed. Bounding box format is indicated by attribute center_point_box. /// Boxes are suppressed if their IOU with a previously selected box is strictly greater than iou_threshold (i.e., boxes with IOU exactly equal to the threshold are kept). @@ -2510,8 +2510,8 @@ public static Tensor NonMaxSuppression(Tensor boxes, Tensor Object result = OnnxInterpreter.interpret(OnnxOps.NonMaxSuppression.class, List.of(boxes, scores, max_output_boxes_per_class, iou_threshold, score_threshold), List.of(center_point_box)); return (Tensor) result; } - - /// + + /// /// Returns the indices of the elements that are non-zero /// (in row-major order - by dimension). /// NonZero behaves similar to numpy.nonzero: @@ -2521,8 +2521,8 @@ public static Tensor NonZero(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.NonZero.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Normalize the input. There are three normalization modes, which have the corresponding formulas, /// defined using element-wise infix operators '/' and '^' and tensor-wide functions 'max' and 'sum':
///
@@ -2537,15 +2537,15 @@ public static Tensor Normalizer(Tensor X, Optional norm) { Object result = OnnxInterpreter.interpret(OnnxOps.Normalizer.class, List.of(X), List.of(norm)); return (Tensor) result; } - - /// + + /// /// Returns the negation of the input tensor element-wise. public static Tensor Not(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Not.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Produces a one-hot tensor based on inputs. /// The locations represented by the index values in the 'indices' input tensor will have 'on_value' /// and the other locations will have 'off_value' in the output tensor, where 'on_value' and 'off_value' @@ -2558,18 +2558,18 @@ public static Tensor Not(Tensor X) { /// as the type of the 'values' input. Any entries in the 'indices' input tensor with values outside /// the range [-depth, depth-1] will result in one-hot representation with all 'off_value' values in the /// output tensor. - /// + /// /// when axis = 0: /// output[input[i, j, k], i, j, k] = 1 for all i, j, k and 0 otherwise. - /// + /// /// when axis = -1: /// output[i, j, k, input[i, j, k]] = 1 for all i, j, k and 0 otherwise. public static Tensor OneHot(Tensor indices, Tensor depth, Tensor values, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.OneHot.class, List.of(indices, depth, values), List.of(axis)); return (Tensor) result; } - - /// + + /// /// Replace each input element with an array of ones and zeros, where a single /// one is placed at the index of the category that was passed in. The total category count /// will determine the size of the extra dimension of the output array Y.
@@ -2582,16 +2582,16 @@ public static Tensor OneHotEncoder(Tensor X, Optional ca Object result = OnnxInterpreter.interpret(OnnxOps.OneHotEncoder.class, List.of(X), List.of(cats_strings, cats_int64s, zeros)); return (Tensor) result; } - - /// + + /// /// Constructs an optional-type value containing either an empty optional of a certain type specified by the attribute, /// or a non-empty value containing the input element. public static Optional Optional(Optional input, Optional type) { Object result = OnnxInterpreter.interpret(OnnxOps.Optional.class, List.of(input), List.of(type)); return (Optional) result; } - - /// + + /// /// If the input is a tensor or sequence type, it returns the input. /// If the input is an optional type, it outputs the element in the input. /// It is an error if the input is an empty optional-type (i.e. does not have an element) and the behavior is undefined in this case. @@ -2599,8 +2599,8 @@ public static V OptionalGetElement(O input) { Object result = OnnxInterpreter.interpret(OnnxOps.OptionalGetElement.class, List.of(input), List.of()); return (V) result; } - - /// + + /// /// Returns true if (1) the input is an optional-type and contains an element, /// or, (2) the input is a tensor or sequence type. /// If the input is not provided or is an empty optional-type, this op returns false. @@ -2608,18 +2608,18 @@ public static Tensor OptionalHasElement(Optional input) { Object result = OnnxInterpreter.interpret(OnnxOps.OptionalHasElement.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `or` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Or(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Or.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// PRelu takes input data (Tensor) and slope tensor as input, and produces one /// output data (Tensor) where the function `f(x) = slope * x for x < 0`, /// `f(x) = x for x >= 0`., is applied to the data tensor elementwise. @@ -2628,99 +2628,99 @@ public static Tensor PRelu(Tensor X, Tensor slope) { Object result = OnnxInterpreter.interpret(OnnxOps.PRelu.class, List.of(X, slope), List.of()); return (Tensor) result; } - - /// + + /// /// Given a tensor containing the data to be padded (`data`), a tensor containing the number of start and end pad values for axis (`pads`), (optionally) a `mode`, and (optionally) `constant_value`, /// a padded tensor (`output`) is generated. - /// + /// /// The four supported `modes` are (similar to corresponding modes supported by `numpy.pad`): - /// + /// /// 1) `constant`(default) - pads with a given constant value as specified by `constant_value` (which defaults to 0, empty string, or False) - /// + /// /// 2) `reflect` - pads with the reflection of the vector mirrored on the first and last values of the vector along each axis - /// + /// /// 3) `edge` - pads with the edge values of array - /// + /// /// 4) `wrap` - wrap-around padding as if the data tensor forms a torus - /// - /// + /// + /// /// Example 1 (`constant` mode): - /// + /// /// Insert 0 pads to the beginning of the second dimension. - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'constant' - /// + /// /// constant_value = 0.0 - /// + /// /// output = [ /// [0.0, 0.0, 1.0, 1.2], /// [0.0, 0.0, 2.3, 3.4], /// [0.0, 0.0, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 2 (`reflect` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'reflect' - /// + /// /// output = [ /// [1.0, 1.2, 1.0, 1.2], /// [2.3, 3.4, 2.3, 3.4], /// [4.5, 5.7, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 3 (`edge` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [0, 2, 0, 0] - /// + /// /// mode = 'edge' - /// + /// /// output = [ /// [1.0, 1.0, 1.0, 1.2], /// [2.3, 2.3, 2.3, 3.4], /// [4.5, 4.5, 4.5, 5.7], /// ] /// ``` - /// + /// /// Example 4 (`wrap` mode): - /// + /// /// ``` /// data = [ /// [1.0, 1.2], /// [2.3, 3.4], /// [4.5, 5.7], /// ] - /// + /// /// pads = [2, 1, 1, 1] - /// + /// /// mode = 'wrap' - /// + /// /// output = [ /// [3.4, 2.3, 3.4, 2.3], /// [5.7, 4.5, 5.7, 4.5], @@ -2734,8 +2734,8 @@ public static Tensor Pad(Tensor data, Tensor pads, Optiona Object result = OnnxInterpreter.interpret(OnnxOps.Pad.class, List.of(data, pads, constant_value, axes), List.of(mode)); return (Tensor) result; } - - /// + + /// /// Pow takes input data (Tensor) and exponent Tensor, and /// produces one output data (Tensor) where the function `f(x) = x^exponent`, /// is applied to the data tensor elementwise. @@ -2744,8 +2744,8 @@ public static Tensor Pow(Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.Pow.class, List.of(X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// The convolution operator consumes a quantized input tensor, its scale and zero point, /// a quantized filter, its scale and zero point, and output's scale and zero point, /// and computes the quantized output. Each scale and zero-point pair must have same shape. @@ -2757,8 +2757,8 @@ public static Tensor QLinearConv(Tensor x, Tensor x_ Object result = OnnxInterpreter.interpret(OnnxOps.QLinearConv.class, List.of(x, x_scale, x_zero_point, w, w_scale, w_zero_point, y_scale, y_zero_point, B), List.of(pads, dilations, auto_pad, strides, group, kernel_shape)); return (Tensor) result; } - - /// + + /// /// Matrix product that behaves like [numpy.matmul](https://numpy.org/doc/stable/reference/generated/numpy.matmul.html). /// It consumes two quantized input tensors, their scales and zero points, scale and zero point of output, /// and computes the quantized output. The quantization formula is y = saturate((x / y_scale) + y_zero_point). @@ -2774,12 +2774,12 @@ public static Tensor QLinearMatMul(Tensor a, Tensor Object result = OnnxInterpreter.interpret(OnnxOps.QLinearMatMul.class, List.of(a, a_scale, a_zero_point, b, b_scale, b_zero_point, y_scale, y_zero_point), List.of()); return (Tensor) result; } - - /// + + /// /// The linear quantization operator consumes a high-precision tensor, a scale, and a zero point to compute the /// low-precision/quantized tensor. The scale factor and zero point must have the same shape, determining the quantization /// granularity. The quantization formula is `y = saturate((x / y_scale) + y_zero_point)`. - /// + /// /// Saturation is done according to: /// - uint16: [0, 65535] /// - int16: [-32768, 32767] @@ -2789,14 +2789,14 @@ public static Tensor QLinearMatMul(Tensor a, Tensor /// - int4: [-8, 7] /// - uint2: [0, 3] /// - int2: [-2, 1] - /// + /// /// For `(x / y_scale)`, it rounds to the nearest even. Refer to https://en.wikipedia.org/wiki/Rounding for details. - /// + /// /// `y_zero_point` and `y` must have the same type. `y_zero_point` is usually not used for quantization to float8 and 4bit types, but the quantization /// formula remains the same for consistency, and the type of the attribute `y_zero_point` still determines the quantization type. /// `x` and `y_scale` are allowed to have different types. The type of `y_scale` determines the precision of the division operation between `x` and /// `y_scale`, unless the `precision` attribute is specified. - /// + /// /// There are three supported quantization granularities, determined by the shape of `y_scale`. /// In all cases, `y_zero_point` must have the same shape as `y_scale`. /// - Per-tensor (per-layer) quantization: `y_scale` is a scalar. @@ -2809,8 +2809,8 @@ public static Tensor QuantizeLinear(Tensor x, Tensor y_ Object result = OnnxInterpreter.interpret(OnnxOps.QuantizeLinear.class, List.of(x, y_scale, y_zero_point), List.of(output_dtype, saturate, precision, axis, block_size)); return (Tensor) result; } - - /// + + /// /// This is RMS normalization defined in ONNX as function as described in the paper https://arxiv.org/pdf/1910.07467. /// The overall computation can be split into two stages. The root mean squared norm is taken over the last D dimensions, /// where D is the dimension of normalized_shape. For example, if normalized_shape is (3, 5) (a 2-dimensional shape), @@ -2843,14 +2843,14 @@ public static Tensor RMSNormalization(Tensor X, Tensor scale, Op Object result = OnnxInterpreter.interpret(OnnxOps.RMSNormalization.class, List.of(X, scale), List.of(epsilon, stash_type, axis)); return (Tensor) result; } - + public record RNNResult(Tensor Y, Tensor Y_h) { } - /// + /// /// Computes an one-layer simple RNN. This operator is usually supported /// via some custom implementation such as CuDNN. - /// + /// /// Notations: - /// + /// /// * `X` - input tensor /// * `i` - input gate /// * `t` - time step (t-1 means previous time step) @@ -2864,15 +2864,15 @@ public record RNNResult(Tensor Y, Tensor Y_h) { } /// * `RBbi` - RR bias vectors for backward input gate /// * `H` - Hidden state /// * `num_directions` - 2 if direction == bidirectional else 1 - /// + /// /// Activation functions: - /// + /// /// * Relu(x) - max(0, x) /// * Tanh(x) - (1 - e^{-2x})/(1 + e^{-2x}) /// * Sigmoid(x) - 1/(1 + e^{-x}) - /// + /// /// NOTE: Below are optional - /// + /// /// * Affine(x) - alpha*x + beta /// * LeakyRelu(x) - x if x >= 0 else alpha * x /// * ThresholdedRelu(x) - x if x >= alpha else 0 @@ -2881,9 +2881,9 @@ public record RNNResult(Tensor Y, Tensor Y_h) { } /// * Elu(x) - x if x >= 0 else alpha*(e^x - 1) /// * Softsign(x) - x/(1 + |x|) /// * Softplus(x) - log(1 + e^x) - /// + /// /// Equations (Default: f=Tanh): - /// + /// /// * Ht = f(Xt*(Wi^T) + Ht-1*(Ri^T) + Wbi + Rbi) /// This operator has **optional** inputs/outputs. See [the doc](IR.md) for more details about the representation of optional arguments. An empty string may be used in the place of an actual argument's name to indicate a missing argument. Trailing optional arguments (those not followed by an argument that is present) may also be simply omitted. public static RNNResult RNN(Tensor X, Tensor W, Tensor R, Optional> B, Optional> sequence_lens, Optional> initial_h, Optional layout, Optional activation_alpha, Optional hidden_size, Optional activation_beta, Optional activations, Optional clip, Optional direction) { @@ -2891,12 +2891,12 @@ public static RNNResult RNN(Tensor X, Tensor W, Tensor R, Option Object[] resultArray = (Object[]) result; return new RNNResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Generate a tensor with random values drawn from a normal distribution. The shape /// of the tensor is specified by the `shape` argument and the parameter of the normal distribution /// specified by `mean` and `scale`. - /// + /// /// The data type is specified by the 'dtype' argument. The 'dtype' argument must /// be one of the data types specified in the 'DataType' enum field in the /// TensorProto message. @@ -2904,12 +2904,12 @@ public static Tensor RandomNormal(long[] shape, Optional seed, Opt Object result = OnnxInterpreter.interpret(OnnxOps.RandomNormal.class, List.of(), List.of(shape, seed, mean, scale, dtype)); return (Tensor) result; } - - /// + + /// /// Generate a tensor with random values drawn from a normal distribution. /// The shape of the output tensor is copied from the shape of the input tensor, /// and the parameters of the normal distribution are specified by `mean` and `scale`. - /// + /// /// The data type is specified by the 'dtype' argument, or copied from the input tensor if not provided. /// The 'dtype' argument must be one of the data types specified in the 'DataType' enum field in the /// TensorProto message, and be valid as an output type. @@ -2917,11 +2917,11 @@ public static Tensor RandomNormalLike(Tensor input, Optional) result; } - - /// + + /// /// Generate a tensor with random values drawn from a uniform distribution. The shape /// of the tensor is specified by the `shape` argument and the range by `low` and `high`. - /// + /// /// The data type is specified by the 'dtype' argument. The 'dtype' argument must /// be one of the data types specified in the 'DataType' enum field in the /// TensorProto message. @@ -2929,12 +2929,12 @@ public static Tensor RandomUniform(Optional high, long[] shape, Op Object result = OnnxInterpreter.interpret(OnnxOps.RandomUniform.class, List.of(), List.of(high, shape, seed, low, dtype)); return (Tensor) result; } - - /// + + /// /// Generate a tensor with random values drawn from a uniform distribution. /// The shape of the output tensor is copied from the shape of the input tensor, /// and the parameters of the uniform distribution are specified by `low` and `high`. - /// + /// /// The data type is specified by the 'dtype' argument, or copied from the input tensor if not provided. /// The 'dtype' argument must be one of the data types specified in the 'DataType' enum field in the /// TensorProto message and be valid as an output type. @@ -2942,11 +2942,11 @@ public static Tensor RandomUniformLike(Tensor input, Optional) result; } - - /// + + /// /// Generate a tensor containing a sequence of numbers that begin at `start` and extends by increments of `delta` /// up to `limit` (exclusive). - /// + /// /// The number of elements in the output of range is computed as below: /// ``` /// number_of_elements = max( ceil( (limit - start) / delta ) , 0 ) @@ -2967,7 +2967,7 @@ public static Tensor RandomUniformLike(Tensor input, Optional Tensor Range(Tensor start, Tensor limit, Tensor de Object result = OnnxInterpreter.interpret(OnnxOps.Range.class, List.of(start, limit, delta), List.of(stash_type)); return (Tensor) result; } - - /// + + /// /// Reciprocal takes one input data (Tensor) and produces one output data /// (Tensor) where the reciprocal is, y = 1/x, is applied to /// the tensor elementwise. @@ -2986,158 +2986,158 @@ public static Tensor Reciprocal(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Reciprocal.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Computes the L1 norm of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceL1(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceL1.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the L2 norm of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceL2(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceL2.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the log sum of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or undefined otherwise. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceLogSum(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceLogSum.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the log sum exponent of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or undefined otherwise. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceLogSumExp(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceLogSumExp.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the max of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields minus infinity (if supported by the datatype) or the minimum value of the data type otherwise. - /// - /// + /// + /// /// If the input data type is Boolean, the comparison should consider `False < True`. - /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMax(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMax.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the mean of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields undefined. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMean(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMean.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the min of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields plus infinity (if supported by the datatype) or the maximum value of the data type otherwise. - /// - /// + /// + /// /// If the input data type is Boolean, the comparison should consider `False < True`. - /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceMin(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceMin.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the product of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 1. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceProd(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceProd.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the sum of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceSum(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceSum.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - - /// + + /// /// Computes the sum square of the input tensor's elements along the provided axes. The resulting /// tensor has the same rank as the input if `keepdims` equals 1. If `keepdims` equals 0, then /// the resulting tensor has the reduced dimension pruned. Input tensors of rank zero are /// valid. Reduction over an empty set of values yields 0. - /// - /// + /// + /// /// The above behavior is similar to numpy, with the exception that numpy defaults `keepdims` /// to `False` instead of `True`. public static Tensor ReduceSumSquare(Tensor data, Optional> axes, Optional noop_with_empty_axes, Optional keepdims) { Object result = OnnxInterpreter.interpret(OnnxOps.ReduceSumSquare.class, List.of(data, axes), List.of(noop_with_empty_axes, keepdims)); return (Tensor) result; } - + /// RegexFullMatch performs a full regex match on each element of the input tensor. If an element fully matches the regex pattern specified as an attribute, the corresponding element in the output is True and it is False otherwise. [RE2](https://github.com/google/re2/wiki/Syntax) regex syntax is used. public static Tensor RegexFullMatch(Tensor X, Optional pattern) { Object result = OnnxInterpreter.interpret(OnnxOps.RegexFullMatch.class, List.of(X), List.of(pattern)); return (Tensor) result; } - - /// + + /// /// Relu takes one input data (Tensor) and produces one output data /// (Tensor) where the rectified linear function, y = max(0, x), is applied to /// the tensor elementwise. @@ -3145,8 +3145,8 @@ public static Tensor Relu(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Relu.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Reshape the input tensor similar to numpy.reshape. /// First input is the data tensor, second input is a shape tensor which specifies the output shape. It outputs the reshaped tensor. /// At most one dimension of the new shape can be -1. In this case, the value is @@ -3156,7 +3156,7 @@ public static Tensor Relu(Tensor X) { /// dimension will be set explicitly to zero (i.e. not taken from input tensor). /// Shape (second input) could be an empty shape, which means converting to a scalar. /// The input tensor's shape and the output tensor's shape are required to have the same number of elements. - /// + /// /// If the attribute 'allowzero' is set, it is invalid for the specified shape to /// contain both a zero value and -1, as the value of the dimension corresponding /// to -1 cannot be determined uniquely. @@ -3164,8 +3164,8 @@ public static Tensor Reshape(Tensor data, Tensor shape, Optional Object result = OnnxInterpreter.interpret(OnnxOps.Reshape.class, List.of(data, shape), List.of(allowzero)); return (Tensor) result; } - - /// + + /// /// Resize the input tensor. In general, it calculates every value in the output tensor as a weighted average of neighborhood (a.k.a. sampling locations) in the input tensor. /// Each dimension value of the output tensor is: /// ``` @@ -3176,14 +3176,14 @@ public static Tensor Resize(Tensor X, Optional> roi, Object result = OnnxInterpreter.interpret(OnnxOps.Resize.class, List.of(X, roi, scales, sizes), List.of(mode, extrapolation_value, nearest_mode, antialias, cubic_coeff_a, axes, coordinate_transformation_mode, keep_aspect_ratio_policy, exclude_outside)); return (Tensor) result; } - - /// + + /// /// Reverse batch of sequences having different lengths specified by `sequence_lens`. - /// + /// /// For each slice i iterating on batch axis, the operator reverses the first sequence_lens[i] elements on time axis, /// and copies elements whose index's beyond sequence_lens[i] to the output. So the output slice i contains reversed /// sequences on the first sequence_lens[i] elements, then have original values copied for the other elements. - /// + /// /// Example 1: /// input = [[0.0, 4.0, 8.0, 12.0], /// [1.0, 5.0, 9.0, 13.0], @@ -3192,12 +3192,12 @@ public static Tensor Resize(Tensor X, Optional> roi, /// sequence_lens = [4, 3, 2, 1] /// time_axis = 0 /// batch_axis = 1 - /// + /// /// output = [[3.0, 6.0, 9.0, 12.0], /// [2.0, 5.0, 8.0, 13.0], /// [1.0, 4.0, 10.0, 14.0], /// [0.0, 7.0, 11.0, 15.0]] - /// + /// /// Example 2: /// input = [[0.0, 1.0, 2.0, 3.0 ], /// [4.0, 5.0, 6.0, 7.0 ], @@ -3206,7 +3206,7 @@ public static Tensor Resize(Tensor X, Optional> roi, /// sequence_lens = [1, 2, 3, 4] /// time_axis = 1 /// batch_axis = 0 - /// + /// /// output = [[0.0, 1.0, 2.0, 3.0 ], /// [5.0, 4.0, 6.0, 7.0 ], /// [10.0, 9.0, 8.0, 11.0], @@ -3215,14 +3215,14 @@ public static Tensor ReverseSequence(Tensor input, Tensor sequen Object result = OnnxInterpreter.interpret(OnnxOps.ReverseSequence.class, List.of(input, sequence_lens), List.of(time_axis, batch_axis)); return (Tensor) result; } - - /// + + /// /// Region of Interest (RoI) align operation described in the /// [Mask R-CNN paper](https://arxiv.org/abs/1703.06870). /// RoiAlign consumes an input tensor X and region of interests (rois) /// to apply pooling across each RoI; it produces a 4-D tensor of shape /// (num_rois, C, output_height, output_width). - /// + /// /// RoiAlign is proposed to avoid the misalignment by removing /// quantizations while converting from original image into feature /// map and from feature map into RoI feature; in each ROI bin, @@ -3232,21 +3232,21 @@ public static Tensor RoiAlign(Tensor X, Tensor rois, Tensor) result; } - - /// + + /// /// RotaryEmbedding is the implementation of rotary positional embeddings (RoPE) based on the paper https://arxiv.org/pdf/2104.09864. /// The key advantage of RoPE is that it allows the model to understand both the absolute position of a token and the relative distances /// between tokens. This is achieved through a rotational mechanism where the extent of rotation is computed based on the token's absolute position (position_ids). - /// + /// /// The rotational mechanism is defined by sine and cosine functions that are used to represent the rotation angles. /// For each token in the sequence, its positional embedding is computed by rotating its embedding vector. This is done by splitting the /// embedding vector either into two halves or interleaving every alternate token and applying the rotation matrix to each half of the embedding vector. /// The rotation matrix is parameterized by the token's position in the sequence. The rotated halves of the embedding vector are concatenated /// to form the final positional embedding for each token. The rotated positional embeddings are used in the self-attention mechanism. /// The rotation ensures that the model captures both absolute and relative positional information. - /// + /// /// Rotary embeddings are defined using the following algorithm: - /// + /// /// ```python /// def rotary_embedding( /// input: np.ndarray, @@ -3271,7 +3271,7 @@ public static Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RoiAlign(Tensor X, Tensor rois, Tensor Tensor RotaryEmbedding(Tensor X, Tensor cos_cache, Te Object result = OnnxInterpreter.interpret(OnnxOps.RotaryEmbedding.class, List.of(X, cos_cache, sin_cache, position_ids), List.of(num_heads, rotary_embedding_dim, interleaved)); return (Tensor) result; } - - /// + + /// /// Round takes one input Tensor and rounds the values, element-wise, meaning /// it finds the nearest integer for each value. /// In case of halves, the rule is to round them to the nearest even integer. /// If input x is integral, +0, -0, NaN, or infinite, x itself is returned. /// The output tensor has the same shape and type as the input. - /// + /// /// Examples: /// ``` /// round([0.9]) = [1.0] @@ -3358,61 +3358,61 @@ public static Tensor Round(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Round.class, List.of(X), List.of()); return (Tensor) result; } - + /// Computes the Short-time Fourier Transform of the signal. public static Tensor STFT(Tensor signal, Tensor frame_step, Optional> window, Optional> frame_length, Optional onesided) { Object result = OnnxInterpreter.interpret(OnnxOps.STFT.class, List.of(signal, frame_step, window, frame_length), List.of(onesided)); return (Tensor) result; } - + public record SVMClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// Support Vector Machine classifier public static SVMClassifierResult SVMClassifier(Tensor X, Optional prob_b, Optional kernel_params, Optional kernel_type, Optional classlabels_ints, Optional post_transform, Optional rho, Optional coefficients, Optional support_vectors, Optional vectors_per_class, Optional prob_a, Optional classlabels_strings) { Object result = OnnxInterpreter.interpret(OnnxOps.SVMClassifier.class, List.of(X), List.of(prob_b, kernel_params, kernel_type, classlabels_ints, post_transform, rho, coefficients, support_vectors, vectors_per_class, prob_a, classlabels_strings)); Object[] resultArray = (Object[]) result; return new SVMClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Support Vector Machine regression prediction and one-class SVM anomaly detection. public static Tensor SVMRegressor(Tensor X, Optional kernel_type, Optional kernel_params, Optional n_supports, Optional rho, Optional post_transform, Optional coefficients, Optional support_vectors, Optional one_class) { Object result = OnnxInterpreter.interpret(OnnxOps.SVMRegressor.class, List.of(X), List.of(kernel_type, kernel_params, n_supports, rho, post_transform, coefficients, support_vectors, one_class)); return (Tensor) result; } - - /// + + /// /// Rescale input data, for example to standardize features by removing the mean and scaling to unit variance. public static Tensor Scaler(Tensor X, Optional offset, Optional scale) { Object result = OnnxInterpreter.interpret(OnnxOps.Scaler.class, List.of(X), List.of(offset, scale)); return (Tensor) result; } - - /// + + /// /// This operator is deprecated. Please use ScatterElements, which provides the same functionality. - /// + /// /// Scatter takes three inputs `data`, `updates`, and `indices` of the same /// rank r >= 1 and an optional attribute axis that identifies an axis of `data` /// (by default, the outer-most axis, that is axis 0). The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value /// to values specified by `updates` at specific index positions specified by /// `indices`. Its output shape is the same as the shape of `data`. - /// + /// /// For each entry in `updates`, the target index in `data` is obtained by combining /// the corresponding entry in `indices` with the index of the entry itself: the /// index-value for dimension = axis is obtained from the value of the corresponding /// entry in `indices` and the index-value for dimension != axis is obtained from the /// index of the entry itself. - /// + /// /// For instance, in a 2-D tensor case, the update corresponding to the [i][j] entry /// is performed as below: /// ``` /// output[indices[i][j]][j] = updates[i][j] if axis = 0, /// output[i][indices[i][j]] = updates[i][j] if axis = 1, /// ``` - /// + /// /// This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation. - /// + /// /// Example 1: /// ``` /// data = [ @@ -3446,21 +3446,21 @@ public static Tensor Scatter(Tensor data, Tensor indices, Object result = OnnxInterpreter.interpret(OnnxOps.Scatter.class, List.of(data, indices, updates), List.of(axis)); return (Tensor) result; } - - /// + + /// /// ScatterElements takes three inputs `data`, `updates`, and `indices` of the same /// rank r >= 1 and an optional attribute axis that identifies an axis of `data` /// (by default, the outer-most axis, that is axis 0). The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value /// to values specified by `updates` at specific index positions specified by /// `indices`. Its output shape is the same as the shape of `data`. - /// + /// /// For each entry in `updates`, the target index in `data` is obtained by combining /// the corresponding entry in `indices` with the index of the entry itself: the /// index-value for dimension = axis is obtained from the value of the corresponding /// entry in `indices` and the index-value for dimension != axis is obtained from the /// index of the entry itself. - /// + /// /// `reduction` allows specification of an optional reduction operation, which is applied to all values in `updates` /// tensor into `output` at the specified `indices`. /// In cases where `reduction` is set to "none", indices should not have duplicate entries: that is, if idx1 != idx2, @@ -3476,11 +3476,11 @@ public static Tensor Scatter(Tensor data, Tensor indices, /// output[i][indices[i][j]] = f(output[i][indices[i][j]], updates[i][j]) if axis = 1, /// ``` /// where the `f` is `+`, `*`, `max` or `min` as specified. - /// + /// /// This operator is the inverse of GatherElements. It is similar to Torch's Scatter operation. - /// + /// /// (Opset 18 change): Adds max/min to the set of allowed reduction ops. - /// + /// /// Example 1: /// ``` /// data = [ @@ -3514,21 +3514,21 @@ public static Tensor ScatterElements(Tensor data, Tensor i Object result = OnnxInterpreter.interpret(OnnxOps.ScatterElements.class, List.of(data, indices, updates), List.of(reduction, axis)); return (Tensor) result; } - - /// + + /// /// ScatterND takes three inputs `data` tensor of rank r >= 1, `indices` tensor of rank q >= 1, /// and `updates` tensor of rank q + r - indices.shape[-1] - 1. The output of the operation /// is produced by creating a copy of the input `data`, and then updating its value to values /// specified by `updates` at specific index positions specified by `indices`. Its output shape /// is the same as the shape of `data`. - /// + /// /// `indices` is an integer tensor. Let k denote indices.shape[-1], the last dimension in the shape of `indices`. /// `indices` is treated as a (q-1)-dimensional tensor of k-tuples, where each k-tuple is a partial-index into `data`. /// Hence, k can be a value at most the rank of `data`. When k equals rank(data), each update entry specifies an /// update to a single element of the tensor. When k is less than rank(data) each update entry specifies an /// update to a slice of the tensor. Index values are allowed to be negative, as per the usual /// convention for counting backwards from the end, but are expected in the valid range. - /// + /// /// `updates` is treated as a (q-1)-dimensional tensor of replacement-slice-values. Thus, the /// first (q-1) dimensions of updates.shape must match the first (q-1) dimensions of indices.shape. /// The remaining dimensions of `updates` correspond to the dimensions of the @@ -3536,39 +3536,39 @@ public static Tensor ScatterElements(Tensor data, Tensor i /// corresponding to the trailing (r-k) dimensions of `data`. Thus, the shape of `updates` /// must equal indices.shape[0:q-1] ++ data.shape[k:r-1], where ++ denotes the concatenation /// of shapes. - /// + /// /// The `output` is calculated via the following equation: - /// + /// /// ``` /// output = np.copy(data) /// update_indices = indices.shape[:-1] /// for idx in np.ndindex(update_indices): /// output[tuple(indices[idx])] = updates[idx] /// ``` - /// + /// /// The order of iteration in the above loop is not specified. /// In particular, indices should not have duplicate entries: that is, if idx1 != idx2, then indices[idx1] != indices[idx2]. /// This ensures that the output value does not depend on the iteration order. - /// + /// /// `reduction` allows specification of an optional reduction operation, which is applied to all values in `updates` /// tensor into `output` at the specified `indices`. /// In cases where `reduction` is set to "none", indices should not have duplicate entries: that is, if idx1 != idx2, /// then indices[idx1] != indices[idx2]. This ensures that the output value does not depend on the iteration order. /// When `reduction` is set to some reduction function `f`, `output` is calculated as follows: - /// + /// /// ``` /// output = np.copy(data) /// update_indices = indices.shape[:-1] /// for idx in np.ndindex(update_indices): /// output[tuple(indices[idx])] = f(output[tuple(indices[idx])], updates[idx]) /// ``` - /// + /// /// where the `f` is `+`, `*`, `max` or `min` as specified. - /// + /// /// This operator is the inverse of GatherND. - /// + /// /// (Opset 18 change): Adds max/min to the set of allowed reduction ops. - /// + /// /// Example 1: /// ``` /// data = [1, 2, 3, 4, 5, 6, 7, 8] @@ -3576,7 +3576,7 @@ public static Tensor ScatterElements(Tensor data, Tensor i /// updates = [9, 10, 11, 12] /// output = [1, 11, 3, 10, 9, 6, 7, 12] /// ``` - /// + /// /// Example 2: /// ``` /// data = [[[1, 2, 3, 4], [5, 6, 7, 8], [8, 7, 6, 5], [4, 3, 2, 1]], @@ -3595,8 +3595,8 @@ public static Tensor ScatterND(Tensor data, Tensor indices, Tens Object result = OnnxInterpreter.interpret(OnnxOps.ScatterND.class, List.of(data, indices, updates), List.of(reduction)); return (Tensor) result; } - - /// + + /// /// Selu takes one input data (Tensor) and produces one output data /// (Tensor) where the scaled exponential linear unit function, /// `y = gamma * (alpha * e^x - alpha) for x <= 0`, `y = gamma * x for x > 0`, @@ -3605,8 +3605,8 @@ public static Tensor Selu(Tensor X, Optional alpha, Optional) result; } - - /// + + /// /// Outputs a tensor copy from the tensor at 'position' in 'input_sequence'. /// Accepted range for 'position' is in `[-n, n - 1]`, where `n` is the number of tensors in 'input_sequence'. /// Negative value means counting positions from the back. @@ -3614,23 +3614,23 @@ public static Tensor SequenceAt(List> input_sequence, Ten Object result = OnnxInterpreter.interpret(OnnxOps.SequenceAt.class, List.of(input_sequence, position), List.of()); return (Tensor) result; } - - /// + + /// /// Construct a tensor sequence containing 'inputs' tensors. /// All tensors in 'inputs' must have the same data type. public static List> SequenceConstruct(List> inputs) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceConstruct.class, List.of(inputs), List.of()); return (List>) result; } - - /// + + /// /// Construct an empty tensor sequence, with given data type. public static List> SequenceEmpty(Optional dtype) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceEmpty.class, List.of(), List.of(dtype)); return (List>) result; } - - /// + + /// /// Outputs a tensor sequence that removes the tensor at 'position' from 'input_sequence'. /// Accepted range for 'position' is in `[-n, n - 1]`, where `n` is the number of tensors in 'input_sequence'. /// Negative value means counting positions from the back. @@ -3639,8 +3639,8 @@ public static List> SequenceErase(List> input_sequenc Object result = OnnxInterpreter.interpret(OnnxOps.SequenceErase.class, List.of(input_sequence, position), List.of()); return (List>) result; } - - /// + + /// /// Outputs a tensor sequence that inserts 'tensor' into 'input_sequence' at 'position'. /// 'tensor' must have the same data type as 'input_sequence'. /// Accepted range for 'position' is in `[-n, n]`, where `n` is the number of tensors in 'input_sequence'. @@ -3650,15 +3650,15 @@ public static List> SequenceInsert(List> input_seq Object result = OnnxInterpreter.interpret(OnnxOps.SequenceInsert.class, List.of(input_sequence, tensor, position), List.of()); return (List>) result; } - - /// + + /// /// Produces a scalar(tensor of empty shape) containing the number of tensors in 'input_sequence'. public static Tensor SequenceLength(List> input_sequence) { Object result = OnnxInterpreter.interpret(OnnxOps.SequenceLength.class, List.of(input_sequence), List.of()); return (Tensor) result; } - - /// + + /// /// Takes a tensor as input and outputs an 1D int64 tensor containing the shape of the input tensor. /// Optional attributes start and end can be used to compute a slice of the input tensor's shape. /// If start axis is omitted, the slice starts from axis 0. @@ -3670,27 +3670,27 @@ public static Tensor SequenceLength(List> input_sequence) { /// negative axis). Thus, specifying any end value > r is equivalent to specifying an end /// value of r, and specifying any start value < -r is equivalent to specifying a start /// value of 0. If start > end, the result will be an empty shape. - /// + /// /// Examples: - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// No attributes specified. /// Output: [2, 3, 4] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// start: -1 /// Output: [4] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// end: -1 /// Output: [2, 3] /// ``` - /// + /// /// ``` /// Input tensor with shape: [2, 3, 4] /// start: 1 @@ -3701,8 +3701,8 @@ public static Tensor Shape(Tensor data, Optional start, Optio Object result = OnnxInterpreter.interpret(OnnxOps.Shape.class, List.of(data), List.of(start, end)); return (Tensor) result; } - - /// + + /// /// Shrink takes one input data (Tensor) and produces one Tensor output, /// having same datatype and shape with input. It has two attributes, lambd and /// bias. The formula of this operator is: If x < -lambd, y = x + bias; @@ -3711,8 +3711,8 @@ public static Tensor Shrink(Tensor input, Optional lambd, Optio Object result = OnnxInterpreter.interpret(OnnxOps.Shrink.class, List.of(input), List.of(lambd, bias)); return (Tensor) result; } - - /// + + /// /// Sigmoid takes one input data (Tensor) and produces one output data /// (Tensor) where the sigmoid function, y = 1 / (1 + exp(-x)), is applied to the /// tensor elementwise. @@ -3720,72 +3720,72 @@ public static Tensor Sigmoid(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Sigmoid.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Calculate the sign of the given input tensor element-wise. /// If input > 0, output 1. if input < 0, output -1. if input == 0, output 0. public static Tensor Sign(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sign.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the sine of the given input tensor, element-wise. public static Tensor Sin(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sin.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic sine of the given input tensor element-wise. public static Tensor Sinh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Sinh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Takes a tensor as input and outputs a int64 scalar that equals to the total number of elements of the input tensor. public static Tensor Size(Tensor data) { Object result = OnnxInterpreter.interpret(OnnxOps.Size.class, List.of(data), List.of()); return (Tensor) result; } - - /// + + /// /// Produces a slice of the input tensor along multiple axes. Similar to numpy: /// https://numpy.org/doc/stable/user/basics.indexing.html?highlight=slice#slicing-and-striding - /// + /// /// Slice uses the `starts`, `ends`, `axes` and `steps` inputs to select a sub-tensor /// of its input `data` tensor. - /// + /// /// An effective `starts[i]`, `ends[i]`, and `steps[i]` must be computed for each `i` /// in `[0, ... r-1]` where `r = rank(input)` as follows: - /// + /// /// If `axes` are omitted, they are set to `[0, ..., r-1]`. /// If `steps` are omitted, they are set to `[1, ..., 1]` of length `len(starts)` - /// + /// /// The effective values are initialized as `start[i] = 0`, `ends[i] = dims[i]` where /// `dims` are the dimensions of `input` and `steps[i] = 1`. - /// + /// /// All negative elements of `axes` are made non-negative by adding `r` to them, where /// `r =rank(input)`. - /// + /// /// All negative values in `starts[i]` and `ends[i]` have `dims[axes[i]]` added to them, /// where `dims` are the dimensions of `input`. Then `start[axes[i]]` is the adjusted /// `starts[i]` is clamped into the range `[0, dims[axes[i]]]` for positive stepping /// and `[0, dims[axes[i]]-1]` for negative stepping. - /// + /// /// The clamping for the adjusted `ends[i]` depends on the sign of `steps[i]` and must /// accommodate copying 0 through `dims[axes[i]]` elements, so for positive stepping /// `ends[axes[i]]` is clamped to `[0, dims[axes[i]]]`, while for negative stepping it /// is clamped to `[-1, dims[axes[i]]-1]`. - /// + /// /// Finally, `steps[axes[i]] = steps[i]`. - /// + /// /// For slicing to the end of a dimension with unknown size, it is recommended to pass /// in `INT_MAX` when slicing forward and 'INT_MIN' when slicing backward. - /// + /// /// Example 1: - /// + /// /// ``` /// data = [ /// [1, 2, 3, 4], @@ -3799,9 +3799,9 @@ public static Tensor Size(Tensor data) { /// [5, 7], /// ] /// ``` - /// + /// /// Example 2: - /// + /// /// ``` /// data = [ /// [1, 2, 3, 4], @@ -3817,12 +3817,12 @@ public static Tensor Slice(Tensor data, Tensor starts, Ten Object result = OnnxInterpreter.interpret(OnnxOps.Slice.class, List.of(data, starts, ends, axes, steps), List.of()); return (Tensor) result; } - - /// + + /// /// The operator computes the normalized exponential values for the given input: - /// - /// Softmax(input, axis) = Exp(input) / ReduceSum(Exp(input), axis=axis, keepdims=1) - /// + /// + /// Softmax(input, axis) = Exp(input) / ReduceSum(Exp(input), axis=axis, keepdims=1) + /// /// The "axis" attribute indicates the dimension along which Softmax /// will be performed. The output tensor has the same shape /// and contains the Softmax values of the corresponding input. @@ -3830,7 +3830,7 @@ public static Tensor Softmax(Tensor input, Optional axis) { Object result = OnnxInterpreter.interpret(OnnxOps.Softmax.class, List.of(input), List.of(axis)); return (Tensor) result; } - + public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_prob) { } /// Loss function that measures the softmax cross entropy /// between 'scores' and 'labels'. @@ -3839,12 +3839,12 @@ public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_p /// If the input is N-D tensor with shape (N, C, D1, D2, ..., Dk), /// the loss tensor L may have (N, D1, D2, ..., Dk) as its shape and L[i,][j_1][j_2]...[j_k] denotes a scalar element in L. /// After L is available, this operator can optionally do a reduction operator. - /// + /// /// * shape(scores): (N, C) where C is the number of classes, or (N, C, D1, D2,..., Dk), /// with K >= 1 in case of K-dimensional loss. /// * shape(labels): (N) where each value is 0 <= labels[i] <= C-1, or (N, D1, D2,..., Dk), /// with K >= 1 in case of K-dimensional loss. - /// + /// /// The loss for one sample, l_i, can calculated as follows: /// ``` /// l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk], where i is the index of classes. @@ -3853,21 +3853,21 @@ public record SoftmaxCrossEntropyLossResult(Tensor output, Tensor log_p /// ``` /// l[i][d1][d2]...[dk] = -y[i][c][d1][d2]..[dk] * weights[c], if 'weights' is provided. /// ``` - /// + /// /// loss is zero for the case when label-value equals ignore_index. /// ``` /// l[i][d1][d2]...[dk] = 0, when labels[n][d1][d2]...[dk] = ignore_index /// ``` - /// + /// /// where: /// ``` /// p = Softmax(scores) /// y = Log(p) /// c = labels[i][d1][d2]...[dk] /// ``` - /// + /// /// Finally, L is optionally reduced: - /// + /// /// * If reduction = 'none', the output is L with shape (N, D1, D2, ..., Dk). /// * If reduction = 'sum', the output is scalar: Sum(L). /// * If reduction = 'mean', the output is scalar: ReduceMean(L), or if weight is provided: `ReduceSum(L) / ReduceSum(W)`, @@ -3877,8 +3877,8 @@ public static SoftmaxCrossEntropyLossResult SoftmaxCrossEntropyLoss Object[] resultArray = (Object[]) result; return new SoftmaxCrossEntropyLossResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Softplus takes one input data (Tensor) and produces one output data /// (Tensor) where the softplus function, y = ln(exp(x) + 1), is applied to /// the tensor elementwise. @@ -3886,14 +3886,14 @@ public static Tensor Softplus(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Softplus.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the softsign (x/(1+|x|)) of the given input tensor element-wise. public static Tensor Softsign(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Softsign.class, List.of(input), List.of()); return (Tensor) result; } - + /// SpaceToDepth rearranges blocks of spatial data into depth. More specifically, /// this op outputs a copy of the input tensor where values from the height and width dimensions /// are moved to the depth dimension. @@ -3901,7 +3901,7 @@ public static Tensor SpaceToDepth(Tensor input, long blocksize) { Object result = OnnxInterpreter.interpret(OnnxOps.SpaceToDepth.class, List.of(input), List.of(blocksize)); return (Tensor) result; } - + /// Split a tensor into a list of tensors, along the specified 'axis'. /// Either input 'split' or the attribute 'num_outputs' should be specified, but not both. /// If the attribute 'num_outputs' is specified, then the tensor is split into equal sized parts. @@ -3911,8 +3911,8 @@ public static List> Split(Tensor input, Optional> Object result = OnnxInterpreter.interpret(OnnxOps.Split.class, List.of(input, split), List.of(num_outputs, axis)); return (List>) result; } - - /// + + /// /// Split a tensor into a sequence of tensors, along the specified 'axis'. /// Lengths of the parts can be specified using the optional argument 'split'. /// If the argument `split' is not specified, a default scalar value of 1 @@ -3929,8 +3929,8 @@ public static List> SplitToSequence(Tensor input, Optiona Object result = OnnxInterpreter.interpret(OnnxOps.SplitToSequence.class, List.of(input, split), List.of(keepdims, axis)); return (List>) result; } - - /// + + /// /// Square root takes one input data (Tensor) and produces one output data /// (Tensor) where the square root is, y = x^0.5, is applied to /// the tensor elementwise. If x is negative, then it will return NaN. @@ -3938,8 +3938,8 @@ public static Tensor Sqrt(Tensor X) { Object result = OnnxInterpreter.interpret(OnnxOps.Sqrt.class, List.of(X), List.of()); return (Tensor) result; } - - /// + + /// /// Remove single-dimensional entries from the shape of a tensor. /// Takes an input `axes` with a list of axes to squeeze. /// If `axes` is not provided, all the single dimensions will be removed from @@ -3948,14 +3948,14 @@ public static Tensor Squeeze(Tensor data, Optional> axes) Object result = OnnxInterpreter.interpret(OnnxOps.Squeeze.class, List.of(data, axes), List.of()); return (Tensor) result; } - + /// StringConcat concatenates string tensors elementwise (with NumPy-style broadcasting support) public static Tensor StringConcat(Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.StringConcat.class, List.of(X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// StringNormalization performs string operations for basic cleaning. /// This operator has only one input (denoted by X) and only one output /// (denoted by Y). This operator first examines the elements in the X, @@ -3969,31 +3969,31 @@ public static Tensor StringNormalizer(Tensor X, Optional i Object result = OnnxInterpreter.interpret(OnnxOps.StringNormalizer.class, List.of(X), List.of(is_case_sensitive, locale, stopwords, case_change_action)); return (Tensor) result; } - + public record StringSplitResult(Tensor Y, Tensor Z) { } /// StringSplit splits a string tensor's elements into substrings based on a delimiter attribute and a maxsplit attribute. - /// + /// /// The first output of this operator is a tensor of strings representing the substrings from splitting each input string on the `delimiter` substring. This tensor has one additional rank compared to the input tensor in order to store the substrings for each input element (where the input tensor is not empty). Note that, in order to ensure the same number of elements are present in the final dimension, this tensor will pad empty strings as illustrated in the examples below. Consecutive delimiters are not grouped together and are deemed to delimit empty strings, except if the `delimiter` is unspecified or is the empty string (""). In the case where the `delimiter` is unspecified or the empty string, consecutive whitespace characters are regarded as a single separator and leading or trailing whitespace is removed in the output. - /// + /// /// The second output tensor represents the number of substrings generated. `maxsplit` can be used to limit the number of splits performed - after the `maxsplit`th split if the string is not fully split, the trailing suffix of input string after the final split point is also added. For elements where fewer splits are possible than specified in `maxsplit`, it has no effect. public static StringSplitResult StringSplit(Tensor X, Optional delimiter, Optional maxsplit) { Object result = OnnxInterpreter.interpret(OnnxOps.StringSplit.class, List.of(X), List.of(delimiter, maxsplit)); Object[] resultArray = (Object[]) result; return new StringSplitResult((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Performs element-wise binary subtraction (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). - /// + /// /// (Opset 14 change): Extend supported types to include uint8, int8, uint16, and int16. public static Tensor Sub(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Sub.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Element-wise sum of each of the input tensors (with Numpy-style broadcasting support). /// All inputs and outputs must have the same data type. /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). @@ -4001,42 +4001,42 @@ public static Tensor Sum(List> data_0) { Object result = OnnxInterpreter.interpret(OnnxOps.Sum.class, List.of(data_0), List.of()); return (Tensor) result; } - - /// + + /// /// Swish function takes one input data (Tensor) and produces one output data (Tensor) of the same shape, /// where $Swish(x) = x * sigmoid(alpha * x)$. public static Tensor Swish(Tensor X, Optional alpha) { Object result = OnnxInterpreter.interpret(OnnxOps.Swish.class, List.of(X), List.of(alpha)); return (Tensor) result; } - - /// + + /// /// Calculates the tangent of the given input tensor, element-wise. public static Tensor Tan(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Tan.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// Calculates the hyperbolic tangent of the given input tensor element-wise. public static Tensor Tanh(Tensor input) { Object result = OnnxInterpreter.interpret(OnnxOps.Tanh.class, List.of(input), List.of()); return (Tensor) result; } - - /// + + /// /// TensorScatter is a generic tensor update operation, motivated by the requirements for KV cache updates for Attention /// ops commonly found in LLMs. It is a functional operation that models an in-place update to a KV cache buffer. - /// + /// /// The past and present cache tensors have the same shape (batch_size, D1, D2, ..., max_sequence_length, ..., Dn), with /// the sequence dimension (indicated by the `axis` attribute) being max_sequence_length, so the sizes of these tensors do /// not need to grow between iterations. The `update` tensor's shape only differs from the cache tensors in the sequence /// dimension: (batch_size, D1, D2, ..., sequence_length, ..., Dn), where sequence_length <= max_sequence_length. - /// + /// /// The optional `write_indices` input indicates the write index for each sample in the batch, assumed to be zero /// if not provided. When the `mode` attribute is set to "circular", the write index is modulo max_sequence_length. /// The operation can be described using the following pseudocode: - /// + /// /// ``` /// for prefix_idx in np.ndindex(past_cache.shape[:axis]): /// batch_idx = prefix_idx[0] @@ -4047,7 +4047,7 @@ public static Tensor Tanh(Tensor input) { /// update_idx = (*prefix_idx, sequence_idx) /// present_cache[cache_idx] = update[update_idx] /// ``` - /// + /// /// During the prefill phase of attention, only the first two inputs are needed. During the decode phase, `write_indices` /// is also needed so that the incoming key or value update can be appended after the last valid token for each sample /// in the batch. @@ -4055,14 +4055,14 @@ public static Tensor TensorScatter(Tensor past_cache, Tensor update Object result = OnnxInterpreter.interpret(OnnxOps.TensorScatter.class, List.of(past_cache, update, write_indices), List.of(mode, axis)); return (Tensor) result; } - - /// + + /// /// This transform extracts n-grams from the input sequence and save them as a vector. Input can /// be either a 1-D or 2-D tensor. For 1-D input, output is the n-gram representation of that input. /// For 2-D input, the output is also a 2-D tensor whose i-th row is the n-gram representation of the i-th input row. /// More specifically, if input shape is [C], the corresponding output shape would be [max(ngram_indexes) + 1]. /// If input shape is [N, C], this operator produces a [N, max(ngram_indexes) + 1]-tensor. - /// + /// /// In contrast to standard n-gram extraction, here, the indexes of extracting an n-gram from the original /// sequence are not necessarily consecutive numbers. The discontinuity between indexes are controlled by the number of skips. /// If the number of skips is 2, we should skip two tokens when scanning through the original sequence. @@ -4070,26 +4070,26 @@ public static Tensor TensorScatter(Tensor past_cache, Tensor update /// The associated 2-grams are [94, 12] and [17, 28] respectively indexed by [0, 3] and [1, 4]. /// If the number of skips becomes 0, the 2-grams generated are [94, 17], [17, 36], [36, 12], [12, 28] /// indexed by [0, 1], [1, 2], [2, 3], [3, 4], respectively. - /// + /// /// The output vector (denoted by Y) stores the count of each n-gram; /// Y[ngram_indexes[i]] indicates the times that the i-th n-gram is found. The attribute ngram_indexes is used to determine the mapping /// between index i and the corresponding n-gram's output coordinate. If pool_int64s is [94, 17, 17, 36], ngram_indexes is [1, 0], /// ngram_counts=[0, 0], then the Y[0] (first element in Y) and Y[1] (second element in Y) are the counts of [17, 36] and [94, 17], /// respectively. An n-gram which cannot be found in pool_strings/pool_int64s should be ignored and has no effect on the output. /// Note that we may consider all skips up to S when generating the n-grams. - /// + /// /// The examples used above are true if mode is "TF". If mode is "IDF", all the counts larger than 1 would be truncated to 1 and /// the i-th element in weights would be used to scale (by multiplication) the count of the i-th n-gram in pool. If mode is "TFIDF", /// this operator first computes the counts of all n-grams and then scale them by the associated values in the weights attribute. - /// + /// /// Only one of pool_strings and pool_int64s can be set. If pool_int64s is set, the input should be an integer tensor. /// If pool_strings is set, the input must be a string tensor. public static Tensor TfIdfVectorizer(Tensor X, long[] ngram_counts, long min_gram_length, Optional pool_strings, String mode, long max_gram_length, long max_skip_count, Optional pool_int64s, Optional weights, long[] ngram_indexes) { Object result = OnnxInterpreter.interpret(OnnxOps.TfIdfVectorizer.class, List.of(X), List.of(ngram_counts, min_gram_length, pool_strings, mode, max_gram_length, max_skip_count, pool_int64s, weights, ngram_indexes)); return (Tensor) result; } - - /// + + /// /// ThresholdedRelu takes one input data (Tensor) and produces one output data /// (Tensor) where the rectified linear function, y = x for x > alpha, y = 0 otherwise, /// is applied to the tensor elementwise. @@ -4097,7 +4097,7 @@ public static Tensor ThresholdedRelu(Tensor X, Optional alpha) Object result = OnnxInterpreter.interpret(OnnxOps.ThresholdedRelu.class, List.of(X), List.of(alpha)); return (Tensor) result; } - + /// Constructs a tensor by tiling a given tensor. /// This is the same as function `tile` in Numpy, but no broadcast. /// For example A = [[1, 2], [3, 4]], B = [1, 2], tile(A, B) = [[1, 2, 1, 2], [3, 4, 3, 4]] @@ -4105,22 +4105,22 @@ public static Tensor Tile(Tensor input, Tensor repeats) { Object result = OnnxInterpreter.interpret(OnnxOps.Tile.class, List.of(input, repeats), List.of()); return (Tensor) result; } - + public record TopKResult(Tensor Values, Tensor Indices) { } - /// + /// /// Retrieve the top-K largest or smallest elements along a specified axis. Given an input tensor of /// shape [a_0, a_1, ..., a_{n-1}] and integer argument k, return two outputs: - /// + /// /// * Value tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}] /// which contains the values of the top k elements along the specified axis /// * Index tensor of shape [a_0, a_1, ..., a_{axis-1}, k, a_{axis+1}, ... a_{n-1}] which /// contains the indices of the top k elements (original indices from the input /// tensor). - /// + /// /// * If "largest" is 1 (the default value) then the k largest elements are returned. /// * If "sorted" is 1 (the default value) then the resulting k elements will be sorted. /// * If "sorted" is 0, order of returned 'Values' and 'Indices' are undefined. - /// + /// /// Given two equivalent values, this operator uses the indices along the axis as /// a tiebreaker. That is, the element with the lower index will appear first. public static TopKResult TopK(Tensor X, Tensor K, Optional largest, Optional sorted, Optional axis) { @@ -4128,8 +4128,8 @@ public static TopKResult TopK(Tensor X, Tensor K, Optional Object[] resultArray = (Object[]) result; return new TopKResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// Returns a transpose of the input tensor. (Similar to `numpy.transpose`). /// The optional attribute `perm` must be a permutation of the dimensions of /// the input tensor. Axis `i` of the output tensor corresponds to the axis @@ -4144,17 +4144,17 @@ public static Tensor Transpose(Tensor data, Optional perm) { Object result = OnnxInterpreter.interpret(OnnxOps.Transpose.class, List.of(data), List.of(perm)); return (Tensor) result; } - - /// + + /// /// Tree Ensemble operator. Returns the regressed values for each input in a batch. /// Inputs have dimensions `[N, F]` where `N` is the input batch size and `F` is the number of input features. /// Outputs have dimensions `[N, num_targets]` where `N` is the batch size and `num_targets` is the number of targets, which is a configurable attribute. - /// + /// /// The encoding of this attribute is split along interior nodes and the leaves of the trees. Notably, attributes with the prefix `nodes_*` are associated with interior nodes, and attributes with the prefix `leaf_*` are associated with leaves. /// The attributes `nodes_*` must all have the same length and encode a sequence of tuples, as defined by taking all the `nodes_*` fields at a given position. - /// + /// /// All fields prefixed with `leaf_*` represent tree leaves, and similarly define tuples of leaves and must have identical length. - /// + /// /// This operator can be used to implement both the previous `TreeEnsembleRegressor` and `TreeEnsembleClassifier` nodes. /// The `TreeEnsembleRegressor` node maps directly to this node and requires changing how the nodes are represented. /// The `TreeEnsembleClassifier` node can be implemented by adding a `ArgMax` node after this node to determine the top class. @@ -4163,9 +4163,9 @@ public static Tensor TreeEnsemble(Tensor X, Optional aggregate_f Object result = OnnxInterpreter.interpret(OnnxOps.TreeEnsemble.class, List.of(X), List.of(aggregate_function, nodes_hitrates, nodes_featureids, nodes_falseleafs, post_transform, nodes_trueleafs, nodes_modes, nodes_falsenodeids, nodes_truenodeids, leaf_weights, leaf_targetids, tree_roots, n_targets, nodes_missing_value_tracks_true, membership_values, nodes_splits)); return (Tensor) result; } - + public record TreeEnsembleClassifierResult(Tensor Y, Tensor Z) { } - /// + /// /// This operator is DEPRECATED. Please use TreeEnsemble with provides similar functionality. /// In order to determine the top class, the ArgMax node can be applied to the output of TreeEnsemble. /// To encode class labels, use a LabelEncoder operator. @@ -4185,8 +4185,8 @@ public static TreeEnsembleClassifierResult TreeEnsembleClassifier(T Object[] resultArray = (Object[]) result; return new TreeEnsembleClassifierResult<>((Tensor)resultArray[0], (Tensor)resultArray[1]); } - - /// + + /// /// This operator is DEPRECATED. Please use TreeEnsemble instead which provides the same /// functionality.
/// Tree Ensemble regressor. Returns the regressed values for each input in N.
@@ -4205,8 +4205,8 @@ public static Tensor TreeEnsembleRegressor(Tensor X, Optional) result; } - - /// + + /// /// Given a 2-D matrix or batches of 2-D matrices, returns the upper or lower triangular part of the tensor(s). /// The attribute "upper" determines whether the upper or lower part is retained. If set to true, /// the upper triangular matrix is retained. Lower triangular matrix is retained otherwise. @@ -4223,22 +4223,22 @@ public static Tensor Trilu(Tensor input, Optional> k, Opt Object result = OnnxInterpreter.interpret(OnnxOps.Trilu.class, List.of(input, k), List.of(upper)); return (Tensor) result; } - + public record UniqueResult(Tensor Y, Tensor indices, Tensor inverse_indices, Tensor counts) { } - /// + /// /// Find the unique elements of a tensor. When an optional attribute 'axis' is provided, unique subtensors sliced along the 'axis' are returned. /// Otherwise the input tensor is flattened and unique values of the flattened tensor are returned. - /// + /// /// This operator returns the unique values or sliced unique subtensors of the input tensor and three optional outputs. /// The first output tensor 'Y' contains all unique values or subtensors of the input. /// The second optional output tensor 'indices' contains indices of 'Y' elements' first occurrence in 'X'. /// The third optional output tensor 'inverse_indices' contains, for elements of 'X', its corresponding indices in 'Y'. /// The fourth optional output tensor 'counts' contains the count of each element of 'Y' in the input. - /// + /// /// Outputs are either sorted in ascending order or optionally in the order of the first occurrence of the values in the input. - /// + /// /// https://docs.scipy.org/doc/numpy/reference/generated/numpy.unique.html - /// + /// /// Example 1: /// ``` /// input_X = [2, 1, 1, 3, 4, 3] @@ -4249,7 +4249,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 1, 1, 2, 3, 2] /// output_counts = [1, 2, 2, 1] /// ``` - /// + /// /// Example 2: /// ``` /// input_X = [[1, 3], [2, 3]] @@ -4260,7 +4260,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 2, 1, 2] /// output_counts = [1, 1, 2] /// ``` - /// + /// /// Example 3: /// ``` /// input_X = [[1, 0, 0], [1, 0, 0], [2, 3, 4]] @@ -4271,7 +4271,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// output_inverse_indices = [0, 0, 1] /// output_counts = [2, 1] /// ``` - /// + /// /// Example 4: /// ``` /// input_x = [[[1., 1.], [0., 1.], [2., 1.], [0., 1.]], @@ -4279,7 +4279,7 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// attribute_sorted = 1 /// attribute_axis = 1 /// ``` - /// + /// /// intermediate data are presented below for better understanding: /// there are 4 subtensors sliced along axis 1 of input_x (shape = (2, 4, 2)): /// ``` @@ -4288,37 +4288,37 @@ public record UniqueResult(Tensor Y, Tensor indices, Tensor in /// [[2, 1], [2, 1]], /// [[0, 1], [0, 1]]. /// ``` - /// + /// /// there are 3 unique subtensors: /// ``` /// [[1, 1], [1, 1]], /// [[0, 1], [0, 1]], /// [[2, 1], [2, 1]]. /// ``` - /// + /// /// sorted unique subtensors: /// ``` /// B: [[0, 1], [0, 1]], /// [[1, 1], [1, 1]], /// [[2, 1], [2, 1]]. /// ``` - /// + /// /// output_Y is constructed from B: /// ``` /// [[[0. 1.], [1. 1.], [2. 1.]], /// [[0. 1.], [1. 1.], [2. 1.]]] /// ``` - /// + /// /// output_indices is to map from B to A: /// ``` /// [1, 0, 2] /// ``` - /// + /// /// output_inverse_indices is to map from A to B: /// ``` /// [1, 0, 2, 0] /// ``` - /// + /// /// output_counts: /// ``` /// [2, 1, 1] @@ -4328,14 +4328,14 @@ public static UniqueResult Unique(Tensor X, Optional sorted, Opt Object[] resultArray = (Object[]) result; return new UniqueResult<>((Tensor)resultArray[0], (Tensor)resultArray[1], (Tensor)resultArray[2], (Tensor)resultArray[3]); } - - /// + + /// /// Insert single-dimensional entries to the shape of an input tensor (`data`). /// Takes one required input `axes` - which contains a list of dimension indices and this operator will insert a dimension of value `1` into the corresponding index of the output tensor (`expanded`). - /// + /// /// For example, given an input tensor (`data`) of shape [3, 4, 5], then /// Unsqueeze(data, axes=[0, 4]) outputs a tensor (`expanded`) containing same data as `data` but with shape [1, 3, 4, 5, 1]. - /// + /// /// The input `axes` should not contain any duplicate entries. It is an error if it contains duplicates. /// The rank of the output tensor (`output_rank`) is the rank of the input tensor (`data`) plus the number of values in `axes`. /// Each value in `axes` should be within the (inclusive) range [-output_rank , output_rank - 1]. @@ -4344,8 +4344,8 @@ public static Tensor Unsqueeze(Tensor data, Tensor axes) { Object result = OnnxInterpreter.interpret(OnnxOps.Unsqueeze.class, List.of(data, axes), List.of()); return (Tensor) result; } - - /// + + /// /// Upsample the input tensor. /// Each dimension value of the output tensor is: /// output_dimension = floor(input_dimension * scale). @@ -4353,30 +4353,30 @@ public static Tensor Upsample(Tensor X, Tensor scales, Optional Object result = OnnxInterpreter.interpret(OnnxOps.Upsample.class, List.of(X, scales), List.of(mode)); return (Tensor) result; } - - /// + + /// /// Return elements, either from X or Y, depending on condition. /// Where behaves like /// [numpy.where](https://docs.scipy.org/doc/numpy/reference/generated/numpy.where.html) /// with three parameters. - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Where(Tensor condition, Tensor X, Tensor Y) { Object result = OnnxInterpreter.interpret(OnnxOps.Where.class, List.of(condition, X, Y), List.of()); return (Tensor) result; } - - /// + + /// /// Returns the tensor resulted from performing the `xor` logical operation /// elementwise on the input tensors `A` and `B` (with Numpy-style broadcasting support). - /// + /// /// This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check [the doc](Broadcasting.md). public static Tensor Xor(Tensor A, Tensor B) { Object result = OnnxInterpreter.interpret(OnnxOps.Xor.class, List.of(A, B), List.of()); return (Tensor) result; } - - /// + + /// /// Creates a map from the input and the attributes.
/// The values are provided by the input tensor, while the keys are specified by the attributes. /// Must provide keys in either classlabels_strings or classlabels_int64s (but not both).
@@ -4385,5 +4385,5 @@ public static List> ZipMap(Tensor X, Optional c Object result = OnnxInterpreter.interpret(OnnxOps.ZipMap.class, List.of(X), List.of(classlabels_int64s, classlabels_strings)); return (List>) result; } - + } From 50df2496af404b45ac048059cbbd0f1c56da2803 Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Thu, 16 Jul 2026 07:45:13 +0200 Subject: [PATCH 14/18] Update copyright as the file was modified in 2026 too Signed-off-by: Ana-Maria Mihalceanu --- .../onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java index 5e0e67b2325..0ccf22adf7b 100644 --- a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java +++ b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it From 1b1c4a15a51c34940960f16cd59d81aeb20e9c84 Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Thu, 16 Jul 2026 07:50:56 +0200 Subject: [PATCH 15/18] Refactor to avoid NPE for local generator params variable. Signed-off-by: Ana-Maria Mihalceanu --- .../main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java index da6cf0058a2..34ddff9b21b 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java @@ -281,7 +281,7 @@ public void prompt(String prompt, int maxNewTokens, Consumer outputConsu LOG.log(System.Logger.Level.DEBUG, "Create sequences"); var inputTokens = call(OgaCreateSequences(ret)); - MemorySegment localGeneratorParams = null; + MemorySegment localGeneratorParams = MemorySegment.NULL; MemorySegment localGenerator = MemorySegment.NULL; try { call(OgaTokenizerEncode(tokenizer, arena.allocateFrom(prompt), inputTokens)); From 7b3ee764f72e4854365dfc74dffebfc8399ac4c1 Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Thu, 16 Jul 2026 11:02:09 +0200 Subject: [PATCH 16/18] Use max_length in prompt response generation by default. Signed-off-by: Ana-Maria Mihalceanu --- .../main/java/oracle/code/onnx/Tensor.java | 3 +- .../onnx/genai/OnnxGenRuntimeSession.java | 66 ++++++------------- 2 files changed, 23 insertions(+), 46 deletions(-) diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/Tensor.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/Tensor.java index 122e6178e07..405c35089a2 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/Tensor.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/Tensor.java @@ -271,7 +271,8 @@ public String onnxName() { public int bitSize() { return switch (this) { - case INT2, INT4, UINT2, UINT4, FLOAT4E2M1 -> 4; + case INT2, UINT2 -> 2; + case INT4, UINT4, FLOAT4E2M1 -> 4; case UINT8, INT8, BOOL, FLOAT8E4M3FN, FLOAT8E4M3FNUZ, FLOAT8E5M2, FLOAT8E5M2FNUZ, FLOAT8E8M0 -> 8; case UINT16, INT16, FLOAT16, BFLOAT16 -> 16; case UINT32, INT32, FLOAT -> 32; diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java index 34ddff9b21b..cf6db553059 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java @@ -204,7 +204,13 @@ public static OnnxGenRuntimeSession buildFromCodeReflection(MethodHandles.Lookup } private final Arena arena; - private final MemorySegment ret, model, tokenizer, tokenizerStream, generatorParams, generator, count; + private final MemorySegment ret; + private final MemorySegment model; + private final MemorySegment tokenizer; + private final MemorySegment tokenizerStream; + private final MemorySegment generatorParams; + private MemorySegment generator; + private final MemorySegment count; /** * Constructs Onnx Generate API session (including model, tokenizer and generator) from assets stored in the Onnx model directory. @@ -217,7 +223,7 @@ public OnnxGenRuntimeSession(Path onnxModelDir) { tokenizer = call(OgaCreateTokenizer(model, ret)); tokenizerStream = call(OgaCreateTokenizerStream(tokenizer, ret)); generatorParams = call(OgaCreateGeneratorParams(model, ret)); - generator = call(OgaCreateGenerator(model, generatorParams, ret)); + generator = MemorySegment.NULL; count = arena.allocate(C_LONG); } @@ -238,36 +244,6 @@ private MemorySegment call(MemorySegment status) { } } - /** - * Runs generator with the provided prompt and feeds decoded response to the provided consumer. - * @param prompt Text prompt to tokenize and append to the LLM model input. - * @param outputConsumer Consumer receiving decoded model response from the model generator. - */ - public void prompt(String prompt, Consumer outputConsumer) { - LOG.log(System.Logger.Level.DEBUG, "Create sequences"); - var inputTokens = call(OgaCreateSequences(ret)); - try { - call(OgaTokenizerEncode(tokenizer, arena.allocateFrom(prompt), inputTokens)); - LOG.log(System.Logger.Level.DEBUG, "Tokenizer encode"); - generate(inputTokens, generator, outputConsumer); - } finally { - OgaDestroySequences(inputTokens); - } - } - - private void generate(MemorySegment inputTokens, MemorySegment generator, Consumer outputConsumer) { - call(OgaGenerator_AppendTokenSequences(generator, inputTokens)); - LOG.log(System.Logger.Level.DEBUG, "Generator loop"); - while (!OgaGenerator_IsDone(generator)) { - call(OgaGenerator_GenerateNextToken(generator)); - int nextToken = call(OgaGenerator_GetNextTokens(generator, ret, count)).get(C_INT, 0); - String response = call(OgaTokenizerStreamDecode(tokenizerStream, nextToken, ret)).getString(0); - outputConsumer.accept(response); - } - outputConsumer.accept("\n"); - LOG.log(System.Logger.Level.DEBUG, "Tokenizer stream decoded"); - } - /** * Runs generator with the provided prompt and feeds decoded response to the provided consumer. * @param prompt Text prompt to tokenize and append to the LLM model input. @@ -276,28 +252,28 @@ private void generate(MemorySegment inputTokens, MemorySegment generator, Consum */ public void prompt(String prompt, int maxNewTokens, Consumer outputConsumer) { if (maxNewTokens < 0) { - throw new IllegalArgumentException("maxNewTokens must be above 0, found " + maxNewTokens); + throw new IllegalArgumentException("maxNewTokens must be at least 0, found " + maxNewTokens); } LOG.log(System.Logger.Level.DEBUG, "Create sequences"); var inputTokens = call(OgaCreateSequences(ret)); - - MemorySegment localGeneratorParams = MemorySegment.NULL; - MemorySegment localGenerator = MemorySegment.NULL; try { call(OgaTokenizerEncode(tokenizer, arena.allocateFrom(prompt), inputTokens)); LOG.log(System.Logger.Level.DEBUG, "Tokenizer encode"); long promptTokens = OgaSequencesGetSequenceCount(inputTokens, 0L); long maxLength = Math.addExact(promptTokens, maxNewTokens); - localGeneratorParams = call(OgaCreateGeneratorParams(model, ret)); - call(OgaGeneratorParamsSetSearchNumber(localGeneratorParams, arena.allocateFrom("max_length"), maxLength)); - localGenerator = call(OgaCreateGenerator(model, localGeneratorParams, ret)); - - generate(inputTokens, localGenerator, outputConsumer); + call(OgaGeneratorParamsSetSearchNumber(generatorParams, arena.allocateFrom("max_length"), maxLength)); + generator = call(OgaCreateGenerator(model, generatorParams, ret)); + call(OgaGenerator_AppendTokenSequences(generator, inputTokens)); + LOG.log(System.Logger.Level.DEBUG, "Generator loop"); + while (!OgaGenerator_IsDone(generator)) { + call(OgaGenerator_GenerateNextToken(generator)); + int nextToken = call(OgaGenerator_GetNextTokens(generator, ret, count)).get(C_INT, 0); + String response = call(OgaTokenizerStreamDecode(tokenizerStream, nextToken, ret)).getString(0); + outputConsumer.accept(response); + } + outputConsumer.accept("\n"); + LOG.log(System.Logger.Level.DEBUG, "Tokenizer stream decoded"); } finally { - if (!localGeneratorParams.equals(MemorySegment.NULL)) - OgaDestroyGeneratorParams(localGeneratorParams); - if (!localGenerator.equals(MemorySegment.NULL)) - OgaDestroyGenerator(localGenerator); OgaDestroySequences(inputTokens); } } From ed2416017dda980a7f499eb0aea5d9407b8eb16b Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Thu, 16 Jul 2026 18:24:14 +0200 Subject: [PATCH 17/18] Set max_length in genai_config.json to speed up the model and revert other changes. Signed-off-by: Ana-Maria Mihalceanu --- .../code/onnx/genai/OnnxGenRuntimeSession.java | 12 ++---------- .../test/java/oracle/code/onnx/llm/LlamaDemo.java | 5 ++--- .../resources/oracle/code/onnx/llm/genai_config.json | 2 +- 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java index cf6db553059..3f1da88010c 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java @@ -223,7 +223,7 @@ public OnnxGenRuntimeSession(Path onnxModelDir) { tokenizer = call(OgaCreateTokenizer(model, ret)); tokenizerStream = call(OgaCreateTokenizerStream(tokenizer, ret)); generatorParams = call(OgaCreateGeneratorParams(model, ret)); - generator = MemorySegment.NULL; + generator = call(OgaCreateGenerator(model, generatorParams, ret)); count = arena.allocate(C_LONG); } @@ -247,22 +247,14 @@ private MemorySegment call(MemorySegment status) { /** * Runs generator with the provided prompt and feeds decoded response to the provided consumer. * @param prompt Text prompt to tokenize and append to the LLM model input. - * @param maxNewTokens Maximum number of output tokens generated. * @param outputConsumer Consumer receiving decoded model response from the model generator. */ - public void prompt(String prompt, int maxNewTokens, Consumer outputConsumer) { - if (maxNewTokens < 0) { - throw new IllegalArgumentException("maxNewTokens must be at least 0, found " + maxNewTokens); - } + public void prompt(String prompt, Consumer outputConsumer) { LOG.log(System.Logger.Level.DEBUG, "Create sequences"); var inputTokens = call(OgaCreateSequences(ret)); try { call(OgaTokenizerEncode(tokenizer, arena.allocateFrom(prompt), inputTokens)); LOG.log(System.Logger.Level.DEBUG, "Tokenizer encode"); - long promptTokens = OgaSequencesGetSequenceCount(inputTokens, 0L); - long maxLength = Math.addExact(promptTokens, maxNewTokens); - call(OgaGeneratorParamsSetSearchNumber(generatorParams, arena.allocateFrom("max_length"), maxLength)); - generator = call(OgaCreateGenerator(model, generatorParams, ret)); call(OgaGenerator_AppendTokenSequences(generator, inputTokens)); LOG.log(System.Logger.Level.DEBUG, "Generator loop"); while (!OgaGenerator_IsDone(generator)) { diff --git a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java index 0ccf22adf7b..2ed71c8eddf 100644 --- a/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java +++ b/cr-examples/onnx/src/test/java/oracle/code/onnx/llm/LlamaDemo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,13 +35,12 @@ public static void main(String... args) throws Exception { Path modelRoot = Path.of(LlamaDemo.class.getResource("LlamaDemo.class").toURI()).getParent(); try (Arena arena = Arena.ofConfined()) { - int maxNewTokens = 128; var modelInstance = new LlamaModel(arena); try (OnnxGenRuntimeSession session = OnnxGenRuntimeSession.buildFromCodeReflection(MethodHandles.lookup(), modelInstance, "forward", modelRoot, "model.onnx", "model.data")) { session.prompt(""" <|start_header_id|>user<|end_header_id|>Hello, tell me a joke.<|eot_id|> <|start_header_id|>assistant<|end_header_id|> - """, maxNewTokens, System.out::print); + """, System.out::print); } } } diff --git a/cr-examples/onnx/src/test/resources/oracle/code/onnx/llm/genai_config.json b/cr-examples/onnx/src/test/resources/oracle/code/onnx/llm/genai_config.json index bab2c20c8cc..03e495d2cc2 100644 --- a/cr-examples/onnx/src/test/resources/oracle/code/onnx/llm/genai_config.json +++ b/cr-examples/onnx/src/test/resources/oracle/code/onnx/llm/genai_config.json @@ -39,7 +39,7 @@ "do_sample": true, "early_stopping": true, "length_penalty": 1.0, - "max_length": 131072, + "max_length": 8192, "min_length": 0, "no_repeat_ngram_size": 0, "num_beams": 1, From 494fcb9075178f1cd9a8bc605fdfc7900476f3a2 Mon Sep 17 00:00:00 2001 From: Ana-Maria Mihalceanu Date: Thu, 16 Jul 2026 19:07:39 +0200 Subject: [PATCH 18/18] Make all MemorySegments final. Signed-off-by: Ana-Maria Mihalceanu --- .../oracle/code/onnx/genai/OnnxGenRuntimeSession.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java index 3f1da88010c..fa0974f620f 100644 --- a/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java +++ b/cr-examples/onnx/src/main/java/oracle/code/onnx/genai/OnnxGenRuntimeSession.java @@ -204,13 +204,7 @@ public static OnnxGenRuntimeSession buildFromCodeReflection(MethodHandles.Lookup } private final Arena arena; - private final MemorySegment ret; - private final MemorySegment model; - private final MemorySegment tokenizer; - private final MemorySegment tokenizerStream; - private final MemorySegment generatorParams; - private MemorySegment generator; - private final MemorySegment count; + private final MemorySegment ret, model, tokenizer, tokenizerStream, generatorParams, generator, count; /** * Constructs Onnx Generate API session (including model, tokenizer and generator) from assets stored in the Onnx model directory.