ruda-model 0.21.3

Ruda model configuration, module parameters, records and data loading.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub use ruda_model_macros::Record;
use ruda_tensor::api::backend::Backend;

use super::PrecisionSettings;
use serde::{Serialize, de::DeserializeOwned};

/// Trait to define a family of types which can be recorded using any [settings](PrecisionSettings).
pub trait Record<B: Backend>: Send {
    /// Type of the item that can be serialized and deserialized.
    type Item<S: PrecisionSettings>: Serialize + DeserializeOwned + Clone;

    /// Convert the current record into the corresponding item that follows the given [settings](PrecisionSettings).
    fn into_item<S: PrecisionSettings>(self) -> Self::Item<S>;

    /// Convert the given item into a record.
    fn from_item<S: PrecisionSettings>(item: Self::Item<S>, device: &B::Device) -> Self;
}