tvm_tirx.ir.prim

Contents

tvm_tirx.ir.prim#

Primitive expressions and construction helpers shared by TVM IR dialects.

Classes#

EQ(a, b[, loc])

Compare whether a equals b, elementwise for vectors.

GE(a, b[, loc])

Compare whether a is at least b, elementwise for vectors.

GT(a, b[, loc])

Compare whether a is greater than b, elementwise for vectors.

LE(a, b[, loc])

Compare whether a is at most b, elementwise for vectors.

LT(a, b[, loc])

Compare whether a is less than b, elementwise for vectors.

NE(a, b[, loc])

Compare whether a differs from b, elementwise for vectors.

Add(a, b[, loc])

Add two primitive values, elementwise for vectors.

And(a, b[, loc])

Compute the conjunction of two boolean values.

BinaryOpExpr([loc, ty])

Python base class for binary arithmetic and bitwise expressions.

BitwiseAnd(a, b[, loc])

Compute the bitwise intersection of a and b.

BitwiseNot(a[, loc])

Invert every bit of the input value.

BitwiseOr(a, b[, loc])

Compute the bitwise union of a and b.

BitwiseXor(a, b[, loc])

Compute the bitwise exclusive-or of a and b.

Cast(ty, value[, loc])

Convert a primitive value to another dtype while preserving its lane count.

CmpExpr([loc, ty])

Python base class for comparisons of primitive expressions.

Div(a, b[, loc])

Divide a by b; integer division truncates toward zero.

FloorDiv(a, b[, loc])

Divide a by b, rounding the quotient down toward negative infinity.

FloorMod(a, b[, loc])

Compute a - FloorDiv(a, b) * b, the remainder of floor division.

Let(var, value, body[, loc])

Bind var to value within an expression body and return the body result.

LogicalExpr([loc, ty])

Python base class for boolean conjunction and disjunction expressions.

LShift(a, b[, loc])

Shift the bits of a left by b positions.

Max(a, b[, loc])

Choose the larger of two primitive values, elementwise for vectors.

Min(a, b[, loc])

Choose the smaller of two primitive values, elementwise for vectors.

Mod(a, b[, loc])

Compute the remainder of integer division truncated toward zero.

Mul(a, b[, loc])

Multiply two primitive values, elementwise for vectors.

Not(a[, loc])

Negate a boolean value, elementwise for vectors.

Or(a, b[, loc])

Compute the disjunction of two boolean values.

RShift(a, b[, loc])

Shift the bits of a right by b positions.

Select(condition, true_value, false_value[, loc])

Select between two values according to a boolean condition.

Sub(a, b[, loc])

Subtract b from a, elementwise for vectors.

Broadcast(value, lanes[, loc])

Repeat a scalar value across all lanes of a vector.

Ramp(base, stride, lanes[, loc])

Construct an index vector whose lane i equals base + i * stride.

Shuffle(vectors, indices[, loc])

Select output lanes from the concatenation of the input vectors.

Alias

Canonical API

Expr

tvm_tirx.ir.Expr

Functions#

abs(x[, loc])

Get absolute value of the input element-wise.

acos(x, *[, ty, loc])

Take acos of input x.

acosh(x, *[, ty, loc])

Take acos of input x.

all(*args[, loc])

Create a new expression of the intersection of all conditions in the

any(*args[, loc])

Create a new experssion of the union of all conditions in the arguments

asin(x, *[, ty, loc])

Take asin of input x.

asinh(x, *[, ty, loc])

Take asinh of input x.

assume([cond, ty, loc])

Provide a true statement that can be used for simplifications

atan(x, *[, ty, loc])

Take atan of input x.

atan2(x1, x2, *[, ty, loc])

Take arctan2(x1, x2).

atanh(x, *[, ty, loc])

Take atanh of input x.

bitwise_and(x, y[, loc])

Take bitwise and of two values

bitwise_not(x[, loc])

Take bitwise not of input value

bitwise_or(x, y[, loc])

