Trait burn::record::Record

pub trait Record<B>: Send
where B: Backend,
{ type Item<S: PrecisionSettings>: Serialize + DeserializeOwned; // Required methods fn into_item<S>(self) -> Self::Item<S> where S: PrecisionSettings; fn from_item<S>( item: Self::Item<S>, device: &<B as Backend>::Device, ) -> Self where S: PrecisionSettings; }
Expand description

Trait to define a family of types which can be recorded using any settings.

Required Associated Types§

type Item<S: PrecisionSettings>: Serialize + DeserializeOwned

Type of the item that can be serialized and deserialized.

Required Methods§

fn into_item<S>(self) -> Self::Item<S>

Convert the current record into the corresponding item that follows the given settings.

fn from_item<S>(item: Self::Item<S>, device: &<B as Backend>::Device) -> Self

Convert the given item into a record.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl<B> Record<B> for bool
where B: Backend,

§

type Item<S: PrecisionSettings> = bool

§

fn into_item<S>(self) -> <bool as Record<B>>::Item<S>

§

fn from_item<S>( item: <bool as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> bool

§

impl<B> Record<B> for f32
where B: Backend,

§

type Item<S: PrecisionSettings> = f32

§

fn into_item<S>(self) -> <f32 as Record<B>>::Item<S>

§

fn from_item<S>( item: <f32 as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> f32

§

impl<B> Record<B> for f64
where B: Backend,

§

type Item<S: PrecisionSettings> = f64

§

fn into_item<S>(self) -> <f64 as Record<B>>::Item<S>

§

fn from_item<S>( item: <f64 as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> f64

§

impl<B> Record<B> for i8
where B: Backend,

§

type Item<S: PrecisionSettings> = i8

§

fn into_item<S>(self) -> <i8 as Record<B>>::Item<S>

§

fn from_item<S>( item: <i8 as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> i8

§

impl<B> Record<B> for i16
where B: Backend,

§

type Item<S: PrecisionSettings> = i16

§

fn into_item<S>(self) -> <i16 as Record<B>>::Item<S>

§

fn from_item<S>( item: <i16 as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> i16

§

impl<B> Record<B> for i32
where B: Backend,

§

type Item<S: PrecisionSettings> = i32

§

fn into_item<S>(self) -> <i32 as Record<B>>::Item<S>

§

fn from_item<S>( item: <i32 as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> i32

§

impl<B> Record<B> for i64
where B: Backend,

§

type Item<S: PrecisionSettings> = i64

§

fn into_item<S>(self) -> <i64 as Record<B>>::Item<S>

§

fn from_item<S>( item: <i64 as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> i64

§

impl<B> Record<B> for u8
where B: Backend,

§

type Item<S: PrecisionSettings> = u8

§

fn into_item<S>(self) -> <u8 as Record<B>>::Item<S>

§

fn from_item<S>( item: <u8 as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> u8

§

impl<B> Record<B> for u16
where B: Backend,

§

type Item<S: PrecisionSettings> = u16

§

fn into_item<S>(self) -> <u16 as Record<B>>::Item<S>

§

fn from_item<S>( item: <u16 as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> u16

§

impl<B> Record<B> for u32
where B: Backend,

§

type Item<S: PrecisionSettings> = u32

§

fn into_item<S>(self) -> <u32 as Record<B>>::Item<S>

§

fn from_item<S>( item: <u32 as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> u32

§

impl<B> Record<B> for u64
where B: Backend,

§

type Item<S: PrecisionSettings> = u64

§

fn into_item<S>(self) -> <u64 as Record<B>>::Item<S>

§

fn from_item<S>( item: <u64 as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> u64

§

impl<B> Record<B> for ()
where B: Backend,

§

type Item<S: PrecisionSettings> = ()

§

fn into_item<S>(self) -> <() as Record<B>>::Item<S>

§

fn from_item<S>( _item: <() as Record<B>>::Item<S>, _device: &<B as Backend>::Device, )

§

impl<B> Record<B> for usize
where B: Backend,

§

type Item<S: PrecisionSettings> = usize

§

fn into_item<S>(self) -> <usize as Record<B>>::Item<S>

§

fn from_item<S>( item: <usize as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> usize

§

impl<B> Record<B> for String
where B: Backend,

§

type Item<S: PrecisionSettings> = String

§

fn into_item<S>(self) -> <String as Record<B>>::Item<S>

§

fn from_item<S>( item: <String as Record<B>>::Item<S>, _device: &<B as Backend>::Device, ) -> String

§

impl<B, R0, R1> Record<B> for (R0, R1)
where B: Backend, R0: Record<B>, R1: Record<B>,

§

type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>)

§

fn into_item<S>(self) -> <(R0, R1) as Record<B>>::Item<S>

§

fn from_item<S>( item: <(R0, R1) as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> (R0, R1)

§

impl<B, R0, R1, R2> Record<B> for (R0, R1, R2)
where B: Backend, R0: Record<B>, R1: Record<B>, R2: Record<B>,

§

type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>)

§

fn into_item<S>(self) -> <(R0, R1, R2) as Record<B>>::Item<S>

§

fn from_item<S>( item: <(R0, R1, R2) as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> (R0, R1, R2)

§

impl<B, R0, R1, R2, R3> Record<B> for (R0, R1, R2, R3)
where B: Backend, R0: Record<B>, R1: Record<B>, R2: Record<B>, R3: Record<B>,

§

type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>)

§

fn into_item<S>(self) -> <(R0, R1, R2, R3) as Record<B>>::Item<S>

§

fn from_item<S>( item: <(R0, R1, R2, R3) as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> (R0, R1, R2, R3)

§

impl<B, R0, R1, R2, R3, R4> Record<B> for (R0, R1, R2, R3, R4)
where B: Backend, R0: Record<B>, R1: Record<B>, R2: Record<B>, R3: Record<B>, R4: Record<B>,

§

type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>)

§

fn into_item<S>(self) -> <(R0, R1, R2, R3, R4) as Record<B>>::Item<S>

§

fn from_item<S>( item: <(R0, R1, R2, R3, R4) as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> (R0, R1, R2, R3, R4)

§

impl<B, R0, R1, R2, R3, R4, R5> Record<B> for (R0, R1, R2, R3, R4, R5)
where B: Backend, R0: Record<B>, R1: Record<B>, R2: Record<B>, R3: Record<B>, R4: Record<B>, R5: Record<B>,

§

type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>, <R5 as Record<B>>::Item<S>)

§

fn into_item<S>(self) -> <(R0, R1, R2, R3, R4, R5) as Record<B>>::Item<S>

§

fn from_item<S>( item: <(R0, R1, R2, R3, R4, R5) as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> (R0, R1, R2, R3, R4, R5)

§

impl<B, R0, R1, R2, R3, R4, R5, R6> Record<B> for (R0, R1, R2, R3, R4, R5, R6)
where B: Backend, R0: Record<B>, R1: Record<B>, R2: Record<B>, R3: Record<B>, R4: Record<B>, R5: Record<B>, R6: Record<B>,

§

type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>, <R5 as Record<B>>::Item<S>, <R6 as Record<B>>::Item<S>)

§

fn into_item<S>(self) -> <(R0, R1, R2, R3, R4, R5, R6) as Record<B>>::Item<S>

§

fn from_item<S>( item: <(R0, R1, R2, R3, R4, R5, R6) as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> (R0, R1, R2, R3, R4, R5, R6)

§

impl<B, R0, R1, R2, R3, R4, R5, R6, R7> Record<B> for (R0, R1, R2, R3, R4, R5, R6, R7)
where B: Backend, R0: Record<B>, R1: Record<B>, R2: Record<B>, R3: Record<B>, R4: Record<B>, R5: Record<B>, R6: Record<B>, R7: Record<B>,

§

type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>, <R5 as Record<B>>::Item<S>, <R6 as Record<B>>::Item<S>, <R7 as Record<B>>::Item<S>)

§

fn into_item<S>( self, ) -> <(R0, R1, R2, R3, R4, R5, R6, R7) as Record<B>>::Item<S>

§

fn from_item<S>( item: <(R0, R1, R2, R3, R4, R5, R6, R7) as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> (R0, R1, R2, R3, R4, R5, R6, R7)

§

impl<B, R0, R1, R2, R3, R4, R5, R6, R7, R8> Record<B> for (R0, R1, R2, R3, R4, R5, R6, R7, R8)
where B: Backend, R0: Record<B>, R1: Record<B>, R2: Record<B>, R3: Record<B>, R4: Record<B>, R5: Record<B>, R6: Record<B>, R7: Record<B>, R8: Record<B>,

§

type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>, <R5 as Record<B>>::Item<S>, <R6 as Record<B>>::Item<S>, <R7 as Record<B>>::Item<S>, <R8 as Record<B>>::Item<S>)

§

fn into_item<S>( self, ) -> <(R0, R1, R2, R3, R4, R5, R6, R7, R8) as Record<B>>::Item<S>

§

fn from_item<S>( item: <(R0, R1, R2, R3, R4, R5, R6, R7, R8) as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> (R0, R1, R2, R3, R4, R5, R6, R7, R8)

§

impl<B, R0, R1, R2, R3, R4, R5, R6, R7, R8, R9> Record<B> for (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9)
where B: Backend, R0: Record<B>, R1: Record<B>, R2: Record<B>, R3: Record<B>, R4: Record<B>, R5: Record<B>, R6: Record<B>, R7: Record<B>, R8: Record<B>, R9: Record<B>,

§

type Item<S: PrecisionSettings> = (<R0 as Record<B>>::Item<S>, <R1 as Record<B>>::Item<S>, <R2 as Record<B>>::Item<S>, <R3 as Record<B>>::Item<S>, <R4 as Record<B>>::Item<S>, <R5 as Record<B>>::Item<S>, <R6 as Record<B>>::Item<S>, <R7 as Record<B>>::Item<S>, <R8 as Record<B>>::Item<S>, <R9 as Record<B>>::Item<S>)

§

fn into_item<S>( self, ) -> <(R0, R1, R2, R3, R4, R5, R6, R7, R8, R9) as Record<B>>::Item<S>

§

fn from_item<S>( item: <(R0, R1, R2, R3, R4, R5, R6, R7, R8, R9) as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9)

§

impl<T, B> Record<B> for Option<T>
where T: Record<B>, B: Backend,

§

type Item<S: PrecisionSettings> = Option<<T as Record<B>>::Item<S>>

§

fn into_item<S>(self) -> <Option<T> as Record<B>>::Item<S>

§

fn from_item<S>( item: <Option<T> as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> Option<T>

§

impl<T, B> Record<B> for Vec<T>
where T: Record<B>, B: Backend,

§

type Item<S: PrecisionSettings> = Vec<<T as Record<B>>::Item<S>>

§

fn into_item<S>(self) -> <Vec<T> as Record<B>>::Item<S>

§

fn from_item<S>( item: <Vec<T> as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> Vec<T>

§

impl<T, B> Record<B> for HashMap<ParamId, T>
where T: Record<B>, B: Backend,

§

type Item<S: PrecisionSettings> = HashMap<String, <T as Record<B>>::Item<S>>

§

fn into_item<S>(self) -> <HashMap<ParamId, T> as Record<B>>::Item<S>

§

fn from_item<S>( item: <HashMap<ParamId, T> as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> HashMap<ParamId, T>

§

impl<const N: usize, T, B> Record<B> for [T; N]
where T: Record<B>, B: Backend,

§

type Item<S: PrecisionSettings> = Array<N, <T as Record<B>>::Item<S>>

The record item is an array of the record item of the elements. The reason why we wrap the array in a struct is because serde does not support deserializing arrays of variable size, see serde/issues/1937. for backward compatibility reasons. Serde APIs were created before const generics.

§

fn into_item<S>(self) -> <[T; N] as Record<B>>::Item<S>

§

fn from_item<S>( item: <[T; N] as Record<B>>::Item<S>, device: &<B as Backend>::Device, ) -> [T; N]

Implementors§

§

impl<B> Record<B> for ConstantRecord
where B: Backend,

§

impl<B> Record<B> for MultiHeadAttentionRecord<B>
where B: Backend,

§

impl<B> Record<B> for Conv1dRecord<B>
where B: Backend,

§

impl<B> Record<B> for Conv2dRecord<B>
where B: Backend,

§

impl<B> Record<B> for Conv3dRecord<B>
where B: Backend,

§

impl<B> Record<B> for ConvTranspose1dRecord<B>
where B: Backend,

§

impl<B> Record<B> for ConvTranspose2dRecord<B>
where B: Backend,

§

impl<B> Record<B> for ConvTranspose3dRecord<B>
where B: Backend,

§

impl<B> Record<B> for DeformConv2dRecord<B>
where B: Backend,

§

impl<B> Record<B> for GruRecord<B>
where B: Backend,

§

impl<B> Record<B> for BinaryCrossEntropyLossRecord<B>
where B: Backend,

§

impl<B> Record<B> for CrossEntropyLossRecord<B>
where B: Backend,

§

impl<B> Record<B> for BiLstmRecord<B>
where B: Backend,

§

impl<B> Record<B> for EmbeddingRecord<B>
where B: Backend,

§

impl<B> Record<B> for GateControllerRecord<B>
where B: Backend,

§

impl<B> Record<B> for GroupNormRecord<B>
where B: Backend,

§

impl<B> Record<B> for InstanceNormRecord<B>
where B: Backend,

§

impl<B> Record<B> for LayerNormRecord<B>
where B: Backend,

§

impl<B> Record<B> for LinearRecord<B>
where B: Backend,

§

impl<B> Record<B> for LstmRecord<B>
where B: Backend,

§

impl<B> Record<B> for PReluRecord<B>
where B: Backend,

§

impl<B> Record<B> for PositionalEncodingRecord<B>
where B: Backend,

§

impl<B> Record<B> for RmsNormRecord<B>
where B: Backend,

§

impl<B> Record<B> for RotaryEncodingRecord<B>
where B: Backend,

§

impl<B> Record<B> for SwiGluRecord<B>
where B: Backend,

§

impl<B> Record<B> for PositionWiseFeedForwardRecord<B>
where B: Backend,

§

impl<B> Record<B> for TransformerDecoderLayerRecord<B>
where B: Backend,

§

impl<B> Record<B> for TransformerDecoderRecord<B>
where B: Backend,

§

impl<B> Record<B> for TransformerEncoderLayerRecord<B>
where B: Backend,

§

impl<B> Record<B> for TransformerEncoderRecord<B>
where B: Backend,

§

impl<B> Record<B> for bf16
where B: Backend,

§

impl<B> Record<B> for f16
where B: Backend,

§

impl<B, const D: usize> Record<B> for Param<Tensor<B, D>>
where B: Backend,

§

type Item<S: PrecisionSettings> = ParamSerde<FloatTensorSerde<S>>

§

impl<B, const D: usize> Record<B> for Param<Tensor<B, D, Bool>>
where B: Backend,

§

type Item<S: PrecisionSettings> = ParamSerde<BoolTensorSerde>

§

impl<B, const D: usize> Record<B> for Param<Tensor<B, D, Int>>
where B: Backend,

§

type Item<S: PrecisionSettings> = ParamSerde<IntTensorSerde<S>>

§

impl<B, const D: usize> Record<B> for BatchNormRecord<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for WeightDecayState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for MomentumState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for AdaGradState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for AdamState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for AdamWState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for AdaptiveMomentumState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for AdaptiveMomentumWState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for CenteredState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for LrDecayState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for RmsPropMomentumState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for RmsPropState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for SgdState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for SquareAvgState<B, D>
where B: Backend,

§

impl<B, const D: usize> Record<B> for Tensor<B, D>
where B: Backend,

§

type Item<S: PrecisionSettings> = FloatTensorSerde<S>

§

impl<B, const D: usize> Record<B> for Tensor<B, D, Bool>
where B: Backend,

§

type Item<S: PrecisionSettings> = BoolTensorSerde

§

impl<B, const D: usize> Record<B> for Tensor<B, D, Int>
where B: Backend,

§

type Item<S: PrecisionSettings> = IntTensorSerde<S>

§

impl<E, B> Record<B> for DataSerialize<E>
where E: Element, B: Backend,

§

impl<O, B> Record<B> for AdaptorRecord<O, B>

§

impl<O, B> Record<B> for AdaptorRecordV1<O, B>
where O: SimpleOptimizer<B>, B: Backend,