OrtValue class

OrtValue represents a tensor or other data structure used for input/output in ONNX Runtime.

This class manages memory for tensor data and provides methods for data type conversion. It wraps the native OrtValue (C/C++) or OnnxTensor (Java) types from the ONNX Runtime API.

Constructors

OrtValue.fromMap(Map<String, dynamic> map)
Creates an OrtValue from a map returned by the platform interface
factory

Properties

dataType → OrtDataType
Data type of this tensor
final
hashCode → int
The hash code for this object.
no setterinherited
id → String
Unique identifier for this tensor in the native code
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shape → List<int>
Shape of the tensor as a list of dimensions
final

Methods

asFlattenedList() → Future<List>
Get the data from this tensor as a flattened list (1D list)
asList() → Future<List>
Get the data from this tensor as a list
dispose() → Future<void>
Release native resources associated with this tensor
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
to(OrtDataType targetType) → Future<OrtValue>
Convert this tensor to a different data type
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

fromList(dynamic data, List<int> shape) → Future<OrtValue>
Creates an OrtValue from any supported list type