Expand description
EdgeFirst HAL - Tensor Module
The edgefirst_tensor crate provides a unified interface for managing multi-dimensional arrays (tensors)
with support for different memory types, including Direct Memory Access (DMA), POSIX Shared Memory (Shm),
and system memory. The crate defines traits and structures for creating, reshaping, and mapping tensors into memory.
§Examples
use edgefirst_tensor::{Error, Tensor, TensorMemory, TensorTrait};
let tensor = Tensor::<f32>::new(&[2, 3, 4], Some(TensorMemory::Mem), Some("test_tensor"))?;
assert_eq!(tensor.memory(), TensorMemory::Mem);
assert_eq!(tensor.name(), "test_tensor");§Overview
The main structures and traits provided by the edgefirst_tensor crate are TensorTrait and TensorMapTrait,
which define the behavior of Tensors and their memory mappings, respectively.
The Tensor<T> struct wraps a backend-specific storage with optional image format metadata (PixelFormat),
while the TensorMap enum provides access to the underlying data. The TensorDyn type-erased enum
wraps Tensor<T> for runtime element-type dispatch.
Structs§
- Buffer
Identity - Unique identity for a tensor’s underlying buffer.
- DmaMap
- DmaTensor
- A tensor backed by DMA (Direct Memory Access) memory.
- MemMap
- MemTensor
- PboMap
- PboMapping
- Raw mapped pointer from a PBO. CPU-accessible while the buffer is mapped. The pointer is only valid between map and unmap calls.
- PboTensor
- A tensor backed by an OpenGL Pixel Buffer Object.
- Plane
Descriptor - Per-plane DMA-BUF descriptor for external buffer import.
- ShmMap
- ShmTensor
- Tensor
- Multi-backend tensor with optional image format metadata.
Enums§
- DType
- Element type discriminant for runtime type identification.
- Error
- Pixel
Format - Pixel format identifier.
- Pixel
Layout - Memory layout category.
- Tensor
Dyn - Type-erased tensor. Wraps a
Tensor<T>with runtime element type. - Tensor
Map - Tensor
Memory
Traits§
- PboOps
- Trait for PBO GL operations, implemented by the image crate.
- Tensor
MapTrait - Tensor
Trait
Functions§
- is_
dma_ available - Check if DMA memory allocation is available on this system.
- is_
shm_ available - Check if POSIX shared memory allocation is available on this system.