hidet.ops

Todo

We are still working on the documentation of operators.

Functions:

abs(x)

acos(x)

acosh(x)

adaptive_avg_pool1d(x, output_size)

adaptive_avg_pool2d(x, output_size)

adaptive_avg_pool3d(x, output_size)

adaptive_max_pool1d(x, output_size)

adaptive_max_pool2d(x, output_size)

adaptive_max_pool3d(x, output_size)

add(x, y)

all(x, /, *[, axis, keepdims])

Check if all of the elements on the given axis evaluates to True.

all_gather(x, nranks[, comm_id])

all_reduce(x, op[, comm_id])

any(x, /, *[, axis, keepdims])

Check if any of the elements on the given axis evaluates to True.

arange(start, /[, stop, step, dtype, device])

argmax(x, dim[, keep_dim])

argmin(x, dim[, keep_dim])

asin(x)

asinh(x)

atan(x)

atan2(x, y)

atanh(x)

attention(q, k, v[, mask, is_causal])

avg_pool2d(x, kernel, stride, padding[, ...])

avg_pool3d(x, kernel, stride, padding)

barrier(x)

Barrier operator is an identity operator and return the same tensor as input.

batch_matmul(a, b[, mma])

Batched matrix multiplication.

batch_norm_infer(x, running_mean, running_var)

bitwise_and(x, y)

bitwise_invert(x)

bitwise_left_shift(x, y)

bitwise_or(x, y)

bitwise_right_shift(x, y)

bitwise_xor(x, y)

broadcast(data, shape)

cast(x, dtype)

ceil(x)

celu(x, alpha)

clamp(x, min, max)

clip(x, min_val, max_val)

concat(tensors, axis)

conj(x)

conv1d(data, weight[, stride, dilations, groups])

conv1d_gemm(data, weight, stride[, ...])

conv1d_transpose(data, weight[, stride, ...])

conv2d(data, weight[, stride, dilations, ...])

conv2d_channel_last(data, weight[, stride, ...])

conv2d_gemm(data, weight, stride, dilations)

conv2d_gemm_fp16(img, weight[, padding, ...])

conv2d_gemm_fp16_channel_last(img, weight, ...)

conv2d_gemm_image_transform(x, kernel, ...)

conv2d_transpose(data, weight, stride, padding)

conv2d_transpose_gemm(data, weight, stride, ...)

conv2d_winograd(x, w)

conv3d(data, weight[, stride, dilations, groups])

conv3d_gemm(data, weight, stride, dilations)

conv3d_transpose(data, weight[, stride, ...])

conv_pad(data, pads[, value])

cos(x)

cosh(x)

cumsum(x, dim[, exclusive, reverse])

divide(x, y)

einsum(equation, operands)

equal(x, y)

erf(x)

exp(x)

expand_dims(x, /, *[, axis])

expm1(x)

flatten(x[, start_dim, end_dim])

floor(x)

full(shape, value[, dtype, device])

fused_operator(*inputs, fused_graph[, anchor])

gather(data, indices[, axis])

gelu(x[, approximate])

greater(x, y)

greater_equal(x, y)

group_norm(x, num_groups[, epsilon, ...])

Group norm.

hardshrink(x, lambda_val)

hardsigmoid(x)

hardswish(x)

hardtanh(x, min_val, max_val)

imag(x)

instance_norm(x[, epsilon, accumulate_dtype])

Instance norm.

isfinite(x)

isinf(x)

isnan(x)

layer_norm(x[, num_last_dims, epsilon, ...])

Layer norm.

leaky_relu(x, alpha)

less(x, y)

less_equal(x, y)

linspace(start, stop, /, num, *[, dtype, ...])

log(x)

log10(x)

log1p(x)

log2(x)

logaddexp(x, y)

logical_and(x, y)

logical_not(x)

logical_or(x, y)

logical_xor(x, y)

logsigmoid(x)

lp_norm(x[, p, dim, eps])

LP norm.

make_complex(real, imag)

matmul(a, b[, require_prologue])

matmul_x86(a, b)

max(x, dims[, keep_dim])

max_pool2d(x, kernel, stride, padding[, ...])

max_pool3d(x, kernel, stride, padding)

maximum(a, b, *others)

mean(x, dims[, keep_dim])

