Config

Enum Config 

Source
pub enum Config {
Show 24 variants Attention(AttentionConfig), BatchNorm(BatchNormConfig), Bias(BiasConfig), Cache(CacheConfig), Cat(CatLayer), Conv2d(Conv2dConfig), CrossEntropy(CrossEntropyLossConfig), Dropout(DropoutConfig), Embedding(EmbeddingConfig), Flatten(FlattenLayer<Range<isize>>), KQV(KQVConfig), LayerNorm(LayerNormConfig), Linear(LinearConfig), MaxPool2d(MaxPool2dConfig), Mse, Relu, Reshape(ReshapeLayer<Reshape>), Rotary(RotaryEncodingConfig), ScaleShift(ScaleShiftConfig), Squeeze(SqueezeLayer), Stack(StackLayer), Sum(SumLayer), Tanh, Unsqueeze(UnsqueezeLayer),
}
Expand description

enumerates config for some burn layers

Variants§

§

Attention(AttentionConfig)

§

BatchNorm(BatchNormConfig)

§

Bias(BiasConfig)

§

Cache(CacheConfig)

§

Cat(CatLayer)

§

Conv2d(Conv2dConfig)

§

CrossEntropy(CrossEntropyLossConfig)

§

Dropout(DropoutConfig)

§

Embedding(EmbeddingConfig)

§

Flatten(FlattenLayer<Range<isize>>)

§

KQV(KQVConfig)

§

LayerNorm(LayerNormConfig)

§

Linear(LinearConfig)

§

MaxPool2d(MaxPool2dConfig)

§

Mse

§

Relu

§

Reshape(ReshapeLayer<Reshape>)

§

Rotary(RotaryEncodingConfig)

§

ScaleShift(ScaleShiftConfig)

§

Squeeze(SqueezeLayer)

§

Stack(StackLayer)

§

Sum(SumLayer)

§

Tanh

§

Unsqueeze(UnsqueezeLayer)

Implementations§

Source§

impl Config

Source

pub fn attention(heads: usize, mask: AttentionMask) -> Self

creates an attention config

Source

pub fn batch_norm(countfeatures: usize, epsilon: f32, momentum: f32) -> Self

creates a batch norm config

Source

pub fn bias(dim: usize) -> Self

creates a bias config

Source

pub fn cache(limit: usize) -> Self

creates a cache config

Source

pub fn dropout(chance: f32) -> Self

creates a dropout config

Source

pub fn embedding(input: usize, output: usize) -> Self

creates a embedding config

Source

pub fn flatten<R: RangeBounds<isize>>(dims: R) -> Self

creates a flatten config

Source

pub fn init<B: Backend>(&self, device: &B::Device) -> Layer<B>

initializes the layer

Source

pub fn layer_norm(dim: usize) -> Self

creates a layer norm config

Source

pub fn linear(bias: bool, input: usize, output: usize) -> Self

creates a linear config

Source

pub fn max_pool_2d(kernel: [usize; 2], strides: [usize; 2]) -> Self

creates a max pool 2d config

Source

pub fn relu() -> Self

creates a relu config

Source

pub fn reshape<R: Into<Reshape>>(args: R) -> Self

creates a reshape config

Source

pub fn rotary(distance: usize, head: usize) -> Self

creates a rotary config

Source

pub fn scale_shift() -> Self

creates a scale shift config

Source

pub fn set_attention_dropout(&mut self, dropout: f32) -> bool

sets the dropout if this is an attention layer

Source

pub fn tanh() -> Self

creates a tanh config

Source

pub fn w_scale(self, r: f32) -> Self

scales the initializer

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Config for Config

Source§

fn save<P>(&self, file: P) -> Result<(), Error>
where P: AsRef<Path>,

Saves the configuration to a file. Read more
Source§

fn load<P>(file: P) -> Result<Self, ConfigError>
where P: AsRef<Path>,

Loads the configuration from a file. Read more
Source§

fn load_binary(data: &[u8]) -> Result<Self, ConfigError>

Loads the configuration from a binary buffer. Read more
Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Decompose for Config

Source§

type Decomposition = Config

the decomposed type
Source§

fn compose(decomposition: Self::Decomposition) -> Self

recreates from the decomposition
Source§

fn decompose(self) -> Self::Decomposition

owned decomposition
Source§

fn decompose_cloned(&self) -> Self::Decomposition

decomposition that copies data
Source§

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<AttentionConfig> for Config

Source§

fn from(value: AttentionConfig) -> Self

Converts to this type from the input type.
Source§

impl From<BatchNormConfig> for Config

Source§

fn from(value: BatchNormConfig) -> Self

Converts to this type from the input type.
Source§

impl From<BiasConfig> for Config

Source§

fn from(value: BiasConfig) -> Self

Converts to this type from the input type.
Source§

impl From<CatLayer> for Config

Source§

fn from(value: CatLayer) -> Self

Converts to this type from the input type.
Source§

impl From<CrossEntropyLossConfig> for Config

Source§

fn from(value: CrossEntropyLossConfig) -> Self

Converts to this type from the input type.
Source§

impl From<DropoutConfig> for Config

Source§

fn from(value: DropoutConfig) -> Self

Converts to this type from the input type.
Source§

impl From<EmbeddingConfig> for Config

Source§

fn from(value: EmbeddingConfig) -> Self

Converts to this type from the input type.
Source§

impl From<FlattenLayer<Range<isize>>> for Config

Source§

fn from(value: FlattenLayer<Range<isize>>) -> Self

Converts to this type from the input type.
Source§

impl From<LayerNormConfig> for Config

Source§

fn from(value: LayerNormConfig) -> Self

Converts to this type from the input type.
Source§

impl From<LinearConfig> for Config

Source§

fn from(value: LinearConfig) -> Self

Converts to this type from the input type.
Source§

impl From<MaxPool2dConfig> for Config

Source§

fn from(value: MaxPool2dConfig) -> Self

Converts to this type from the input type.
Source§

impl From<MseLoss> for Config

Source§

fn from(_value: MseLoss) -> Self

Converts to this type from the input type.
Source§

impl From<Relu> for Config

Source§

fn from(_value: Relu) -> Self

Converts to this type from the input type.
Source§

impl From<ReshapeLayer<Reshape>> for Config

Source§

fn from(value: ReshapeLayer<Reshape>) -> Self

Converts to this type from the input type.
Source§

impl From<RotaryEncodingConfig> for Config

Source§

fn from(value: RotaryEncodingConfig) -> Self

Converts to this type from the input type.
Source§

impl From<SqueezeLayer> for Config

Source§

fn from(value: SqueezeLayer) -> Self

Converts to this type from the input type.
Source§

impl From<StackLayer> for Config

Source§

fn from(value: StackLayer) -> Self

Converts to this type from the input type.
Source§

impl From<SumLayer> for Config

Source§

fn from(value: SumLayer) -> Self

Converts to this type from the input type.
Source§

impl From<Tanh> for Config

Source§

fn from(_value: Tanh) -> Self

Converts to this type from the input type.
Source§

impl From<UnsqueezeLayer> for Config

Source§

fn from(value: UnsqueezeLayer) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Config

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Adaptor<()> for T

Source§

fn adapt(&self)

Adapt the type to be passed to a metric.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToLine for T
where T: Display,

Source§

fn to_line(&self) -> Line<'_>

Converts the value to a Line.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSpan for T
where T: Display,

Source§

fn to_span(&self) -> Span<'_>

Converts the value to a Span.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToText for T
where T: Display,

Source§

fn to_text(&self) -> Text<'_>

Converts the value to a Text.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,