pub struct Mask<B: Backend>(pub BoolTensor<B>);Expand description
A boolean mask primitive used with F::mask_fill.
Mirrors the slice of the bool-tensor API needed to build and broadcast the causal masks in the custom backward (construct → reshape → expand).
Tuple Fields§
§0: BoolTensor<B>Implementations§
Source§impl<B: Backend> Mask<B>
impl<B: Backend> Mask<B>
Sourcepub fn tril_mask(
rows: usize,
cols: usize,
offset: i64,
device: &Device<B>,
) -> Self
pub fn tril_mask( rows: usize, cols: usize, offset: i64, device: &Device<B>, ) -> Self
[rows, cols] mask that is true strictly above the offset diagonal.
Matches Tensor::tril_mask: the
true entries are the region a tril would fill.
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for Mask<B>where
<B as BackendTypes>::BoolTensorPrimitive: Freeze,
impl<B> RefUnwindSafe for Mask<B>where
<B as BackendTypes>::BoolTensorPrimitive: RefUnwindSafe,
impl<B> Send for Mask<B>
impl<B> Sync for Mask<B>
impl<B> Unpin for Mask<B>where
<B as BackendTypes>::BoolTensorPrimitive: Unpin,
impl<B> UnsafeUnpin for Mask<B>where
<B as BackendTypes>::BoolTensorPrimitive: UnsafeUnpin,
impl<B> UnwindSafe for Mask<B>where
<B as BackendTypes>::BoolTensorPrimitive: UnwindSafe,
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