pub enum Layer {
Linear {
name: String,
in_features: usize,
out_features: usize,
weight: Vec<Vec<f32>>,
bias: Vec<f32>,
},
Conv2d {
name: String,
in_channels: usize,
out_channels: usize,
kernel_size: usize,
padding: usize,
stride: usize,
weight: Vec<Vec<Vec<Vec<f32>>>>,
bias: Vec<f32>,
},
Activation {
name: String,
activation: Activation,
},
Flatten {
name: String,
},
Reshape {
name: String,
shape: Vec<usize>,
},
Residual {
name: String,
layers: Vec<Layer>,
},
}Expand description
Layer type definition for the universal inference system
Variants§
Linear
Fully connected (linear) layer
Fields
§
name: StringHuman-readable layer name, propagated from the exporter (e.g.
"fc1"). Used only for diagnostics / pretty-printing.
§
in_features: usizeInput feature count. Must match the size of the incoming 1D
tensor or Layer::forward returns an error.
Conv2d
2D Convolutional layer
Fields
Activation
Activation layer
Fields
§
activation: ActivationElement-wise function applied in place; see Activation::apply.
Flatten
Reshape/Flatten layer
Fields
Reshape
Reshape layer with specific dimensions
Fields
§
shape: Vec<usize>Target tensor shape. Supported lengths are 1 (1D [size]) and
3 (3D [channels, height, width]); other lengths cause
Layer::forward to return an error.
Residual
Residual/Skip connection (adds input to output)
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Layer
impl<'de> Deserialize<'de> for Layer
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Layer
impl RefUnwindSafe for Layer
impl Send for Layer
impl Sync for Layer
impl Unpin for Layer
impl UnsafeUnpin for Layer
impl UnwindSafe for Layer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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