N-dimensional, row-major, reference-counted float32 tensor used as the universal MLLIB data carrier. More...
#include "ml_global.h"#include <Eigen/Core>#include <cassert>#include <cstdint>#include <memory>#include <vector>

Go to the source code of this file.
Classes | |
| class | MLLIB::MlTensor |
| N-dimensional row-major float32 tensor with shared-buffer storage, Eigen Map accessors and a non-owning view mode. More... | |
Namespaces | |
| namespace | MLLIB |
| Tensors, model abstraction, ONNX Runtime inference and Python training drivers used across mne-cpp. | |
N-dimensional, row-major, reference-counted float32 tensor used as the universal MLLIB data carrier.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors
MLLIB::MlTensor is the interchange type that crosses every MLLIB boundary: feature matrices going into a classifier, batched activations between pre-processing and inference, prediction tensors coming back from ONNX Runtime. The storage is contiguous row-major float32 wrapped in a std::shared_ptr buffer so copies, reshapes and slices are all O(1); a non-owning view mode lets the same type wrap memory-mapped files, ORT-allocated buffers or external device pointers without an extra allocation.
The row-major layout deliberately matches ONNX Runtime, PyTorch and NumPy so handing a tensor to ORT is a pure pointer-and-shape cast, and Eigen interop is exposed through Eigen::Map accessors that read/write the same buffer in place. Convenience constructors copy (and, where needed, transpose) from Eigen's column-major MatrixXf / MatrixXd so existing mne-cpp pipelines can feed data in without restructuring their math code.
Definition in file ml_tensor.h.