Skip to main content

Crate edgefirst_tensor

Crate edgefirst_tensor 

Source
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§

BufferIdentity
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.
PlaneDescriptor
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
PixelFormat
Pixel format identifier.
PixelLayout
Memory layout category.
TensorDyn
Type-erased tensor. Wraps a Tensor<T> with runtime element type.
TensorMap
TensorMemory

Traits§

PboOps
Trait for PBO GL operations, implemented by the image crate.
TensorMapTrait
TensorTrait

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.

Type Aliases§

Result