triton.language.tensor

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

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

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

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

tensor 还定义了大多数魔术/dunder 方法,因此您可以编写 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 tensor 中所有元素沿所提供 axis 的 reduce_of。

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

转置二维张量。

类型