arnaucube
arnaucube/poulpyPublic Self-hosted repository
poulpy/backend/src/hal/delegates/mat_znx.rs
backend/src/hal/delegates/mat_znx.rsRaw
 1use crate::hal::{
 2    api::{MatZnxAlloc, MatZnxAllocBytes, MatZnxFromBytes},
 3    layouts::{Backend, MatZnxOwned, Module},
 4    oep::{MatZnxAllocBytesImpl, MatZnxAllocImpl, MatZnxFromBytesImpl},
 5};
 6
 7impl<B> MatZnxAlloc for Module<B>
 8where
 9    B: Backend + MatZnxAllocImpl<B>,
10{
11    fn mat_znx_alloc(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> MatZnxOwned {
12        B::mat_znx_alloc_impl(self, rows, cols_in, cols_out, size)
13    }
14}
15
16impl<B> MatZnxAllocBytes for Module<B>
17where
18    B: Backend + MatZnxAllocBytesImpl<B>,
19{
20    fn mat_znx_alloc_bytes(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize) -> usize {
21        B::mat_znx_alloc_bytes_impl(self, rows, cols_in, cols_out, size)
22    }
23}
24
25impl<B> MatZnxFromBytes for Module<B>
26where
27    B: Backend + MatZnxFromBytesImpl<B>,
28{
29    fn mat_znx_from_bytes(&self, rows: usize, cols_in: usize, cols_out: usize, size: usize, bytes: Vec<u8>) -> MatZnxOwned {
30        B::mat_znx_from_bytes_impl(self, rows, cols_in, cols_out, size, bytes)
31    }
32}