rstsr_core/storage/
conversion.rs

1use crate::prelude_dev::*;
2
3pub trait DeviceChangeAPI<'l, BOut, R, T, D>
4where
5    Self: DeviceRawAPI<T>,
6    BOut: DeviceRawAPI<T>,
7    D: DimAPI,
8    R: DataAPI<Data = Self::Raw>,
9{
10    type Repr: DataAPI<Data = BOut::Raw>;
11    type ReprTo: DataAPI<Data = BOut::Raw>;
12
13    fn change_device(tensor: TensorAny<R, T, Self, D>, device: &BOut) -> Result<TensorAny<Self::Repr, T, BOut, D>>;
14
15    fn into_device(
16        tensor: TensorAny<R, T, Self, D>,
17        device: &BOut,
18    ) -> Result<TensorAny<DataOwned<BOut::Raw>, T, BOut, D>>;
19
20    fn to_device(tensor: &'l TensorAny<R, T, Self, D>, device: &BOut) -> Result<TensorAny<Self::ReprTo, T, BOut, D>>;
21}