Package org.tribuo.util.onnx
Class ONNXAttribute
java.lang.Object
org.tribuo.util.onnx.ONNXAttribute
The spec for an attribute, used to produce the attribute proto at construction time.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Value used to denote a varaidic input in an ONNX operator -
Constructor Summary
ConstructorDescriptionONNXAttribute
(String name, ai.onnx.proto.OnnxMl.AttributeProto.AttributeType type, boolean mandatory) Constructs an attribute placeholder of the appropriate name and type. -
Method Summary
-
Field Details
-
VARIADIC_INPUT
public static final int VARIADIC_INPUTValue used to denote a varaidic input in an ONNX operator- See Also:
-
-
Constructor Details
-
ONNXAttribute
public ONNXAttribute(String name, ai.onnx.proto.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
Gets the attribute's name.- Returns:
- The attribute's name.
-
getType
public ai.onnx.proto.OnnxMl.AttributeProto.AttributeType 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
Builds the attribute proto using the supplied value.Throws
IllegalArgumentException
if the value type does not match the expected type, and throwsUnsupportedOperationException
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
-