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 is the TensorTrait and TensorMapTrait traits,
which define the behavior of Tensors and their memory mappings, respectively.
The Tensor enum encapsulates different tensor implementations based on the memory type, while the TensorMap enum
provides access to the underlying data.
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.
- ShmMap
- ShmTensor
Enums§
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.