triton.language.tensor¶
- class triton.language.tensor(self, handle, type: dtype)¶
Represents an N-dimensional array of values or pointers.
tensor
is the fundamental data structure in Triton programs. Most functions intriton.language
operate on and return tensors.Most of the named member functions here are duplicates of the free functions in
triton.language
. For example,triton.language.sqrt(x)
is equivalent tox.sqrt()
.tensor
also defines most of the magic/dunder methods, so you can writex+y
,x << 2
, etc.Constructors
- __init__(self, handle, type: dtype)¶
Not called by user code.
Methods
__init__
(self, handle, type)Not called by user code.
abs
(self[, _semantic])Forwards to
abs()
free functionadvance
(self, offsets[, _semantic])Forwards to
advance()
free functionargmax
(input, axis[, tie_break_left, keep_dims])Returns the maximum index of all elements in the
input
tensor along the providedaxis
argmin
(input, axis[, tie_break_left, keep_dims])Returns the minimum index of all elements in the
input
tensor along the providedaxis
associative_scan
(self, axis, combine_fn[, ...])Forwards to
associative_scan()
free functionatomic_add
(self, val[, mask, sem, scope, ...])Forwards to
atomic_add()
free functionatomic_and
(self, val[, mask, sem, scope, ...])Forwards to
atomic_and()
free functionatomic_cas
(self, cmp, val[, sem, scope, ...])Forwards to
atomic_cas()
free functionatomic_max
(self, val[, mask, sem, scope, ...])Forwards to
atomic_max()
free functionatomic_min
(self, val[, mask, sem, scope, ...])Forwards to
atomic_min()
free functionatomic_or
(self, val[, mask, sem, scope, ...])Forwards to
atomic_or()
free functionatomic_xchg
(self, val[, mask, sem, scope, ...])Forwards to
atomic_xchg()
free functionatomic_xor
(self, val[, mask, sem, scope, ...])Forwards to
atomic_xor()
free functionbroadcast_to
(self, *shape[, _semantic])Forwards to
broadcast_to()
free functioncast
(self, dtype[, fp_downcast_rounding, ...])Forwards to
cast()
free functioncdiv
(x, div)Computes the ceiling division of
x
bydiv
ceil
(self[, _semantic])Forwards to
ceil()
free functioncos
(self[, _semantic])Forwards to
cos()
free functioncumprod
(input[, axis, reverse])Returns the cumprod of all elements in the
input
tensor along the providedaxis
cumsum
(input[, axis, reverse, dtype])Returns the cumsum of all elements in the
input
tensor along the providedaxis
erf
(self[, _semantic])Forwards to
erf()
free functionexp
(self[, _semantic])Forwards to
exp()
free functionexp2
(self[, _semantic])Forwards to
exp2()
free functionexpand_dims
(self, axis[, _semantic])Forwards to
expand_dims()
free functionflip
(x[, dim])Flips a tensor x along the dimension dim.
floor
(self[, _semantic])Forwards to
floor()
free functiongather
(self, index, axis[, _semantic])Forwards to
gather()
free functionhistogram
(self, num_bins[, mask, _semantic, ...])Forwards to
histogram()
free functionitem
(self[, _semantic, _generator])Forwards to
item()
free functionlog
(self[, _semantic])Forwards to
log()
free functionlog2
(self[, _semantic])Forwards to
log2()
free functionlogical_and
(self, other[, _semantic])logical_or
(self, other[, _semantic])max
(input[, axis, return_indices, ...])Returns the maximum of all elements in the
input
tensor along the providedaxis
min
(input[, axis, return_indices, ...])Returns the minimum of all elements in the
input
tensor along the providedaxis
permute
(self, *dims[, _semantic])Forwards to
permute()
free functionravel
(x[, can_reorder])Returns a contiguous flattened view of
x
.reduce
(self, axis, combine_fn[, keep_dims, ...])Forwards to
reduce()
free functionreduce_or
(input, axis[, keep_dims])Returns the reduce_of of all elements in the
input
tensor along the providedaxis
reshape
(self, *shape[, can_reorder, ...])Forwards to
reshape()
free functionrsqrt
(self[, _semantic])Forwards to
rsqrt()
free functionsigmoid
(x)Computes the element-wise sigmoid of
x
.sin
(self[, _semantic])Forwards to
sin()
free functionsoftmax
(x[, dim, keep_dims, ieee_rounding])Computes the element-wise softmax of
x
.sort
(self[, dim, descending])split
(self[, _semantic, _generator])Forwards to
split()
free functionsqrt
(self[, _semantic])Forwards to
sqrt()
free functionsqrt_rn
(self[, _semantic])Forwards to
sqrt_rn()
free functionstore
(self, value[, mask, boundary_check, ...])Forwards to
store()
free functionsum
(input[, axis, keep_dims, dtype])Returns the sum of all elements in the
input
tensor along the providedaxis
to
(self, dtype[, fp_downcast_rounding, ...])Alias for
tensor.cast()
.trans
(self, *dims[, _semantic])Forwards to
trans()
free functionview
(self, *shape[, _semantic])Forwards to
view()
free functionxor_sum
(input[, axis, keep_dims])Returns the xor sum of all elements in the
input
tensor along the providedaxis
Attributes
T
Transposes a 2D tensor.
type