Skip to main content

MaskTile

Enum MaskTile 

Source
pub enum MaskTile<F: Float> {
    Materialized(MaterializedTileMask<F>),
    Logical(LogicalTileMask),
}
Expand description

Mask tile for Tile Attention. It is an additive mask: the result of apply should be added, not multiplied.

Variants§

§

Materialized(MaterializedTileMask<F>)

When a mask tensor is supplied. Also contains a logical part.

§

Logical(LogicalTileMask)

When no mask tensor is supplied. Used for out-of-bounds and causal mask.

Implementations§

Source§

impl<F: Float> MaskTile<F>

Source§

impl<F: Float> MaskTile<F>

Source

pub fn new( out_of_bounds: ComptimeOption<Coords2d>, config: MaskConfig, ) -> MaskTile<F>

Source

pub fn update<E: Numeric, ES: Size>( &mut self, new_origin: Coords2d, tile: ComptimeOption<StridedTile<E, ES>>, )

Loads the mask data into the fragment if a tile is given; otherwise only updates the logical mask’s origin.

Source

pub fn __expand_new( scope: &mut Scope, out_of_bounds: <ComptimeOption<Coords2d> as RudaType>::ExpandType, config: MaskConfig, ) -> <MaskTile<F> as RudaType>::ExpandType

Source

pub fn __expand_update<E: Numeric, ES: Size>( scope: &mut Scope, this: <Self as RudaType>::ExpandType, new_origin: <Coords2d as RudaType>::ExpandType, tile: <ComptimeOption<StridedTile<E, ES>> as RudaType>::ExpandType, ) -> <() as RudaType>::ExpandType

Trait Implementations§

Source§

impl<F: Float> Mask for MaskTile<F>

Source§

fn should_mask(&self, local_pos: Coords2d) -> bool

Source§

fn __expand_should_mask( scope: &mut Scope, this: Self::ExpandType, local_pos: <(u32, u32) as RudaType>::ExpandType, ) -> <bool as RudaType>::ExpandType

Source§

impl<F: Float> RudaDebug for MaskTile<F>

Source§

fn set_debug_name(&self, scope: &mut Scope, name: &'static str)

Set the debug name of this type’s expansion. Should do nothing for types that don’t appear at runtime
Source§

impl<F: Float> RudaType for MaskTile<F>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoComptime for T

Source§

fn comptime(self) -> Self

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.