fn tri_bool<B: Backend>(
rows: usize,
cols: usize,
offset: i64,
lower: bool,
device: &Device<B>,
) -> BoolTensor<B>Expand description
Build a [rows, cols] triangular boolean mask on-device.
Mirrors tri_mask in Burn: with matrix = row - col, the result is
matrix < -offset when lower (the tril_mask/lower-triangle region) and
matrix > -offset otherwise (the triu_mask/upper-triangle region) — i.e.
the original row - col + offset ≷ 0 test with offset folded into the
comparison threshold.
Built from on-device arange/comparison rather than uploaded host bool
data: cubecl backends reject a Bool(Native) bool_from_data, and the
comparison output here adopts the device’s configured bool store.