Module onnxruntime::tensor[][src]

Expand description

Module containing tensor types.

Two main types of tensors are available.

The first one, Tensor, 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. It is built using a OrtOwnedTensorExtractor following the builder pattern.

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 built directly. When performing inference, the Session::run() method takes an ndarray::Array as input (taking ownership of it) and will convert it internally to a Tensor. After inference, a OrtOwnedTensor will be returned by the method which can be derefed into its internal ndarray::ArrayView.

Re-exports

pub use ort_owned_tensor::OrtOwnedTensor;
pub use ort_tensor::OrtTensor;

Modules

Module containing a tensor trait extending ndarray::ArrayBase

Module containing tensor with memory owned by the ONNX Runtime

Module containing tensor with memory owned by Rust