pub enum StringPadding {
Same,
Valid,
}Expand description
The string-padding modes a Conv{1,2,3}d may be configured with, mirroring
the padding: str branch of torch.nn.Conv{1,2,3}d
(torch/nn/modules/conv.py:111-120, valid_padding_strings = {"same", "valid"}).
StringPadding::Validis equivalent topadding = 0(no padding;aten/src/ATen/native/Convolution.cpp:1122-1124padding == "valid" -> convolution_symint(.., {{0}}, ..)).StringPadding::Samepads so that, forstride = 1, the output spatial size equals the input spatial size. The total pad per dim isdilation * (kernel - 1), split ASYMMETRICALLY asleft = total / 2,right = total - left(the END gets the extra pad whentotalis odd), mirroring_pooling_same_mode_padding_lr(aten/src/ATen/native/Pool.h:91-107) and the matching_ConvNd.__init___reversed_padding_repeated_twicearithmetic (conv.py:143-155).'same'is rejected for strided convolutions (conv.py:117-120/Convolution.cpp:1071).
Variants§
Same
padding='same' — pad so output spatial size == input spatial size
(stride must be 1). Asymmetric split per [same_pad_lr].
Valid
padding='valid' — no padding (equivalent to padding = 0).
Trait Implementations§
Source§impl Clone for StringPadding
impl Clone for StringPadding
Source§fn clone(&self) -> StringPadding
fn clone(&self) -> StringPadding
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for StringPadding
Source§impl Debug for StringPadding
impl Debug for StringPadding
impl Eq for StringPadding
Source§impl PartialEq for StringPadding
impl PartialEq for StringPadding
Source§fn eq(&self, other: &StringPadding) -> bool
fn eq(&self, other: &StringPadding) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for StringPadding
Auto Trait Implementations§
impl Freeze for StringPadding
impl RefUnwindSafe for StringPadding
impl Send for StringPadding
impl Sync for StringPadding
impl Unpin for StringPadding
impl UnsafeUnpin for StringPadding
impl UnwindSafe for StringPadding
Blanket Implementations§
impl<T> Boilerplate for T
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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