pub enum PadMode {
Constant(f32),
Reflect,
Replicate,
Circular,
}Expand description
An operation in the RLX IR graph.
Operations are categorized for fusion analysis:
- Element-wise ops fuse with anything reading their output
How
Op::Padfills the region added around the input.
Semantics match NumPy pad / PyTorch F.pad:
Constant(v)— fill with the scalarv.Reflect— mirror across the edge, excluding the edge element (abcd→cb|abcd|cb). Requirespad < axis_len.Replicate— repeat the edge element (abcd→aa|abcd|dd).Circular— wrap around (abcd→cd|abcd|ab). Requirespad ≤ axis_len.
Not Eq/Hash because Constant carries an f32 — mirrors Op, which
already holds f32 attributes (e.g. eps) and is only PartialEq.
Variants§
Constant(f32)
Fill padded positions with a constant scalar.
Reflect
Mirror across the edge, excluding the edge element.
Replicate
Repeat the edge element.
Circular
Wrap around (periodic).
Trait Implementations§
impl Copy for PadMode
Source§impl<'de> Deserialize<'de> for PadMode
impl<'de> Deserialize<'de> for PadMode
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PadMode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PadMode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for PadMode
impl Serialize for PadMode
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for PadMode
Auto Trait Implementations§
impl Freeze for PadMode
impl RefUnwindSafe for PadMode
impl Send for PadMode
impl Sync for PadMode
impl Unpin for PadMode
impl UnsafeUnpin for PadMode
impl UnwindSafe for PadMode
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> 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