Architecture

The framework is built as a PHP orchestration layer over a native C tensor engine. The design separates control flow from numeric computation.

High-level architecture

PHP layer                       Native C layer
-----------                     -------------
src/                            src/Lib/
  Dataset.php                     TensorEngine.php
  Tensor.php                      libtensor.so
  Pipeline.php                    SafeTensorsIO.php
  Transformers/                   tensor math kernels
  Estimators/                     dataset ingestion
                                 arena and memory primitives

Design principles

Dataset pipeline

CSV file
   ├─ numeric-only fast path -> Tensor mode
   └─ mixed-type fallback -> ETL mode -> transforms -> materialize -> Tensor mode

Pipeline steps

  1. Dataset::load() creates an ETL DataFrame.
  2. ETL transforms execute in native C.
  3. Dataset::materialize() converts the DataFrame to tensors.
  4. Estimators consume tensor data for training and inference.

Tensor engine

Persistence

Performance optimization points

Runtime flow

Cross references