min(x, dims[, keep_dim])

minimum(a, b, *others)

mod(x, y)

multiply(x, y)

negative(x)

not_equal(x, y)

pad(data, pads[, mode, value])

permute_dims(x, /, axes)

positive(x)

pow(x, y)

prelu(x, slope)

prod(x, dims[, keep_dim])

real(x)

rearrange(x, plan)

Rearrange a tensor.

reciprocal(x)

reduce_scatter(x, op[, comm_id])

relu(x)

relu6(x)

remainder(x, y)

reshape(x, shape)

resize2d(data, *[, size, scale_factor, ...])

roll(x, shifts[, dims])

round(x)

rsqrt(x)

set_strided_slice(data, starts, ends[, ...])

sigmoid(x)

sign(x)

silu(x)

sin(x)

sinh(x)

softmax(x[, axis])

softmin(x, axis)

softplus(x, beta, threshold_val)

softshrink(x, lambda_val)

softsign(x)

split(data, parts_or_sections[, axis])

sqrt(x)

square(x)

squeeze(x, dims)

std(x, dims[, keep_dim])

strided_slice(data, starts, ends[, axes, ...])

subtract(x, y)

sum(x, dims[, keep_dim])

symmetric_dequantize(wq, scale[, dims])

symmetric_quantize(w[, quant_type, dims])

take(data, indices[, axis])

tan(x)

tanh(x)

tanhshrink(x)

tile(data, repeats)

Tile a tensor.

transfer(x, dst_device)

transpose(x[, axes])

tri(n[, m, k, dtype, device])

trunc(x)

unsqueeze(x, dims)

var(x, dims[, keep_dim])

where(cond, x, y)

