pub struct Conv2D {
pub in_channels: usize,
pub out_channels: usize,
pub kernel_size: (usize, usize),
pub stride: (usize, usize),
pub padding: (usize, usize),
pub weights: Vec<Vec<Vec<Vec<f64>>>>,
pub bias: Vec<f64>,
}
Expand description
Represents a 2D convolution layer
Fields§
§in_channels: usize
Number of input channels
out_channels: usize
Number of output channels (number of filters)
kernel_size: (usize, usize)
Kernel size (height, width)
stride: (usize, usize)
Stride (height, width)
padding: (usize, usize)
Padding (height, width)
weights: Vec<Vec<Vec<Vec<f64>>>>
Weights (out_channels, in_channels, kernel_height, kernel_width)
bias: Vec<f64>
Biases (out_channels)
Implementations§
Source§impl Conv2D
impl Conv2D
Sourcepub fn new(
in_channels: usize,
out_channels: usize,
kernel_size: (usize, usize),
stride: (usize, usize),
padding: (usize, usize),
) -> Self
pub fn new( in_channels: usize, out_channels: usize, kernel_size: (usize, usize), stride: (usize, usize), padding: (usize, usize), ) -> Self
Creates a new Conv2D layer
§Arguments
in_channels
- Number of input channelsout_channels
- Number of output channelskernel_size
- Size of the convolving kernel (height, width)stride
- Stride of the convolution (height, width)padding
- Zero-padding added to both sides of the input (height, width)
§Example
use algos::ml::deep::conv::Conv2D;
let conv = Conv2D::new(3, 64, (3, 3), (1, 1), (1, 1));
Sourcepub fn forward(
&self,
input: &[Vec<Vec<Vec<f64>>>],
) -> (Vec<Vec<Vec<Vec<f64>>>>, Conv2DCache)
pub fn forward( &self, input: &[Vec<Vec<Vec<f64>>>], ) -> (Vec<Vec<Vec<Vec<f64>>>>, Conv2DCache)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Conv2D
impl RefUnwindSafe for Conv2D
impl Send for Conv2D
impl Sync for Conv2D
impl Unpin for Conv2D
impl UnwindSafe for Conv2D
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,
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