Skip to main content

SharedTensorAllocationDomain

Trait SharedTensorAllocationDomain 

Source
pub trait SharedTensorAllocationDomain:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn id(&self) -> AllocationDomainId;
    fn allocate(&self, dtype: DType, shape: &[usize]) -> Result<Tensor>;
}
Expand description

Backend-neutral owner of one shared tensor allocation domain.

CPU operation crates use this object-safe boundary to allocate results in the same managed domain without depending on a GPU provider crate.

§Examples

use std::sync::Arc;
use tenferro_tensor::SharedTensorAllocationDomain;

let _domain: Option<Arc<dyn SharedTensorAllocationDomain>> = None;

Required Methods§

Source

fn id(&self) -> AllocationDomainId

Return the stable identity shared by every allocation from this owner.

Source

fn allocate(&self, dtype: DType, shape: &[usize]) -> Result<Tensor>

Allocate an uninitialized compact column-major tensor in this domain.

§Errors

Returns a typed validation, unsupported-dtype, or backend allocation error.

Implementors§