Skip to main content

Crate tenferro_tensor_core

Crate tenferro_tensor_core 

Source
Expand description

Lightweight host tensor data model and metadata-only views.

tenferro-tensor-core owns backend-independent tensor metadata and host-resident contiguous tensor storage. It does not own execution backends, backend buffers, GPU handles, provider selection, or materializing kernels. Runtime/backend-capable TypedTensor<T, R> lives in tenferro-tensor. This crate exposes rank/layout metadata plus host-only tensor adapters.

§Examples

use tenferro_tensor_core::{HostTensor, Rank, SliceSpec, TensorLayout};

let tensor = HostTensor::from_vec_col_major(vec![2, 3], vec![1.0_f64, 2.0, 3.0, 4.0, 5.0, 6.0])?;
let view = tensor
    .as_view()
    .slice_view(&[
        SliceSpec { start: 0, end: 2, step: 1 },
        SliceSpec { start: 1, end: 3, step: 1 },
    ])?;

assert_eq!(view.shape(), &[2, 2]);
assert_eq!(view.as_slice()?, &[3.0, 4.0, 5.0, 6.0]);

let layout = TensorLayout::<Rank<2>>::compact([2, 3])?;
let transposed = layout.transpose_view([1, 0])?;
assert_eq!(transposed.shape(), &[3, 2]);

Structs§

DynRank
Dynamic tensor rank marker.
HostTensor
Owned contiguous host tensor in column-major order.
HostTensorView
Borrowed host tensor view with shape, strides, and offset metadata.
Rank
Static tensor rank marker.
SliceSpec
Explicit slice descriptor.
TensorLayout
Storage-neutral tensor layout metadata.

Enums§

DType
Runtime scalar dtype tag.
Error
Data-model validation errors.
Tensor
Dynamic owned host tensor over the supported dtype set.
TensorRef
Core-neutral tensor input reference.
TensorView
Dynamic borrowed host tensor view.

Traits§

TensorRank
Rank contract for tensor metadata shapes and strides.
TensorScalar
Sealed trait for scalar types supported by the core tensor data model.

Functions§

col_major_strides
Return compact column-major strides for a shape.

Type Aliases§

Result
Result type for tensor data-model operations.
ShapeVec
Small tensor shape vector with inline capacity for common dynamic ranks.
StrideVec
Small tensor stride vector with signed element strides.