Skip to main content

Crate tenferro_tensor

Crate tenferro_tensor 

Source
Expand description

Core tensor types, views, backend traits, and backend-independent contracts.

§Owned Tensors And Views

TypedTensor<T> and the dtype-erased Tensor enum are owned tensor values. They are the right representation when a result is materialized as compact column-major storage.

TypedTensorView is a borrowed typed view over an existing tensor buffer. It carries logical shape, arbitrary strides, and an offset, so metadata-only layout changes such as transposes, slices, and broadcasts can be represented without copying. A view can be materialized explicitly with TypedTensorView::to_contiguous when a compact owned tensor is required.

TensorRead is the dtype-erased borrowed input type used by eager kernels and backend dispatch. It can borrow either an owned Tensor or a TensorView with arbitrary strides. Prefer TensorRead for read-only operation inputs so callers are not forced to materialize layout-only views.

TensorOwnedView and TensorValue are the owned lazy-value forms. Use them when an API must store a view result beyond the lifetime of a borrowed input, then expose a short-lived TensorRead at kernel-dispatch time.

Use Tensor::as_slice or TypedTensorView::as_slice only when compact contiguous storage is part of the API contract. Use shape/stride-aware kernel paths or TensorRead otherwise.

§Examples

use tenferro_tensor::{Tensor, TypedTensor};

let a = Tensor::F64(TypedTensor::from_vec_col_major(vec![2], vec![1.0, 2.0]).unwrap());
assert_eq!(a.shape(), &[2]);

Re-exports§

pub use backend::default_backend_session;
pub use backend::BackendCachedDot;
pub use backend::BackendRuntimeCache;
pub use backend::BackendSession;
pub use backend::BackendSessionHost;
pub use backend::SessionCachedDot;
pub use backend::TensorAnalytic;
pub use backend::TensorBackend;
pub use backend::TensorBuffer;
pub use backend::TensorDeviceTransfer;
pub use backend::TensorDot;
pub use backend::TensorElementwise;
pub use backend::TensorFusion;
pub use backend::TensorIndexing;
pub use backend::TensorReduction;
pub use backend::TensorStructural;
pub use backend::TensorViewCanonicalization;
pub use cache::CacheStats;
pub use cache::RuntimeCacheControl;
pub use config::*;
pub use error::*;
pub use types::*;

Modules§

backend
cache
Cache accounting primitives shared by tensor backends and facade runtimes.
config
core
Lightweight backend-independent host tensor data model.
error
Runtime error types for tensor execution.
types
validate
Validation helpers shared across backends and exec layers.

Structs§

SliceSpec
Explicit slice descriptor.

Enums§

TensorRef
Core-neutral tensor input reference.

Type Aliases§

ShapeVec
Small tensor shape vector with inline capacity for common dynamic ranks.
StrideVec
Small tensor stride vector with signed element strides.