Package org.tribuo.interop.onnx
Interface ExampleTransformer
- All Superinterfaces:
com.oracle.labs.mlrg.olcut.config.Configurable
,ProtoSerializable<org.tribuo.interop.onnx.protos.ExampleTransformerProto>
,com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>
,Serializable
- All Known Implementing Classes:
DenseTransformer
,ImageTransformer
public interface ExampleTransformer
extends com.oracle.labs.mlrg.olcut.config.Configurable, ProtoSerializable<org.tribuo.interop.onnx.protos.ExampleTransformerProto>, com.oracle.labs.mlrg.olcut.provenance.Provenancable<com.oracle.labs.mlrg.olcut.provenance.ConfiguredObjectProvenance>, Serializable
Transforms a
SparseVector
, extracting the features from it as a OnnxTensor
.
This usually densifies the example, so can be a lot larger than the input example.
N.B. ONNX support is experimental, and may change without a major version bump.
-
Field Summary
Fields inherited from interface org.tribuo.protos.ProtoSerializable
DESERIALIZATION_METHOD_NAME, PROVENANCE_SERIALIZER
-
Method Summary
Modifier and TypeMethodDescriptionai.onnxruntime.OnnxTensor
transform
(ai.onnxruntime.OrtEnvironment env, List<SparseVector> vectors) Converts a list ofSparseVector
s representing a batch of features into aOnnxTensor
.ai.onnxruntime.OnnxTensor
transform
(ai.onnxruntime.OrtEnvironment env, SparseVector vector) Converts aSparseVector
representing the features into aOnnxTensor
.Methods inherited from interface com.oracle.labs.mlrg.olcut.config.Configurable
postConfig
Methods inherited from interface org.tribuo.protos.ProtoSerializable
serialize
Methods inherited from interface com.oracle.labs.mlrg.olcut.provenance.Provenancable
getProvenance
-
Method Details
-
transform
ai.onnxruntime.OnnxTensor transform(ai.onnxruntime.OrtEnvironment env, SparseVector vector) throws ai.onnxruntime.OrtException Converts aSparseVector
representing the features into aOnnxTensor
.It generates it as a single example minibatch.
- Parameters:
env
- The OrtEnvironment to create the tensor in.vector
- The features to convert.- Returns:
- A dense OnnxTensor representing this vector.
- Throws:
ai.onnxruntime.OrtException
- if the transformation failed.
-
transform
ai.onnxruntime.OnnxTensor transform(ai.onnxruntime.OrtEnvironment env, List<SparseVector> vectors) throws ai.onnxruntime.OrtException Converts a list ofSparseVector
s representing a batch of features into aOnnxTensor
.- Parameters:
env
- The OrtEnvironment to create the tensor in.vectors
- The batch of features to convert.- Returns:
- A dense OnnxTensor representing this minibatch.
- Throws:
ai.onnxruntime.OrtException
- if the transformation failed.
-