hidet.ops.abs(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.acos(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.acosh(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.adaptive_avg_pool1d(x, output_size)
Parameters:
  • x (Tensor) –

  • output_size (int | Sequence[int]) –

Return type:

Tensor

hidet.ops.adaptive_avg_pool2d(x, output_size)
Parameters:
  • x (Tensor) –

  • output_size (int | Sequence[int]) –

Return type:

Tensor

hidet.ops.adaptive_avg_pool3d(x, output_size)
Parameters:
  • x (Tensor) –

  • output_size (int | Sequence[int]) –

Return type:

Tensor

hidet.ops.adaptive_max_pool1d(x, output_size)
Parameters:
  • x (Tensor) –

  • output_size (int | Sequence[int]) –

Return type:

Tensor

hidet.ops.adaptive_max_pool2d(x, output_size)
Parameters:
  • x (Tensor) –

  • output_size (int | Sequence[int]) –

Return type:

Tensor

hidet.ops.adaptive_max_pool3d(x, output_size)
Parameters:
  • x (Tensor) –

  • output_size (int | Sequence[int]) –

Return type:

Tensor

hidet.ops.add(x, y)
Parameters:
Return type:

Tensor

hidet.ops.all(x, /, *, axis=None, keepdims=False)

Check if all of the elements on the given axis evaluates to True.

Parameters:
  • x (Tensor) – The input tensor.

  • axis (int or Sequence[int], optional) – The axis or axes along which to perform the logical AND. None indicates to perform the reduction on the whole tensor. When an integer or a sequence of integers are given, they must be in range [-N, N), where N is the rank of the input tensor.

  • keepdims (bool, default=False) – Whehter to keep the dimension.

Returns:

ret – The result of logical AND reduction with bool data type.

Return type:

Tensor

hidet.ops.all_gather(x, nranks, comm_id=0)
Parameters:
  • x (Tensor) –

  • nranks (int) –

  • comm_id (int) –

Return type:

Tensor

hidet.ops.all_reduce(x, op, comm_id=0)
Parameters:
  • x (Tensor) –

  • op (str) –

  • comm_id (int) –

Return type:

Tensor

hidet.ops.any(x, /, *, axis=None, keepdims=False)

Check if any of the elements on the given axis evaluates to True.

Parameters:
  • x (Tensor) – The input tensor.

  • axis (int or Sequence[int], optional) – The axis or axes along which to perform the logical OR. None indicates to perform the reduction on the whole tensor. When an integer or a sequence of integers are given, they must be in range [-N, N), where N is the rank of the input tensor.

  • keepdims (bool, default=False) – Whehter to keep the dimension.

Returns:

ret – The result of logical OR reduction with bool data type.

Return type:

Tensor

hidet.ops.arange(start, /, stop=None, step=1, *, dtype=None, device='cpu')
Return type:

Tensor

hidet.ops.argmax(x, dim, keep_dim=False)
Parameters:
  • x (Tensor) –

  • dim (int) –

  • keep_dim (bool) –

Return type:

Tensor

hidet.ops.argmin(x, dim, keep_dim=False)
Parameters:
  • x (Tensor) –

  • dim (int) –

  • keep_dim (bool) –

Return type:

Tensor

hidet.ops.asin(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.asinh(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.atan(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.atan2(x, y)
Parameters:
Return type:

Tensor

hidet.ops.atanh(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.attention(q, k, v, mask=None, is_causal=False)
Parameters:
Return type:

Tensor

hidet.ops.avg_pool2d(x, kernel, stride, padding, ceil_mode=False)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.avg_pool3d(x, kernel, stride, padding)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.barrier(x)

Barrier operator is an identity operator and return the same tensor as input. During graph-level optimizations, this operator prevents the fusion of producer and consumer of the input tensor and output tensor, respectively. This operator will be eliminated at the end of graph-level optimizations.

Parameters:

x (Tensor) – The input tensor.

Returns:

y – The output tensor.

Return type:

Tensor

hidet.ops.batch_matmul(a, b, mma='simt')

Batched matrix multiplication.

Parameters:
Returns:

c – The result tensor of matrix multiplication.

Return type:

Tensor

hidet.ops.batch_norm_infer(x, running_mean, running_var, epsilon=1e-05, axis=1)
Parameters:
Return type:

Tensor

hidet.ops.bitwise_and(x, y)
Parameters:
Return type:

Tensor

hidet.ops.bitwise_invert(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.bitwise_left_shift(x, y)
Parameters:
Return type:

Tensor

hidet.ops.bitwise_or(x, y)
Parameters:
Return type:

Tensor

hidet.ops.bitwise_right_shift(x, y)
Parameters:
Return type:

Tensor

hidet.ops.bitwise_xor(x, y)
Parameters:
Return type:

Tensor

hidet.ops.broadcast(data, shape)
Parameters:

data (Tensor) –

Return type:

Tensor

hidet.ops.cast(x, dtype)
Parameters:
Return type:

Tensor

hidet.ops.ceil(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.celu(x, alpha)
Parameters:
  • x (Tensor) –

  • alpha (float) –

Return type:

Tensor

hidet.ops.clamp(x, min, max)
Parameters:
Return type:

Tensor

hidet.ops.clip(x, min_val, max_val)
Parameters:
  • x (Tensor) –

  • min_val (float | None) –

  • max_val (float | None) –

Return type:

Tensor

hidet.ops.concat(tensors, axis)
Parameters:
  • tensors (List[Tensor]) –

  • axis (int) –

Return type:

Tensor

hidet.ops.conj(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.conv1d(data, weight, stride=1, dilations=1, groups=1)
Parameters:
  • data (Tensor) –

  • weight (Tensor) –

  • stride (int | Sequence[int]) –

  • dilations (int | Sequence[int]) –

  • groups (int) –

Return type:

Tensor

hidet.ops.conv1d_gemm(data, weight, stride, dilation=1, groups=1)
Parameters:
  • data (Tensor) –

  • weight (Tensor) –

  • dilation (int) –

  • groups (int) –

Return type:

Tensor

hidet.ops.conv1d_transpose(data, weight, stride=1, padding=0, groups=1, output_padding=0)
Parameters:
  • data (Tensor) –

  • weight (Tensor) –

  • stride (int | None) –

  • padding (int | None) –

  • groups (int | None) –

  • output_padding (int | None) –

Return type:

Tensor

hidet.ops.conv2d(data, weight, stride=(1, 1), dilations=(1, 1), groups=1, padding=(0, 0))
Parameters:
  • data (Tensor) –

  • weight (Tensor) –

  • stride (Sequence[int]) –

  • dilations (Sequence[int]) –

  • groups (int) –

  • padding (Sequence[int]) –

Return type:

Tensor

hidet.ops.conv2d_channel_last(data, weight, stride=(1, 1), dilations=(1, 1), groups=1, padding=(0, 0))
Parameters:
  • data (Tensor) –

  • weight (Tensor) –

  • stride (int | Sequence[int]) –

  • dilations (int | Sequence[int]) –

  • groups (int) –

  • padding (Sequence[int]) –

Return type:

Tensor

hidet.ops.conv2d_gemm(data, weight, stride, dilations, groups=1)
Parameters:
  • data (Tensor) –

  • weight (Tensor) –

  • dilations (List[int]) –

  • groups (int) –

Return type:

Tensor

hidet.ops.conv2d_gemm_fp16(img, weight, padding=0, stride=(1, 1), dilations=(1, 1), groups=1, parallel_k_parts=1, disable_cp_async=False)
Parameters:
  • img (Tensor) –

  • weight (Tensor) –

  • padding (int | Tuple[int, int]) –

  • stride (Tuple[int, int]) –

  • dilations (Tuple[int, int]) –

  • groups (int) –

Return type:

Tensor

hidet.ops.conv2d_gemm_fp16_channel_last(img, weight, padding, stride, dilations, groups, parallel_k_parts=1, disable_cp_async=False)
Parameters:
  • img (Tensor) –

  • weight (Tensor) –

  • padding (List[int]) –

  • stride (List[int]) –

  • dilations (List[int]) –

  • groups (int) –

Return type:

Tensor

hidet.ops.conv2d_gemm_image_transform(x, kernel, stride, dilations, groups=1)
Parameters:
  • x (Tensor) –

  • kernel (Sequence[int]) –

  • stride (Sequence[int]) –

  • dilations (Sequence[int]) –

  • groups (int) –

Return type:

Tensor

hidet.ops.conv2d_transpose(data, weight, stride, padding, groups=1, output_padding=0)
Parameters:
  • data (Tensor) –

  • weight (Tensor) –

  • stride (int | Sequence[int]) –

  • padding (int | Sequence[int]) –

  • groups (int) –

  • output_padding (int | Sequence[int]) –

Return type:

Tensor

hidet.ops.conv2d_transpose_gemm(data, weight, stride, padding, groups=1, output_padding=0)
Parameters:
  • data (Tensor) –

  • weight (Tensor) –

  • stride (int | Sequence[int]) –

  • padding (int | Sequence[int]) –

  • groups (int) –

  • output_padding (int | Sequence[int]) –

Return type:

Tensor

hidet.ops.conv2d_winograd(x, w)
Parameters:
Return type:

Tensor

hidet.ops.conv3d(data, weight, stride=(1, 1, 1), dilations=(1, 1, 1), groups=1)
Parameters:
  • data (Tensor) –

  • weight (Tensor) –

  • stride (int | Sequence[int]) –

  • dilations (int | Sequence[int]) –

  • groups (int) –

Return type:

Tensor

hidet.ops.conv3d_gemm(data, weight, stride, dilations, groups=1)
Parameters:
  • data (Tensor) –

  • weight (Tensor) –

  • dilations (List[int]) –

  • groups (int) –

Return type:

Tensor

hidet.ops.conv3d_transpose(data, weight, stride=(1, 1, 1), padding=(0, 0, 0), groups=1, output_padding=0)
Parameters:
  • data (Tensor) –

  • weight (Tensor) –

  • stride (int | Sequence[int]) –

  • padding (int | Sequence[int]) –

  • groups (int) –

  • output_padding (int | Sequence[int]) –

Return type:

Tensor

hidet.ops.conv_pad(data, pads, value=0.0)
Parameters:
  • data (Tensor) –

  • pads (int | List[int]) –

  • value (float) –

Return type:

Tensor

hidet.ops.cos(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.cosh(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.cumsum(x, dim, exclusive=False, reverse=False)
Parameters:
  • x (Tensor) –

  • dim (int) –

  • exclusive (bool) –

  • reverse (bool) –

Return type:

Tensor

hidet.ops.divide(x, y)
Parameters:
Return type:

Tensor

hidet.ops.einsum(equation, operands)
Parameters:
  • equation (str) –

  • operands (Sequence[Tensor]) –

hidet.ops.equal(x, y)
Parameters:
Return type:

Tensor

hidet.ops.erf(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.exp(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.expand_dims(x, /, *, axis=0)
Parameters:
  • x (Tensor) –

  • axis (int) –

Return type:

Tensor

hidet.ops.expm1(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.flatten(x, start_dim=0, end_dim=-1)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.floor(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.full(shape, value, dtype=None, device='cpu')
Parameters:
  • shape (Sequence[int]) –

  • value (float | int | bool | Constant | Tensor) –

  • dtype (str | DataType | None) –

  • device (Device | str) –

Return type:

Tensor

hidet.ops.fused_operator(*inputs, fused_graph, anchor=None)
Parameters:
Return type:

Tensor | List[Tensor]

hidet.ops.gather(data, indices, axis=0)
Parameters:
Return type:

Tensor

hidet.ops.gelu(x, approximate=False)
Parameters:
  • x (Tensor) –

  • approximate (bool) –

Return type:

Tensor

hidet.ops.greater(x, y)
Parameters:
Return type:

Tensor

hidet.ops.greater_equal(x, y)
Parameters:
Return type:

Tensor

hidet.ops.group_norm(x, num_groups, epsilon=1e-05, accumulate_dtype='float32')

Group norm.

Parameters:
  • x (Tensor) – The data to be normalized.

  • num_groups (int) – The number of groups

  • epsilon (float) – The epsilon added to variance.

  • accumulate_dtype (str) – The precision used for accumulation during reduction

Returns:

ret – The normalized tensor.

Return type:

Tensor

hidet.ops.hardshrink(x, lambda_val)
Parameters:
  • x (Tensor) –

  • lambda_val (float) –

Return type:

Tensor

hidet.ops.hardsigmoid(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.hardswish(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.hardtanh(x, min_val, max_val)
Parameters:
  • x (Tensor) –

  • min_val (float) –

  • max_val (float) –

Return type:

Tensor

hidet.ops.imag(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.instance_norm(x, epsilon=1e-05, accumulate_dtype='float32')

Instance norm.

Parameters:
  • x (Tensor) – The data to be normalized.

  • axis (int) – The axis of channel dimension.

  • epsilon (float) – The epsilon added to variance.

  • accumulate_dtype (str) – The precision used for accumulation during reduction

Returns:

ret – The normalized tensor.

Return type:

Tensor

hidet.ops.isfinite(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.isinf(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.isnan(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.layer_norm(x, num_last_dims=1, epsilon=1e-05, accumulate_dtype='float32')

Layer norm.

Parameters:
  • x (Tensor) – The data to be normalized.

  • num_last_dims (int) – The number of dimensions to be normalized, starting from the end dimension of x.

  • epsilon (float) – The epsilon added to variance.

  • accumulate_dtype (str) – The precision used for accumulation during reduction

Returns:

ret – The normalized tensor.

Return type:

Tensor

hidet.ops.leaky_relu(x, alpha)
Parameters:
  • x (Tensor) –

  • alpha (float) –

Return type:

Tensor

hidet.ops.less(x, y)
Parameters:
Return type:

Tensor

hidet.ops.less_equal(x, y)
Parameters:
Return type:

Tensor

hidet.ops.linspace(start, stop, /, num, *, dtype=None, device='cpu', endpoint=True)
Return type:

Tensor

hidet.ops.log(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.log10(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.log1p(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.log2(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.logaddexp(x, y)
Parameters:
Return type:

Tensor

hidet.ops.logical_and(x, y)
Parameters:
Return type:

Tensor

hidet.ops.logical_not(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.logical_or(x, y)
Parameters:
Return type:

Tensor

hidet.ops.logical_xor(x, y)
Parameters:
Return type:

Tensor

hidet.ops.logsigmoid(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.lp_norm(x, p=2.0, dim=1, eps=1e-12)

LP norm.

Parameters:
  • x (Tensor) – The data to be normalized.

  • p (float) – The exponent value in the norm formulation.

  • dim (int) – The dimension to reduce.

  • eps (float) – Small value to avoid division by zero.

Returns:

ret – The normalized tensor.

Return type:

Tensor

hidet.ops.make_complex(real, imag)
Parameters:
Return type:

Tensor

hidet.ops.matmul(a, b, require_prologue=False)
Parameters:
Return type:

Tensor

hidet.ops.matmul_x86(a, b)
Parameters:
Return type:

Tensor

hidet.ops.max(x, dims, keep_dim=False)
Parameters:
  • x (Tensor) –

  • dims (int | List[int]) –

  • keep_dim (bool) –

Return type:

Tensor

hidet.ops.max_pool2d(x, kernel, stride, padding, ceil_mode=False)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.max_pool3d(x, kernel, stride, padding)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.maximum(a, b, *others)
Parameters:
Return type:

Tensor

hidet.ops.mean(x, dims, keep_dim=False)
Parameters:
  • x (Tensor) –

  • dims (int | List[int]) –

  • keep_dim (bool) –

Return type:

Tensor

hidet.ops.min(x, dims, keep_dim=False)
Parameters:
  • x (Tensor) –

  • dims (int | List[int]) –

  • keep_dim (bool) –

Return type:

Tensor

hidet.ops.minimum(a, b, *others)
Parameters:
Return type:

Tensor

hidet.ops.mod(x, y)
Parameters:
Return type:

Tensor

hidet.ops.multiply(x, y)
Parameters:
Return type:

Tensor

hidet.ops.negative(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.not_equal(x, y)
Parameters:
Return type:

Tensor

hidet.ops.pad(data, pads, mode='constant', value=0.0)
Parameters:
  • data (Tensor) –

  • pads (List[int]) –

  • mode (str) –

  • value (float) –

Return type:

Tensor

hidet.ops.permute_dims(x, /, axes)
Parameters:
  • x (Tensor) –

  • axes (Sequence[int]) –

Return type:

Tensor

hidet.ops.positive(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.pow(x, y)
Parameters:
Return type:

Tensor

hidet.ops.prelu(x, slope)
Parameters:
Return type:

Tensor

hidet.ops.prod(x, dims, keep_dim=False)
Parameters:
  • x (Tensor) –

  • dims (int | List[int]) –

  • keep_dim (bool) –

Return type:

Tensor

hidet.ops.real(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.rearrange(x, plan)

Rearrange a tensor. This task is a general task of squeeze, unsqueeze, flatten, and perm.

Parameters:
  • x (Tensor) – The input tensor.

  • plan (List[List[int]]) – The rearrange plan.

Returns:

ret – The task to conduct rearrangement.

Return type:

Tensor

Examples

  • squeeze([1, 1, 2, 3], dims=[0, 1]) = rearrange([1, 1, 2, 3], plan=[[2], [3]]) => Tensor([2, 3])

  • unsqueeze([2, 3], dims=[0, 1]) = rearrange([2, 3], plan=[[], [], [0], [1]]) => Tensor([1, 1, 2, 3])

  • flatten([2, 3, 4, 5], start_dim=1, end_dim=2) = rearrange([2, 3, 4, 5], plan=[[0], [1, 2], [3]]) => Tensor([2, 12, 5])

hidet.ops.reciprocal(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.reduce_scatter(x, op, comm_id=0)
Parameters:
  • x (Tensor) –

  • op (str) –

  • comm_id (int) –

Return type:

Tensor

hidet.ops.relu(x)
Return type:

Tensor

hidet.ops.relu6(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.remainder(x, y)
Parameters:
Return type:

Tensor

hidet.ops.reshape(x, shape)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.resize2d(data, *, size=None, scale_factor=None, method='nearest', coordinate_transformation_mode='half_pixel', rounding_method='round_prefer_floor', roi=None, cubic_alpha=-0.75, cubic_exclude=False, extrapolation_value=None, recompute_scale_factor=None)
Parameters:
  • data (Tensor) –

  • size (Sequence[int] | None) –

  • scale_factor (float | Sequence[float] | None) –

  • method (str) –

  • coordinate_transformation_mode (str) –

  • rounding_method (str) –

  • roi (Optional) –

  • cubic_alpha (float | None) –

  • cubic_exclude (bool | None) –

  • extrapolation_value (float | None) –

  • recompute_scale_factor (bool | None) –

Return type:

Tensor

hidet.ops.roll(x, shifts, dims=None)
Parameters:
  • x (Tensor) –

  • shifts (int | Sequence[int]) –

  • dims (int | Sequence[int] | None) –

Return type:

Tensor

hidet.ops.round(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.rsqrt(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.set_strided_slice(data, starts, ends, strides=None, setvalue=0.0)
Parameters:
  • data (Tensor) –

  • starts (Sequence[int | None]) –

  • ends (Sequence[int | None]) –

  • strides (Sequence[int | None] | None) –

  • setvalue (int | float | None) –

Return type:

Tensor

hidet.ops.sigmoid(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.sign(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.silu(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.sin(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.sinh(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.softmax(x, axis=1)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.softmin(x, axis)
Parameters:
  • x (Tensor) –

  • axis (int) –

Return type:

Tensor

hidet.ops.softplus(x, beta, threshold_val)
Parameters:
  • x (Tensor) –

  • beta (int) –

  • threshold_val (int) –

Return type:

Tensor

hidet.ops.softshrink(x, lambda_val)
Parameters:
  • x (Tensor) –

  • lambda_val (float) –

Return type:

Tensor

hidet.ops.softsign(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.split(data, parts_or_sections, axis=0)
Parameters:
  • data (Tensor) –

  • parts_or_sections (Sequence[int] | int) –

  • axis (int) –

Return type:

List[Tensor]

hidet.ops.sqrt(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.square(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.squeeze(x, dims)
Parameters:
  • x (Tensor) –

  • dims (int | Sequence[int]) –

Return type:

Tensor

hidet.ops.std(x, dims, keep_dim=False)
Parameters:
  • x (Tensor) –

  • dims (int | List[int]) –

  • keep_dim (bool) –

Return type:

Tensor

hidet.ops.strided_slice(data, starts, ends, axes=None, strides=None)
Parameters:
  • data (Tensor) –

  • starts (Sequence[int | None]) –

  • ends (Sequence[int | None]) –

  • axes (Sequence[int] | None) –

  • strides (Sequence[int | None] | None) –

Return type:

Tensor

hidet.ops.subtract(x, y)
Parameters:
Return type:

Tensor

hidet.ops.sum(x, dims, keep_dim=False)
Parameters:
  • x (Tensor) –

  • dims (int | List[int]) –

  • keep_dim (bool) –

Return type:

Tensor

hidet.ops.symmetric_dequantize(wq, scale, dims=-1)
Parameters:
  • wq (Tensor) –

  • scale (Tensor) –

  • dims (int | List[int]) –

hidet.ops.symmetric_quantize(w, quant_type='int8', dims=-1)
Parameters:
  • w (Tensor) –

  • quant_type (str | DataType) –

  • dims (int | List[int]) –

hidet.ops.take(data, indices, axis=0)
Parameters:
Return type:

Tensor

hidet.ops.tan(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.tanh(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.tanhshrink(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.tile(data, repeats)

Tile a tensor. See https://numpy.org/doc/stable/reference/generated/numpy.tile.html.

Parameters:
  • data (Tensor) – The input tensor to be tiled.

  • repeats (Sequence[int]) – A list of integers to represent the number of repeats for each dimension. Must have len(repeats) == len(data.shape).

Returns:

ret – The tiled tensor, with shape [a * b for a, b in zip(data.shape, repeats)].

Return type:

Tensor

hidet.ops.transfer(x, dst_device)
Parameters:
  • x (Tensor) –

  • dst_device (str | Device) –

Return type:

Tensor

hidet.ops.transpose(x, axes=None)
Parameters:
  • x (Tensor) –

  • axes (Sequence[int] | None) –

Return type:

Tensor

hidet.ops.tri(n, m=None, k=0, dtype=hidet.float32, device='cpu')
Parameters:
  • n (int | Expr) –

  • m (Expr | int | None) –

  • k (int | Expr) –

  • dtype (DataType) –

  • device (str | Device) –

Return type:

Tensor

hidet.ops.trunc(x)
Parameters:

x (Tensor) –

Return type:

Tensor

hidet.ops.unsqueeze(x, dims)
Parameters:
  • x (Tensor) –

  • dims (int | Sequence[int]) –

Return type:

Tensor

hidet.ops.var(x, dims, keep_dim=False)
Parameters:
  • x (Tensor) –

  • dims (int | List[int]) –

  • keep_dim (bool) –

Return type:

Tensor

hidet.ops.where(cond, x, y)
Parameters:
  • cond (Tensor) –

  • x (Tensor | int | float | bool) –

  • y (Tensor | int | float | bool) –

Return type:

Tensor