triton.language.tensor

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

Represents an N-dimensional array of values or pointers.

tensor is the fundamental data structure in Triton programs. Most functions in triton.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 to x.sqrt().

tensor also defines most of the magic/dunder methods, so you can write x+y, x << 2, etc.

Constructors

__init__(handle, type: dtype)

Not called by user code.

Methods

__init__(handle, type)

Not called by user code.

abs([_semantic])

Forwards to abs() free function

advance(offsets[, _semantic])

Forwards to advance() free function

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

Forwards to associative_scan() free function

atomic_add(val[, mask, sem, scope, _semantic])

Forwards to atomic_add() free function

atomic_and(val[, mask, sem, scope, _semantic])

Forwards to atomic_and() free function

atomic_cas(cmp, val[, sem, scope, _semantic])

Forwards to atomic_cas() free function

atomic_max(val[, mask, sem, scope, _semantic])

Forwards to atomic_max() free function

atomic_min(val[, mask, sem, scope, _semantic])

Forwards to atomic_min() free function

atomic_or(val[, mask, sem, scope, _semantic])

Forwards to atomic_or() free function

atomic_xchg(val[, mask, sem, scope, _semantic])

Forwards to atomic_xchg() free function

atomic_xor(val[, mask, sem, scope, _semantic])

Forwards to atomic_xor() free function

broadcast_to(*shape[, _semantic])

Forwards to broadcast_to() free function

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

Forwards to cast() free function

ceil([_semantic])

Forwards to ceil() free function

cos([_semantic])

Forwards to cos() free function

erf([_semantic])

Forwards to erf() free function

exp([_semantic])

Forwards to exp() free function

exp2([_semantic])

Forwards to exp2() free function

expand_dims(axis[, _semantic])

Forwards to expand_dims() free function

extract_slice(offsets, sizes, strides[, ...])

Forwards to extract_slice() free function

floor([_semantic])

Forwards to floor() free function

gather(index, axis[, _semantic])

Forwards to gather() free function

gather_out_to_ub(index, index_boundary, dim, ...)

Forwards to gather_out_to_ub() free function

get_element(indice[, _semantic, _generator])

Forwards to get_element() free function

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

Forwards to histogram() free function

index_put(index, value, dim, index_boundary, ...)

Forwards to index_put() free function

index_select_simd(dim, index, src_shape, ...)

Forwards to index_select_simd() free function

insert_slice(sub, offsets, sizes, strides[, ...])

Forwards to insert_slice() free function

item([_semantic, _generator])

Forwards to item() free function

log([_semantic])

Forwards to log() free function

log2([_semantic])

Forwards to log2() free function

logical_and(other[, _semantic])

logical_or(other[, _semantic])

permute(*dims[, _semantic])

Forwards to permute() free function

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

Forwards to reduce() free function

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

Forwards to reshape() free function

rsqrt([_semantic])

Forwards to rsqrt() free function

scatter_ub_to_out(value, index, ...[, _semantic])

Forwards to scatter_ub_to_out() free function

sin([_semantic])

Forwards to sin() free function

sort([dim, descending])

split([_semantic, _generator])

Forwards to split() free function

sqrt([_semantic])

Forwards to sqrt() free function

sqrt_rn([_semantic])

Forwards to sqrt_rn() free function

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

Forwards to store() free function

sync_block_all(event_id[, _semantic])

Forwards to sync_block_all() free function

sync_block_set(receiver, event_id[, _semantic])

Forwards to sync_block_set() free function

sync_block_wait(receiver, event_id[, _semantic])

Forwards to sync_block_wait() free function

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

Alias for tensor.cast().

trans(*dims[, _semantic])

Forwards to trans() free function

view(*shape[, _semantic])

Forwards to view() free function

Attributes

T

Transposes a 2D tensor.

argmax

argmin

atan2

cdiv

cumprod

cumsum

finitef

flip

isfinited

max

min

ravel

reduce_or

sigmoid

softmax

sum

xor_sum

type