triton.language.tensor

class triton.language.tensor(self, handle, type: dtype)

表示一个 N 维的值或指针数组。

tensor 是 Triton 程序中的基本数据结构。 triton.language 中的大多数函数都对张量进行操作并返回张量。

这里大多数命名的成员函数都是 triton.language 中独立函数的副本。例如,triton.language.sqrt(x) 等同于 x.sqrt()

tensor 也定义了大多数魔法/双下划线方法,因此你可以编写 x+yx << 2 等表达式。

构造函数

__init__(self, handle, type: dtype)

不由用户代码调用。

方法

__init__(self, handle, type)

不由用户代码调用。

abs(self[, _semantic])

转发至 abs() 独立函数

advance(self, offsets[, _semantic])

转发至 advance() 独立函数

argmax(input, axis[, tie_break_left, keep_dims])

返回 input 张量中沿给定 axis 的所有元素的最大索引。

argmin(input, axis[, tie_break_left, keep_dims])

返回 input 张量中沿给定 axis 的所有元素的最小索引。

associative_scan(self, axis, combine_fn[, ...])

转发至 associative_scan() 独立函数

atomic_add(self, val[, mask, sem, scope, ...])

转发至 atomic_add() 独立函数

atomic_and(self, val[, mask, sem, scope, ...])

转发至 atomic_and() 独立函数

atomic_cas(self, cmp, val[, sem, scope, ...])

转发至 atomic_cas() 独立函数

atomic_max(self, val[, mask, sem, scope, ...])

转发至 atomic_max() 独立函数

atomic_min(self, val[, mask, sem, scope, ...])

转发至 atomic_min() 独立函数

atomic_or(self, val[, mask, sem, scope, ...])

转发至 atomic_or() 独立函数

atomic_xchg(self, val[, mask, sem, scope, ...])

转发至 atomic_xchg() 独立函数

atomic_xor(self, val[, mask, sem, scope, ...])

转发至 atomic_xor() 独立函数

broadcast_to(self, *shape[, _semantic])

转发至 broadcast_to() 独立函数

cast(self, dtype[, fp_downcast_rounding, ...])

转发至 cast() 独立函数

cdiv(x, div)

计算 x 除以 div 的向上取整除法。

ceil(self[, _semantic])

转发至 ceil() 独立函数

cos(self[, _semantic])

转发至 cos() 独立函数

cumprod(input[, axis, reverse])

返回 input 张量中沿给定 axis 的所有元素的累积积。

cumsum(input[, axis, reverse, dtype])

返回 input 张量中沿给定 axis 的所有元素的累积和。

erf(self[, _semantic])

转发至 erf() 独立函数

exp(self[, _semantic])

转发至 exp() 独立函数

exp2(self[, _semantic])

转发至 exp2() 独立函数

expand_dims(self, axis[, _semantic])

转发至 expand_dims() 独立函数

flip(x[, dim])

沿维度 dim 翻转张量 x

floor(self[, _semantic])

转发至 floor() 独立函数

gather(self, index, axis[, _semantic])

转发至 gather() 独立函数

histogram(self, num_bins[, mask, _semantic, ...])

转发至 histogram() 独立函数

item(self[, _semantic, _generator])

转发至 item() 独立函数

log(self[, _semantic])

转发至 log() 独立函数

log2(self[, _semantic])

转发至 log2() 独立函数

logical_and(self, other[, _semantic])

logical_or(self, other[, _semantic])

max(input[, axis, return_indices, ...])

返回 input 张量中沿给定 axis 的所有元素的最大值。

min(input[, axis, return_indices, ...])

返回 input 张量中沿给定 axis 的所有元素的最小值。

permute(self, *dims[, _semantic])

转发至 permute() 独立函数

ravel(x[, can_reorder])

返回 x 的连续扁平视图。

reduce(self, axis, combine_fn[, keep_dims, ...])

转发至 reduce() 独立函数

reduce_or(input, axis[, keep_dims])

返回 input 张量中沿指定 axis 的所有元素的 reduce_or 结果

reshape(self, *shape[, can_reorder, ...])

转发至 reshape() 独立函数

rsqrt(self[, _semantic])

转发至 rsqrt() 独立函数

sigmoid(x)

计算 x 的元素级 Sigmoid。

sin(self[, _semantic])

转发至 sin() 独立函数

softmax(x[, dim, keep_dims, ieee_rounding])

计算 x 的元素级 Softmax。

sort(self[, dim, descending])

split(self[, _semantic, _generator])

转发至 split() 独立函数

sqrt(self[, _semantic])

转发至 sqrt() 独立函数

sqrt_rn(self[, _semantic])

转发至 sqrt_rn() 独立函数

store(self, value[, mask, boundary_check, ...])

转发至 store() 独立函数

sum(input[, axis, keep_dims, dtype])

返回 input 张量中沿给定 axis 的所有元素的和。

to(self, dtype[, fp_downcast_rounding, ...])

tensor.cast() 的别名。

trans(self, *dims[, _semantic])

转发至 trans() 独立函数

view(self, *shape[, _semantic])

转发至 view() 独立函数

xor_sum(input[, axis, keep_dims])

返回 input 张量中沿给定 axis 的所有元素的异或和。

属性

T

转置一个 2D 张量。

类型