Package ai.onnxruntime
Class OnnxSequence
- java.lang.Object
-
- ai.onnxruntime.OnnxSequence
-
- All Implemented Interfaces:
OnnxValue,java.lang.AutoCloseable
public class OnnxSequence extends java.lang.Object implements OnnxValue
A sequence ofOnnxValues all of the same type.Supports the types mentioned in "onnxruntime_c_api.h", currently
- OnnxTensor<String>
- OnnxTensor<Long>
- OnnxTensor<Float>
- OnnxTensor<Double>
- OnnxMap<String,Float>
- OnnxMap<Long,Float>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ai.onnxruntime.OnnxValue
OnnxValue.OnnxValueType
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckClosed()Checks if the OnnxValue is closed, if so throwsIllegalStateException.voidclose()Closes this sequence, releasing the native memory backing it and it's elements.SequenceInfogetInfo()Gets the type info object associated with this OnnxValue.OnnxValue.OnnxValueTypegetType()Gets the type of this OnnxValue.java.util.List<? extends OnnxValue>getValue()Extracts a Java list of theOnnxValues which can then be further unwrapped.booleanisClosed()Checks if this value is closed (i.e., the native object has been released).java.lang.StringtoString()
-
-
-
Method Detail
-
getType
public OnnxValue.OnnxValueType getType()
Description copied from interface:OnnxValueGets the type of this OnnxValue.
-
getValue
public java.util.List<? extends OnnxValue> getValue() throws OrtException
Extracts a Java list of theOnnxValues which can then be further unwrapped.Returns either a
Listof eitherOnnxTensororOnnxMap.Note unlike the other
OnnxValue.getValue()methods, this does not copy the values themselves into the Java heap, it merely exposes them asOnnxValueinstances, allowing users to use the faster copy methods available forOnnxTensor. This also means that those values need to be closed separately from this instance, and are not closed byclose()on this object.- Specified by:
getValuein interfaceOnnxValue- Returns:
- A Java list containing the values.
- Throws:
OrtException- If the runtime failed to read an element.
-
getInfo
public SequenceInfo getInfo()
Description copied from interface:OnnxValueGets the type info object associated with this OnnxValue.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
isClosed
public boolean isClosed()
Description copied from interface:OnnxValueChecks if this value is closed (i.e., the native object has been released).
-
close
public void close()
Closes this sequence, releasing the native memory backing it and it's elements.
-
checkClosed
protected void checkClosed()
Checks if the OnnxValue is closed, if so throwsIllegalStateException.
-
-