Enum Class ONNXOperators

java.lang.Object
java.lang.Enum<ONNXOperators>
org.tribuo.util.onnx.ONNXOperators
All Implemented Interfaces:
Serializable, Comparable<ONNXOperators>, Constable

public enum ONNXOperators extends Enum<ONNXOperators>
The supported ONNX operators.
  • Enum Constant Details

    • IDENTITY

      public static final ONNXOperators IDENTITY
      Identity.
    • CONCAT

      public static final ONNXOperators CONCAT
      Concatenates tensors.
    • CONSTANT_OF_SHAPE

      public static final ONNXOperators CONSTANT_OF_SHAPE
    • SIGMOID

      public static final ONNXOperators SIGMOID
      Sigmoid element-wise.
    • SOFTMAX

      public static final ONNXOperators SOFTMAX
      Softmax.
      • axis defaults to -1.
    • CAST

      public static final ONNXOperators CAST
      Cast input to specified type.
    • NEG

      public static final ONNXOperators NEG
      Element-wise negation.
    • ADD

      public static final ONNXOperators ADD
      Element-wise addition with broadcasting.
    • SUB

      public static final ONNXOperators SUB
      Element-wise subtraction with broadcasting.
    • MUL

      public static final ONNXOperators MUL
      Element-wise multiplication with broadcasting.
    • DIV

      public static final ONNXOperators DIV
      Element-wise division with broadcasting.
    • POW

      public static final ONNXOperators POW
      Element-wise exponentiation with broadcasting.
    • SUM

      public static final ONNXOperators SUM
      Element-wise summation across the supplied inputs with broadcasting.
    • GATHER

      public static final ONNXOperators GATHER
      Gathers elements from the first argument (of rank r) indexed by the second argument (of rank q) producing a tensor of rank q + r - 1.
      • axis the axis of the first argument to gather from.
    • HARDMAX

      public static final ONNXOperators HARDMAX
      Hardmax(element in input, axis) = 1 if the element is the first maximum value along the specified axis, 0 otherwise.
      • axis default is -1, i.e., take the hardmax over the last dimension.
    • REDUCE_MEAN

      public static final ONNXOperators REDUCE_MEAN
      Computes the mean of the input tensor's element along the provided axes.
      • axes default is to reduce over all dimensions.
      • keepdims defaults to 1 which means keep.
    • REDUCE_MIN

      public static final ONNXOperators REDUCE_MIN
      Compute the minimum along the specified axes of the tensor.
      • axes defaults to all dimensions.
      • keepdims defaults to 1 which means keep.
    • REDUCE_SUM

      public static final ONNXOperators REDUCE_SUM
      Compute the sum along the specified axes of the tensor, the axes are the second input.
      • keepdims defaults to 1 which means keep.
      • noop_with_empty_axes defaults to 0 which means empty axes reduces the tensor to a scalar.
    • UNSQUEEZE

      public static final ONNXOperators UNSQUEEZE
      Adds extra dimensions to a tensor in the specified places, the axes are the second input.
    • GEMM

      public static final ONNXOperators GEMM
      General Matrix Multiply: alpha*AB + beta*C.

      The C input is optional, and if not supplied is treated as zero.

      • alpha defaults to 1.0
      • beta defaults to 1.0
      • transA defaults to 0 (i.e., not transposed)
      • transB defaults to 0 (i.e., not transposed)
    • GREATER

      public static final ONNXOperators GREATER
      Greater than, returns the element-wise greater than operation on the two tensors.

      Tensors must be broadcastable to the same shape.

    • GREATER_OR_EQUAL

      public static final ONNXOperators GREATER_OR_EQUAL
      Greater than or equal to, returns the element-wise greater than or equal to operation on the two tensors.

      Tensors must be broadcastable to the same shape.

    • LESS

      public static final ONNXOperators LESS
      Less than, returns the element-wise less than operation on the two tensors.

      Tensors must be broadcastable to the same shape.

    • LESS_OR_EQUAL

      public static final ONNXOperators LESS_OR_EQUAL
      Less than or equal to, returns the element-wise less than or equal to operation on the two tensors.

      Tensors must be broadcastable to the same shape.

    • WHERE

      public static final ONNXOperators WHERE
      Choice operator, based on the true value of the condition input, returns the element at that index from either the second or third input. When the test is true, return the second input, otherwise return the third input.
    • ARRAY_FEATURE_EXTRACTOR

      public static final ONNXOperators ARRAY_FEATURE_EXTRACTOR
      Array feature extractor, selects the indices specified by the second tensor from the last dimension of the first tensor.
    • SVM_CLASSIFIER

      public static final ONNXOperators SVM_CLASSIFIER
      SVM Classifier.
      • classlabels_ints - Class labels if using integer labels. One and only one of the 'classlabels_*' attributes must be defined.
      • classlabels_strings - Class labels if using string labels. One and only one of the 'classlabels_*' attributes must be defined.
      • coefficients - SVM coefficients
      • kernel_params - Tuple of gamma, coef0 and degree. Set to zero if unused by the kernel.
      • kernel_type - One of 'LINEAR,' 'POLY,' 'RBF,' 'SIGMOID'.
      • post_transforms - Transform to apply to the score (usually unused by SVMs), one of 'NONE,' 'SOFTMAX,' 'LOGISTIC,' 'SOFTMAX_ZERO,' or 'PROBIT'.
      • prob_a - Probability coefficients, if set must be the same size as prob_b.
      • prob_b - Probability coefficients, if set must be the same size as prob_a.
      • rho - Rho vector.
      • support_vectors - linearised support vectors.
      • vectors_per_class - the number of support vectors in each class.
    • SVM_REGRESSOR

      public static final ONNXOperators SVM_REGRESSOR
      SVM Regressor.
      • coefficients - SVM coefficients
      • kernel_params - Tuple of gamma, coef0 and degree. Set to zero if unused by the kernel.
      • kernel_type - One of 'LINEAR,' 'POLY,' 'RBF,' 'SIGMOID'.
      • n_supports - The number of support vectors.
      • one_class - Flag noting if this regression is a one-class SVM for anomaly detection or not.
      • post_transforms - Transform to apply to the score (usually unused by SVMs), one of 'NONE,' 'SOFTMAX,' 'LOGISTIC,' 'SOFTMAX_ZERO,' or 'PROBIT'.
      • rho - Rho vector.
      • support_vectors - linearised support vectors.
  • Field Details

    • opName

      public final String opName
      The operator name.
    • numInputs

      public final int numInputs
      The number of inputs.
    • numOptionalInputs

      public final int numOptionalInputs
      The number of optional inputs.
    • numOutputs

      public final int numOutputs
      The number of outputs.
    • attributes

      public final Map<String,ONNXAttribute> attributes
      The operator attributes.
    • mandatoryAttributeNames

      public final Set<String> mandatoryAttributeNames
      The mandatory attribute names.
    • domain

      public final String domain
      The operator domain (used for the ML operators).

      Null if the domain is the default one.

  • Method Details

    • values

      public static ONNXOperators[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ONNXOperators valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • build

      public OnnxMl.NodeProto build(ONNXContext context, String input, String output)
      Builds this node based on the supplied inputs and output. Throws IllegalArgumentException if this operator takes more than a single input or output.
      Parameters:
      context - The onnx context used to ensure this node has a unique name.
      input - The name of the input.
      output - The name of the output.
      Returns:
      The NodeProto.
    • build

      public OnnxMl.NodeProto build(ONNXContext context, String input, String output, Map<String,Object> attributeValues)
      Builds this node based on the supplied inputs and output. Throws IllegalArgumentException if this operator takes more than a single input or output. May throw UnsupportedOperationException if the attribute type is not supported.
      Parameters:
      context - The onnx context used to ensure this node has a unique name.
      input - The names of the input.
      output - The name of the output.
      attributeValues - The attribute names and values.
      Returns:
      The NodeProto.
    • build

      public OnnxMl.NodeProto build(ONNXContext context, String[] inputs, String output)
      Builds this node based on the supplied inputs and output. Throws IllegalArgumentException if the number of inputs or outputs is wrong.
      Parameters:
      context - The onnx context used to ensure this node has a unique name.
      inputs - The names of the inputs.
      output - The name of the output.
      Returns:
      The NodeProto.
    • build

      public OnnxMl.NodeProto build(ONNXContext context, String[] inputs, String output, Map<String,Object> attributeValues)
      Builds this node based on the supplied inputs and output. Throws IllegalArgumentException if the number of inputs, outputs or attributes is wrong. May throw UnsupportedOperationException if the attribute type is not supported.
      Parameters:
      context - The onnx context used to ensure this node has a unique name.
      inputs - The names of the inputs.
      output - The name of the output.
      attributeValues - The attribute names and values.
      Returns:
      The NodeProto.
    • build

      public OnnxMl.NodeProto build(ONNXContext context, String input, String[] outputs)
      Builds this node based on the supplied input and outputs. Throws IllegalArgumentException if the number of inputs or outputs is wrong.
      Parameters:
      context - The onnx context used to ensure this node has a unique name.
      input - The name of the input.
      outputs - The names of the outputs.
      Returns:
      The NodeProto.
    • build

      public OnnxMl.NodeProto build(ONNXContext context, String input, String[] outputs, Map<String,Object> attributeValues)
      Builds this node based on the supplied input and outputs. Throws IllegalArgumentException if the number of inputs, outputs or attributes is wrong. May throw UnsupportedOperationException if the attribute type is not supported.
      Parameters:
      context - The onnx context used to ensure this node has a unique name.
      input - The name of the input.
      outputs - The names of the outputs.
      attributeValues - The attribute names and values.
      Returns:
      The NodeProto.
    • build

      public OnnxMl.NodeProto build(ONNXContext context, String[] inputs, String[] outputs)
      Builds this node based on the supplied inputs and outputs. Throws IllegalArgumentException if the number of inputs or outputs is wrong.
      Parameters:
      context - The onnx context used to ensure this node has a unique name.
      inputs - The names of the inputs.
      outputs - The names of the outputs.
      Returns:
      The NodeProto.
    • build

      public OnnxMl.NodeProto build(ONNXContext context, String[] inputs, String[] outputs, Map<String,Object> attributeValues)
      Builds this node based on the supplied inputs and outputs. Throws IllegalArgumentException if the number of inputs, outputs or attributes is wrong. May throw UnsupportedOperationException if the attribute type is not supported.
      Parameters:
      context - The onnx context used to ensure this node has a unique name.
      inputs - The names of the inputs.
      outputs - The names of the outputs.
      attributeValues - The attribute names and values.
      Returns:
      The NodeProto.
    • getOpsetVersion

      public static int getOpsetVersion()
      Returns the opset version supported by these operators.
      Returns:
      The opset version.
    • getOpsetProto

      public static OnnxMl.OperatorSetIdProto getOpsetProto()
      Returns the opset proto for these operators.
      Returns:
      The opset proto.