v2.0.0
Loading...
Searching...
No Matches
ml_tensor.h File Reference

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>
Include dependency graph for ml_tensor.h:
This graph shows which files directly or indirectly include this file:

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.

Detailed Description

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

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.2.0
Date
April 2026

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.