1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
mod fill;
mod map;
mod reduce;
mod reduce_last_dim;
mod zero;
mod zip_map;
pub struct Cpu;
pub use fill::*;
pub use map::*;
pub use reduce::*;
pub use reduce_last_dim::*;
pub use zero::*;
pub use zip_map::*;
pub trait Device<T: crate::arrays::CountElements>:
FillElements<T>
+ ZipMapElements<T, T>
+ MapElements<T>
+ ReduceElements<T>
+ AllocateZeros
+ ReduceLastDim<T>
+ ZipMapElements<T, <Self as ReduceLastDim<T>>::Reduced>
{
}
impl Device<f32> for Cpu {}
impl<T: crate::arrays::CountElements, const M: usize> Device<[T; M]> for Cpu where
Cpu: Device<T>
+ ReduceLastDim<[T; M]>
+ ZipMapElements<[T; M], <Self as ReduceLastDim<[T; M]>>::Reduced>
{
}
pub trait HasDevice: crate::arrays::HasArrayType {
type Device: Device<Self::Array>;
}