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.
- Host
Tensor - Owned contiguous host tensor in column-major order.
- Host
Tensor View - Borrowed host tensor view with shape, strides, and offset metadata.
- Rank
- Static tensor rank marker.
- Slice
Spec - Explicit slice descriptor.
- Tensor
Layout - 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.
- Tensor
Ref - Core-neutral tensor input reference.
- Tensor
View - Dynamic borrowed host tensor view.
Traits§
- Tensor
Rank - Rank contract for tensor metadata shapes and strides.
- Tensor
Scalar - Sealed trait for scalar types supported by the core tensor data model.
Functions§
- col_
major_ strides - Return compact column-major strides for a shape.