Package org.tribuo.util.onnx
Interface ONNXOperator
- All Known Implementing Classes:
ONNXOperators
public interface ONNXOperator
An interface for ONNX operators. Usually implemented by an enum representing the opset.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ai.onnx.proto.OnnxMl.NodeProto
build
(ONNXContext context, String[] inputs, String output) Builds this node based on the supplied inputs and output.default ai.onnx.proto.OnnxMl.NodeProto
build
(ONNXContext context, String[] inputs, String[] outputs) Builds this node based on the supplied inputs and outputs.default ai.onnx.proto.OnnxMl.NodeProto
Builds this node based on the supplied inputs and outputs.default ai.onnx.proto.OnnxMl.NodeProto
Builds this node based on the supplied inputs and output.default ai.onnx.proto.OnnxMl.NodeProto
build
(ONNXContext context, String input, String output) Builds this node based on the supplied inputs and output.default ai.onnx.proto.OnnxMl.NodeProto
build
(ONNXContext context, String input, String[] outputs) Builds this node based on the supplied input and outputs.default ai.onnx.proto.OnnxMl.NodeProto
Builds this node based on the supplied input and outputs.default ai.onnx.proto.OnnxMl.NodeProto
Builds this node based on the supplied inputs and output.The operator attributes.The mandatory attribute names.int
The number of inputs.int
The number of optional inputs.int
The number of outputs.Returns the opset domain.The operator name.int
Returns the opset version.default ai.onnx.proto.OnnxMl.OperatorSetIdProto
Returns the opset proto for these operators.
-
Method Details
-
getOpName
String getOpName()The operator name.- Returns:
- The name.
-
getNumInputs
int getNumInputs()The number of inputs.- Returns:
- The number of inputs.
-
getNumOptionalInputs
int getNumOptionalInputs()The number of optional inputs.- Returns:
- The number of optional inputs.
-
getNumOutputs
int getNumOutputs()The number of outputs.- Returns:
- The number of outputs.
-
getAttributes
Map<String,ONNXAttribute> getAttributes()The operator attributes.- Returns:
- The operator attribute map.
-
getMandatoryAttributeNames
The mandatory attribute names.- Returns:
- The required attribute names.
-
getOpVersion
int getOpVersion()Returns the opset version.- Returns:
- The opset version.
-
getOpDomain
String getOpDomain()Returns the opset domain.May be
null
if it is the default ONNX domain;- Returns:
- The opset domain.
-
opsetProto
default ai.onnx.proto.OnnxMl.OperatorSetIdProto opsetProto()Returns the opset proto for these operators.- Returns:
- The opset proto.
-
build
Builds this node based on the supplied inputs and output. ThrowsIllegalArgumentException
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
default ai.onnx.proto.OnnxMl.NodeProto build(ONNXContext context, String input, String output, Map<String, Object> attributeValues) Builds this node based on the supplied inputs and output. ThrowsIllegalArgumentException
if this operator takes more than a single input or output. May throwUnsupportedOperationException
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
Builds this node based on the supplied inputs and output. ThrowsIllegalArgumentException
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
default ai.onnx.proto.OnnxMl.NodeProto build(ONNXContext context, String[] inputs, String output, Map<String, Object> attributeValues) Builds this node based on the supplied inputs and output. ThrowsIllegalArgumentException
if the number of inputs, outputs or attributes is wrong. May throwUnsupportedOperationException
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
Builds this node based on the supplied input and outputs. ThrowsIllegalArgumentException
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
default ai.onnx.proto.OnnxMl.NodeProto build(ONNXContext context, String input, String[] outputs, Map<String, Object> attributeValues) Builds this node based on the supplied input and outputs. ThrowsIllegalArgumentException
if the number of inputs, outputs or attributes is wrong. May throwUnsupportedOperationException
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
default ai.onnx.proto.OnnxMl.NodeProto build(ONNXContext context, String[] inputs, String[] outputs) Builds this node based on the supplied inputs and outputs. ThrowsIllegalArgumentException
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
default ai.onnx.proto.OnnxMl.NodeProto build(ONNXContext context, String[] inputs, String[] outputs, Map<String, Object> attributeValues) Builds this node based on the supplied inputs and outputs. ThrowsIllegalArgumentException
if the number of inputs, outputs or attributes is wrong. May throwUnsupportedOperationException
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.
-