mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 05:06:44 +01:00
Add Hardware Abstraction Layer (#56)
This commit is contained in:
committed by
GitHub
parent
833520b163
commit
0e0745065e
17
backend/src/hal/api/mat_znx.rs
Normal file
17
backend/src/hal/api/mat_znx.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use crate::hal::layouts::MatZnxOwned;
|
||||
|
||||
/// Allocates as [crate::hal::layouts::MatZnx].
|
||||
pub trait MatZnxAlloc {
|
||||
fn mat_znx_alloc(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> MatZnxOwned;
|
||||
}
|
||||
|
||||
/// Returns the size in bytes to allocate a [crate::hal::layouts::MatZnx].
|
||||
pub trait MatZnxAllocBytes {
|
||||
fn mat_znx_alloc_bytes(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> usize;
|
||||
}
|
||||
|
||||
/// Consume a vector of bytes into a [crate::hal::layouts::MatZnx].
|
||||
/// User must ensure that bytes is memory aligned and that it length is equal to [MatZnxAllocBytes].
|
||||
pub trait MatZnxFromBytes {
|
||||
fn mat_znx_from_bytes(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize, bytes: Vec<u8>) -> MatZnxOwned;
|
||||
}
|
||||
Reference in New Issue
Block a user