pub struct Conv1d {
pub weight: Tensor,
pub bias: Option<Tensor>,
pub stride: usize,
pub padding: (isize, isize),
}Expand description
1D convolution: y = conv1d(x, weight) + bias.
Weight shape: [out_channels, in_channels, kernel], optional bias shape: [out_channels].
stride and padding are stored on the module so Layer::forward stays parameter-free.
Fields§
§weight: Tensor§bias: Option<Tensor>§stride: usize§padding: (isize, isize)Implementations§
Source§impl Conv1d
impl Conv1d
Sourcepub fn new(weight: Tensor, bias: Option<Tensor>) -> Self
pub fn new(weight: Tensor, bias: Option<Tensor>) -> Self
Create a Conv1d from existing weight (and optional bias) tensors.
Sourcepub fn with_dims(
in_channels: usize,
out_channels: usize,
kernel: usize,
dtype: DType,
) -> Self
pub fn with_dims( in_channels: usize, out_channels: usize, kernel: usize, dtype: DType, ) -> Self
Create a Conv1d with deterministic sin() initialization, zero bias.
pub fn with_stride(self, stride: usize) -> Self
pub fn with_padding(self, padding: (isize, isize)) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Conv1d
impl !RefUnwindSafe for Conv1d
impl Send for Conv1d
impl Sync for Conv1d
impl Unpin for Conv1d
impl UnsafeUnpin for Conv1d
impl !UnwindSafe for Conv1d
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> 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