Class ONNXAttribute

java.lang.Object
org.tribuo.util.onnx.ONNXAttribute

public final class ONNXAttribute extends Object
The spec for an attribute, used to produce the attribute proto at construction time.
  • Field Details

    • VARIADIC_INPUT

      public static final int VARIADIC_INPUT
      Value used to denote a varaidic input in an ONNX operator
      See Also:
  • Constructor Details

    • ONNXAttribute

      public ONNXAttribute(String name, OnnxMl.AttributeProto.AttributeType type, boolean mandatory)
      Constructs an attribute placeholder of the appropriate name and type.
      Parameters:
      name - The name of the attribute.
      type - The type of the attribute.
      mandatory - Is this attribute mandatory?
  • Method Details

    • getName

      public String getName()
      Gets the attribute's name.
      Returns:
      The attribute's name.
    • getType

      Gets the attribute's type.
      Returns:
      The attribute's type.
    • isMandatory

      public boolean isMandatory()
      Is this attribute mandatory?
      Returns:
      True if the attribute is mandatory for this operation.
    • build

      public OnnxMl.AttributeProto build(Object value)
      Builds the attribute proto using the supplied value.

      Throws IllegalArgumentException if the value type does not match the expected type, and throws UnsupportedOperationException if the value type is not supported. Currently supported types are primitives, strings and arrays of primitives and strings. ONNX attributes only support float and int as primitives.

      Parameters:
      value - The value
      Returns:
      The AttributeProto.
    • toString

      public String toString()
      Overrides:
      toString in class Object