Package ai.onnxruntime
Class OnnxMap
- java.lang.Object
-
- ai.onnxruntime.OnnxMap
-
- All Implemented Interfaces:
OnnxValue,java.lang.AutoCloseable
public class OnnxMap extends java.lang.Object implements OnnxValue
A container for a map returned byOrtSession.run(Map).Supported types are those mentioned in
onnxruntime_c_api.h, keys: String and Long, values: String, Long, Float, Double.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOnnxMap.OnnxMapValueTypeAn enum representing the Java type of the values stored in anOnnxMap.-
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 map, releasing the native memory backing it and it's elements.MapInfogetInfo()Gets the type info object associated with this OnnxValue.OnnxValue.OnnxValueTypegetType()Gets the type of this OnnxValue.java.util.Map<? extends java.lang.Object,? extends java.lang.Object>getValue()Returns a weakly typed Map containing all the elements.booleanisClosed()Checks if this value is closed (i.e., the native object has been released).intsize()The number of entries in the map.java.lang.StringtoString()
-
-
-
Method Detail
-
size
public int size()
The number of entries in the map.- Returns:
- The number of entries.
-
getType
public OnnxValue.OnnxValueType getType()
Description copied from interface:OnnxValueGets the type of this OnnxValue.
-
getValue
public java.util.Map<? extends java.lang.Object,? extends java.lang.Object> getValue() throws OrtExceptionReturns a weakly typed Map containing all the elements.- Specified by:
getValuein interfaceOnnxValue- Returns:
- A map.
- Throws:
OrtException- If the onnx runtime failed to read the entries.
-
getInfo
public MapInfo 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 map, releasing the native memory backing it and it's elements.
-
checkClosed
protected void checkClosed()
Checks if the OnnxValue is closed, if so throwsIllegalStateException.
-
-