Expand description
Module containing tensor types.
Two main types of tensors are available.
The first one, [OrtTensor
], is an owned tensor that is backed by ndarray
.
This kind of tensor is used to pass input data for the inference.
The second one, OrtOwnedTensor
, is used internally to pass to the ONNX Runtime inference execution to place its
output values. Once “extracted” from the runtime environment, this tensor will contain an ndarray::ArrayView
containing a view of the data. When going out of scope, this tensor will free the required memory on the C side.
NOTE: Tensors are not meant to be created directly. When performing inference, the
Session::run
method takes an ndarray::Array
as input (taking ownership of it) and will
convert it internally to an [OrtTensor
]. After inference, a OrtOwnedTensor
will be returned by the method
which can be derefed into its internal ndarray::ArrayView
.
Re-exports
pub use self::ndarray_tensor::NdArrayExtensions;
pub use self::ort_owned_tensor::OrtOwnedTensor;
Modules
Enums
- Represents the possible ways tensor data can be accessed.
- Enum mapping ONNX Runtime’s supported tensor data types.
Traits
- Trait used to map Rust types (for example
f32
) to ONNX tensor element data types (for exampleFloat
). - Trait used to map ONNX Runtime types to Rust types.
- Adapter for common Rust string types to ONNX strings.