# triton.language.semantic.less_than ## 1. OP 概述 简介:用于比较两个张量的元素, 与`<`等价。 函数原型: ```python triton.language.semantic.less_than( input: tl.tensor, other: tl.tensor, builder: ir.builder ) -> tl.tensor ``` 作为`tensor`的内置运算符使用, 如`x 相对社区能力缺失且无法实现 Triton-Ascend 对比 GPU 缺失fp64的支持能力。uint, fp8支持中。 ### 2.4 使用方法 以下示例实现了对三维张量`x0`、`x1`做小于运算: ```python @triton.jit def triton_lt_3d(in_ptr0, in_ptr1, out_ptr0, L: tl.constexpr, M: tl.constexpr, N: tl.constexpr): lblk_idx = tl.arange(0, L) mblk_idx = tl.arange(0, M) nblk_idx = tl.arange(0, N) idx = lblk_idx[:, None, None] * N * M + mblk_idx[None, :, None] * N + nblk_idx[None, None, :] x0 = tl.load(in_ptr0 + idx) x1 = tl.load(in_ptr1 + idx) ret = x0 < x1 odx = lblk_idx[:, None, None] * N * M + mblk_idx[None, :, None] * N + nblk_idx[None, None, :] tl.store(out_ptr0 + odx, ret) ```