arnaucube
arnaucube/poulpyPublic Self-hosted repository
poulpy/backend/src/hal/api/mat_znx.rs
backend/src/hal/api/mat_znx.rsRaw
 1use crate::hal::layouts::MatZnxOwned;
 2
 3/// Allocates as [crate::hal::layouts::MatZnx].
 4pub trait MatZnxAlloc {
 5    fn mat_znx_alloc(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> MatZnxOwned;
 6}
 7
 8/// Returns the size in bytes to allocate a [crate::hal::layouts::MatZnx].
 9pub trait MatZnxAllocBytes {
10    fn mat_znx_alloc_bytes(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> usize;
11}
12
13/// Consume a vector of bytes into a [crate::hal::layouts::MatZnx].
14/// User must ensure that bytes is memory aligned and that it length is equal to [MatZnxAllocBytes].
15pub trait MatZnxFromBytes {
16    fn mat_znx_from_bytes(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize, bytes: Vec<u8>) -> MatZnxOwned;
17}