Package ai.onnxruntime
Class OnnxMap
java.lang.Object
ai.onnxruntime.OnnxMap
- All Implemented Interfaces:
OnnxValue,AutoCloseable
A container for a map returned by
OrtSession.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 ClassesModifier and TypeClassDescriptionstatic enumAn enum representing the Java type of the values stored in anOnnxMap.Nested classes/interfaces inherited from interface ai.onnxruntime.OnnxValue
OnnxValue.OnnxValueType -
Method Summary
Modifier and TypeMethodDescriptionprotected voidChecks if the OnnxValue is closed, if so throwsIllegalStateException.voidclose()Closes this map, releasing the native memory backing it and it's elements.getInfo()Gets the type info object associated with this OnnxValue.getType()Gets the type of this OnnxValue.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.toString()
-
Method Details
-
size
public int size()The number of entries in the map.- Returns:
- The number of entries.
-
getType
Description copied from interface:OnnxValueGets the type of this OnnxValue. -
getValue
Returns 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
Description copied from interface:OnnxValueGets the type info object associated with this OnnxValue. -
toString
-
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.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceOnnxValue
-
checkClosed
protected void checkClosed()Checks if the OnnxValue is closed, if so throwsIllegalStateException.
-