Take bitwise or of two values

bitwise_xor(x, y[, loc])

Take bitwise xor of two values

ceil(x[, loc])

Take ceil of float input x.

ceildiv(lhs, rhs[, loc])

Generic ceildiv operator.

clz(x)

Count leading zero bits of an integer x.

convert(expr)

Convert a scalar or sequence to primitive expressions.

copysign(x1, x2, *[, ty, loc])

Change the sign of x1 to that of x2, element-wise.

cos(x, *[, ty, loc])

Take cos of input x.

cosh(x, *[, ty, loc])

Take cosh of input x.

div(a, b[, loc])

Compute a / b as in C/C++ semantics.

erf(x, *[, ty, loc])

Take gauss error function of the input x.

exp(x, *[, ty, loc])

Take exponential of input x.

exp2(x, *[, ty, loc])

Calculate 2**x

exp10(x, *[, ty, loc])

Calculate 10**x

floor(x[, loc])

Take floor of float input x.

floordiv(a, b[, loc])

Compute the floordiv of two expressions.

floormod(a, b[, loc])

Compute the floormod of two expressions.

fma(x, y, z, *[, ty, loc])

Take fused multiply-add of input x, y, z.

fmod(x, y, *[, ty, loc])

Return the remainder of x divided by y with the same sign as x.

hypot(x1, x2, *[, ty, loc])

Equivalent to sqrt(x1**2 + x2**2), element-wise.

if_then_else(cond, t, f[, loc])

Conditional selection expression.

indexdiv(a, b[, loc])

Compute floor(a / b) where a and b are non-negative.

indexmod(a, b[, loc])

Compute the remainder of indexdiv.

infinity(*, ty[, loc])

infinity value of ty

isfinite(x[, loc])

Check if input value is finite.

isinf(x[, loc])

Check if input value is infinite.

isnan(x[, loc, ty])

Check if input value is Nan.

ldexp(x1, x2, *[, ty, loc])

Returns x1 * (2 ** x2).

likely(cond[, loc])

Mark condition as likely.

log(x, *[, ty, loc])

Take log of input x.

log1p(x, *[, ty, loc])

Take log(x + 1) with respect to input x.

log2(x, *[, ty, loc])

Take log2 of input x.

log10(x, *[, ty, loc])

Take log10 of input x.

max(a, b[, loc])

Elementwise maximum of two primitive expressions.

max_value(*, ty[, loc])

maximum value of ty

min(a, b[, loc])

Elementwise minimum of two primitive expressions.

min_value(*, ty[, loc])

minimum value of ty

nearbyint(x[, loc])

Round elements of the array to the nearest integer.

nextafter(x1, x2, *[, ty, loc])

Return the next floating-point value after x1 towards x2.

popcount(x, *[, ty, loc])

Count the number of set bits in input x.

pow(x, y[, loc])

x power y

power(x, y[, loc])

x power y

round(x[, loc])

Round elements of the array to the nearest integer.

rsqrt(x, *[, ty, loc])

Take reciprocal of square root of input x.

shift_left(x, y[, loc])

Return the result of x left shifted by y bits.

shift_right(x, y[, loc])

Return the result of x right shifted by y bits.

sigmoid(x, *[, ty, loc])

Quick function to get sigmoid

sin(x, *[, ty, loc])

Take sin of input x.

sinh(x, *[, ty, loc])

Take sinh of input x.

sqrt(x, *[, ty, loc])

Take square root of input x.

tan(x, *[, ty, loc])

Take tan of input x.

tanh(x, *[, ty, loc])

Take hyperbolic tanh of input x.

trunc(x[, loc])

Get truncated value of the input.

truncdiv(a, b[, loc])

Compute the truncdiv of two expressions.

truncmod(a, b[, loc])

Compute the truncmod of two expressions.

vscale(*[, ty, loc])

Get the target's vscale value.

expr_deep_equal(lhs, rhs)

Deeply compare two nested expressions.

Alias

Canonical API

const

tvm_tirx.ir.const