Beaver. MLIR. Dialect. Math
(beaver v0.4.8)
Copy Markdown
Summary
Functions
Return op name math.absf as a bitstring.
math.absf - floating point absolute-value operation
Return op name math.absi as a bitstring.
math.absi - integer absolute-value operation
Return op name math.acos as a bitstring.
math.acos - arcus cosine of the specified value
Return op name math.acosh as a bitstring.
math.acosh - Hyperbolic arcus cosine of the given value
Return op name math.asin as a bitstring.
math.asin - arcus sine of the given value
Return op name math.asinh as a bitstring.
math.asinh - hyperbolic arcus sine of the given value
Return op name math.atan2 as a bitstring.
math.atan2 - 2-argument arcus tangent of the given values
Return op name math.atan as a bitstring.
math.atan - arcus tangent of the given value
Return op name math.atanh as a bitstring.
math.atanh - hyperbolic arcus tangent of the given value
Return op name math.cbrt as a bitstring.
math.cbrt - cube root of the specified value
Return op name math.ceil as a bitstring.
math.ceil - ceiling of the specified value
Return op name math.clampf as a bitstring.
math.clampf - floating point clamping operation
Return op name math.copysign as a bitstring.
math.copysign - A copysign operation
Return op name math.cos as a bitstring.
math.cos - cosine of the specified value
Return op name math.cosh as a bitstring.
math.cosh - hyperbolic cosine of the specified value
Return op name math.ctlz as a bitstring.
math.ctlz - counts the leading zeros an integer value
Return op name math.ctpop as a bitstring.
math.ctpop - counts the number of set bits of an integer value
Return op name math.cttz as a bitstring.
math.cttz - counts the trailing zeros an integer value
Return op name math.erf as a bitstring.
math.erf - error function of the specified value
Return op name math.erfc as a bitstring.
math.erfc - complementary error function of the specified value
Return op name math.exp2 as a bitstring.
math.exp2 - base-2 exponential of the specified value
Return op name math.exp as a bitstring.
math.exp - base-e exponential of the specified value
Return op name math.expm1 as a bitstring.
math.expm1 - base-e exponential of the specified value minus 1
Return op name math.floor as a bitstring.
math.floor - floor of the specified value
Return op name math.fma as a bitstring.
math.fma - floating point fused multipy-add operation
Return op name math.fpowi as a bitstring.
math.fpowi - floating point raised to the signed integer power
Return op name math.ipowi as a bitstring.
math.ipowi - signed integer raised to the power of operation
Return op name math.isfinite as a bitstring.
math.isfinite - returns true if the operand classifies as finite
Return op name math.isinf as a bitstring.
math.isinf - returns true if the operand classifies as infinite
Return op name math.isnan as a bitstring.
math.isnan - returns true if the operand classifies as NaN
Return op name math.isnormal as a bitstring.
math.isnormal - returns true if the operand classifies as normal
Return op name math.log1p as a bitstring.
math.log1p - Computes the natural logarithm of one plus the given value
Return op name math.log2 as a bitstring.
math.log2 - base-2 logarithm of the specified value
Return op name math.log10 as a bitstring.
math.log10 - base-10 logarithm of the specified value
Return op name math.log as a bitstring.
math.log - base-e logarithm of the specified value
Return op name math.powf as a bitstring.
math.powf - floating point raised to the power of operation
Return op name math.round as a bitstring.
math.round - round of the specified value
Return op name math.roundeven as a bitstring.
math.roundeven - round of the specified value with halfway cases to even
Return op name math.rsqrt as a bitstring.
math.rsqrt - reciprocal of sqrt (1 / sqrt of the specified value)
Return op name math.sin as a bitstring.
math.sin - sine of the specified value
Return op name math.sincos as a bitstring.
math.sincos - sine and cosine of the specified value
Return op name math.sinh as a bitstring.
math.sinh - hyperbolic sine of the specified value
Return op name math.sqrt as a bitstring.
math.sqrt - sqrt of the specified value
Return op name math.tan as a bitstring.
math.tan - tangent of the specified value
Return op name math.tanh as a bitstring.
math.tanh - hyperbolic tangent of the specified value
Return op name math.trunc as a bitstring.
math.trunc - trunc of the specified value
Functions
Return op name math.absf as a bitstring.
math.absf - floating point absolute-value operation
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The absf operation computes the absolute value. It takes one operand of
floating point type (i.e., scalar, tensor or vector) and returns one result
of the same type.
Example:
// Scalar absolute value.
%a = math.absf %b : f64
Return op name math.absi as a bitstring.
math.absi - integer absolute-value operation
This op has support for result type inference.
Operands
operand- Single,SignlessIntegerOrIndexLike, signless-integer-like
Results
result- Single,SignlessIntegerOrIndexLike, signless-integer-like
Description
The absi operation computes the absolute value. It takes one operand of
integer type (i.e., scalar, tensor or vector) and returns one result of the
same type.
Example:
// Scalar absolute value.
%a = math.absi %b : i64
Return op name math.acos as a bitstring.
math.acos - arcus cosine of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The acos operation computes the arcus cosine of a given value. It takes one
operand of floating point type (i.e., scalar, tensor or vector) and returns one
result of the same type. It has no standard attributes.
Example:
// Scalar arcus cosine value.
%a = math.acos %b : f64
Return op name math.acosh as a bitstring.
math.acosh - Hyperbolic arcus cosine of the given value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
Syntax:
operation ::= ssa-id `=` `math.acosh` ssa-use `:` typeThe acosh operation computes the arcus cosine of a given value. It takes
one operand of floating point type (i.e., scalar, tensor or vector) and returns
one result of the same type. It has no standard attributes.
Example:
// Hyperbolic arcus cosine of scalar value.
%a = math.acosh %b : f64
Return op name math.asin as a bitstring.
math.asin - arcus sine of the given value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
Syntax:
operation ::= ssa-id `=` `math.asin` ssa-use `:` typeThe asin operation computes the arcus sine of a given value. It takes
one operand of floating point type (i.e., scalar, tensor or vector) and returns
one result of the same type. It has no standard attributes.
Example:
// Arcus sine of scalar value.
%a = math.asin %b : f64
Return op name math.asinh as a bitstring.
math.asinh - hyperbolic arcus sine of the given value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
Syntax:
operation ::= ssa-id `=` `math.asinh` ssa-use `:` typeThe asinh operation computes the hyperbolic arcus sine of a given value. It takes
one operand of floating point type (i.e., scalar, tensor or vector) and returns
one result of the same type. It has no standard attributes.
Example:
// Hyperbolic arcus sine of scalar value.
%a = math.asinh %b : f64
Return op name math.atan2 as a bitstring.
math.atan2 - 2-argument arcus tangent of the given values
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
lhs- Single,FloatLike, floating-point-likerhs- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The atan2 operation takes two operands and returns one result, all of
which must be of the same type. The operands must be of floating point type
(i.e., scalar, tensor or vector).
The 2-argument arcus tangent atan2(y, x) returns the angle in the
Euclidian plane between the positive x-axis and the ray through the point
(x, y). It is a generalization of the 1-argument arcus tangent which
returns the angle on the basis of the ratio y/x.
See also https://en.wikipedia.org/wiki/Atan2
Example:
// Scalar variant.
%a = math.atan2 %b, %c : f32
Return op name math.atan as a bitstring.
math.atan - arcus tangent of the given value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The atan operation computes the arcus tangent of a given value. It takes
one operand of floating point type (i.e., scalar, tensor or vector) and returns
one result of the same type. It has no standard attributes.
Example:
// Arcus tangent of scalar value.
%a = math.atan %b : f64
Return op name math.atanh as a bitstring.
math.atanh - hyperbolic arcus tangent of the given value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
Syntax:
operation ::= ssa-id `=` `math.atanh` ssa-use `:` typeThe atanh operation computes the hyperbolic arcus tangent of a given value. It takes
one operand of floating point type (i.e., scalar, tensor or vector) and returns
one result of the same type. It has no standard attributes.
Example:
// Hyperbolic arcus tangent of scalar value.
%a = math.atanh %b : f64
Return op name math.cbrt as a bitstring.
math.cbrt - cube root of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The cbrt operation computes the cube root. It takes one operand of
floating point type (i.e., scalar, tensor or vector) and returns one result
of the same type. It has no standard attributes.
Example:
// Scalar cube root value.
%a = math.cbrt %b : f64Note: This op is not equivalent to powf(..., 1/3.0).
Return op name math.ceil as a bitstring.
math.ceil - ceiling of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The ceil operation computes the ceiling of a given value. It takes one
operand of floating point type (i.e., scalar, tensor or vector) and returns one
result of the same type. It has no standard attributes.
Example:
// Scalar ceiling value.
%a = math.ceil %b : f64
Return op name math.clampf as a bitstring.
math.clampf - floating point clamping operation
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
value- Single,FloatLike, floating-point-likemin- Single,FloatLike, floating-point-likemax- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The clampf operation takes three operands and returns one result, each of
these is required to be the same type. Operands must be of floating point type
(i.e., scalar, tensor or vector).
The semantics of the operation are described by:
clampf(value, min, max) = maxf(minf(value, max), min)If min > max the resulting value is poison.
Example:
%d = math.clampf %value to [%min, %max] : f64
Return op name math.copysign as a bitstring.
math.copysign - A copysign operation
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
lhs- Single,FloatLike, floating-point-likerhs- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The copysign returns a value with the magnitude of the first operand and
the sign of the second operand. It takes two operands and returns one result of
the same type. The operands must be of floating point type (i.e., scalar,
tensor or vector). It has no standard attributes.
Example:
// Scalar copysign value.
%a = math.copysign %b, %c : f64
Return op name math.cos as a bitstring.
math.cos - cosine of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The cos operation computes the cosine of a given value. It takes one
operand of floating point type (i.e., scalar, tensor or vector) and returns one
result of the same type. It has no standard attributes.
Example:
// Scalar cosine value.
%a = math.cos %b : f64
Return op name math.cosh as a bitstring.
math.cosh - hyperbolic cosine of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The cosh operation computes the hyperbolic cosine. It takes one operand
of floating point type (i.e., scalar, tensor or vector) and returns one
result of the same type. It has no standard attributes.
Example:
// Scalar hyperbolic cosine value.
%a = math.cosh %b : f64
Return op name math.ctlz as a bitstring.
math.ctlz - counts the leading zeros an integer value
This op has support for result type inference.
Operands
operand- Single,SignlessIntegerOrIndexLike, signless-integer-like
Results
result- Single,SignlessIntegerOrIndexLike, signless-integer-like
Description
The ctlz operation computes the number of leading zeros of an integer value.
It operates on scalar, tensor or vector.
Example:
// Scalar ctlz function value.
%a = math.ctlz %b : i32
Return op name math.ctpop as a bitstring.
math.ctpop - counts the number of set bits of an integer value
This op has support for result type inference.
Operands
operand- Single,SignlessIntegerOrIndexLike, signless-integer-like
Results
result- Single,SignlessIntegerOrIndexLike, signless-integer-like
Description
The ctpop operation computes the number of set bits of an integer value.
It operates on scalar, tensor or vector.
Example:
// Scalar ctpop function value.
%a = math.ctpop %b : i32
Return op name math.cttz as a bitstring.
math.cttz - counts the trailing zeros an integer value
This op has support for result type inference.
Operands
operand- Single,SignlessIntegerOrIndexLike, signless-integer-like
Results
result- Single,SignlessIntegerOrIndexLike, signless-integer-like
Description
The cttz operation computes the number of trailing zeros of an integer value.
It operates on scalar, tensor or vector.
Example:
// Scalar cttz function value.
%a = math.cttz %b : i32
Return op name math.erf as a bitstring.
math.erf - error function of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The erf operation computes the error function. It takes one operand of
floating point type (i.e., scalar, tensor or vector) and returns one result of
the same type. It has no standard attributes.
Example:
// Scalar error function value.
%a = math.erf %b : f64
Return op name math.erfc as a bitstring.
math.erfc - complementary error function of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The erfc operation computes the complementary error function, defined as
1-erf(x). This function is part of libm and is needed for accuracy, since
simply calculating 1-erf(x) when x is close to 1 will give inaccurate results.
It takes one operand of floating point type (i.e., scalar,
tensor or vector) and returns one result of the same type. It has no
standard attributes.
Example:
// Scalar error function value.
%a = math.erfc %b : f64
Return op name math.exp2 as a bitstring.
math.exp2 - base-2 exponential of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The exp operation takes one operand of floating point type (i.e., scalar,
tensor or vector) and returns one result of the same type. It has no standard
attributes.
Example:
// Scalar natural exponential.
%a = math.exp2 %b : f64
Return op name math.exp as a bitstring.
math.exp - base-e exponential of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The exp operation takes one operand of floating point type (i.e., scalar,
tensor or vector) and returns one result of the same type. It has no standard
attributes.
Example:
// Scalar natural exponential.
%a = math.exp %b : f64
Return op name math.expm1 as a bitstring.
math.expm1 - base-e exponential of the specified value minus 1
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
expm1(x) := exp(x) - 1
The expm1 operation takes one operand of floating point type (i.e.,
scalar, tensor or vector) and returns one result of the same type. It has no
standard attributes.
Example:
// Scalar natural exponential minus 1.
%a = math.expm1 %b : f64
Return op name math.floor as a bitstring.
math.floor - floor of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The floor operation computes the floor of a given value. It takes one
operand of floating point type (i.e., scalar, tensor or vector) and returns one
result of the same type. It has no standard attributes.
Example:
// Scalar floor value.
%a = math.floor %b : f64
Return op name math.fma as a bitstring.
math.fma - floating point fused multipy-add operation
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flagsroundingmode- Optional,Arith_RoundingModeAttr, Floating point rounding mode
Operands
a- Single,FloatLike, floating-point-likeb- Single,FloatLike, floating-point-likec- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The fma operation takes three operands and returns one result, each of
these is required to be the same type. Operands must be of floating point type
(i.e., scalar, tensor or vector).
Example:
// Scalar fused multiply-add: d = a*b + c
%d = math.fma %a, %b, %c : f64
// With an explicit IEEE-754 rounding mode.
%e = math.fma %a, %b, %c to_nearest_even : f64The semantics of the operation correspond to those of the llvm.fma
intrinsic. When
no rounding mode is set, lowering to LLVM is guaranteed to produce the
llvm.fma.* intrinsic. When a rounding mode is set, the LLVM lowering
instead produces llvm.experimental.constrained.fma.
Return op name math.fpowi as a bitstring.
math.fpowi - floating point raised to the signed integer power
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
lhs- Single,FloatLike, floating-point-likerhs- Single,SignlessIntegerOrIndexLike, signless-integer-like
Results
result- Single,FloatLike, floating-point-like
Description
The fpowi operation takes a base operand of floating point type
(i.e. scalar, tensor or vector) and a power operand of integer type
(also scalar, tensor or vector) and returns one result of the same type
as base. The result is base raised to the power of power.
The operation is elementwise for non-scalars, e.g.:
%v = math.fpowi %base, %power : vector<2xf32>, vector<2xi32>The result is a vector of:
[<math.fpowi %base[0], %power[0]>, <math.fpowi %base[1], %power[1]>]Example:
// Scalar exponentiation.
%a = math.fpowi %base, %power : f64, i32
Return op name math.ipowi as a bitstring.
math.ipowi - signed integer raised to the power of operation
This op has support for result type inference.
Operands
lhs- Single,SignlessIntegerOrIndexLike, signless-integer-likerhs- Single,SignlessIntegerOrIndexLike, signless-integer-like
Results
result- Single,SignlessIntegerOrIndexLike, signless-integer-like
Description
The ipowi operation takes two operands of integer type (i.e., scalar,
tensor or vector) and returns one result of the same type. Operands
must have the same type.
Example:
// Scalar signed integer exponentiation.
%a = math.ipowi %b, %c : i32
Return op name math.isfinite as a bitstring.
math.isfinite - returns true if the operand classifies as finite
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,BoolLike, bool-like
Description
Determines if the given floating-point number has finite value i.e. it is normal, subnormal or zero, but not infinite or NaN.
Example:
%f = math.isfinite %a : f32
Return op name math.isinf as a bitstring.
math.isinf - returns true if the operand classifies as infinite
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,BoolLike, bool-like
Description
Determines if the given floating-point number is positive or negative infinity.
Example:
%f = math.isinf %a : f32
Return op name math.isnan as a bitstring.
math.isnan - returns true if the operand classifies as NaN
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,BoolLike, bool-like
Description
Determines if the given floating-point number is a not-a-number (NaN) value.
Example:
%f = math.isnan %a : f32
Return op name math.isnormal as a bitstring.
math.isnormal - returns true if the operand classifies as normal
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,BoolLike, bool-like
Description
Determines if the given floating-point number is normal, i.e. is neither zero, subnormal, infinite, nor NaN.
Example:
%f = math.isnormal %a : f32
Return op name math.log1p as a bitstring.
math.log1p - Computes the natural logarithm of one plus the given value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
Computes the base-e logarithm of one plus the given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type.
log1p(x) := log(1 + x)
Example:
// Scalar log1p operation.
%y = math.log1p %x : f64
Return op name math.log2 as a bitstring.
math.log2 - base-2 logarithm of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
Computes the base-2 logarithm of the given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type.
Example:
// Scalar log2 operation.
%y = math.log2 %x : f64
Return op name math.log10 as a bitstring.
math.log10 - base-10 logarithm of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
Computes the base-10 logarithm of the given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type.
Example:
// Scalar log10 operation.
%y = math.log10 %x : f64
Return op name math.log as a bitstring.
math.log - base-e logarithm of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
Computes the base-e logarithm of the given value. It takes one operand of floating point type (i.e., scalar, tensor or vector) and returns one result of the same type.
Example:
// Scalar log operation.
%y = math.log %x : f64
Return op name math.powf as a bitstring.
math.powf - floating point raised to the power of operation
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
lhs- Single,FloatLike, floating-point-likerhs- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The powf operation takes two operands of floating point type (i.e.,
scalar, tensor or vector) and returns one result of the same type. Operands
must have the same type.
Example:
// Scalar exponentiation.
%a = math.powf %b, %c : f64
Return op name math.round as a bitstring.
math.round - round of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The round operation returns the operand rounded to the nearest integer
value in floating-point format. It takes one operand of floating point type
(i.e., scalar, tensor or vector) and produces one result of the same type. The
operation rounds the argument to the nearest integer value in floating-point
format, rounding halfway cases away from zero, regardless of the current
rounding direction.
Example:
// Scalar round operation.
%a = math.round %b : f64
Return op name math.roundeven as a bitstring.
math.roundeven - round of the specified value with halfway cases to even
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The roundeven operation returns the operand rounded to the nearest integer
value in floating-point format. It takes one operand of floating point type
(i.e., scalar, tensor or vector) and produces one result of the same type. The
operation rounds the argument to the nearest integer value in floating-point
format, rounding halfway cases to even, regardless of the current
rounding direction.
Example:
// Scalar round operation.
%a = math.roundeven %b : f64
Return op name math.rsqrt as a bitstring.
math.rsqrt - reciprocal of sqrt (1 / sqrt of the specified value)
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The rsqrt operation computes the reciprocal of the square root. It takes
one operand of floating point type (i.e., scalar, tensor or vector) and returns
one result of the same type. It has no standard attributes.
Example:
// Scalar reciprocal square root value.
%a = math.rsqrt %b : f64
Return op name math.sin as a bitstring.
math.sin - sine of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The sin operation computes the sine of a given value. It takes one
operand of floating point type (i.e., scalar, tensor or vector) and returns one
result of the same type. It has no standard attributes.
Example:
// Scalar sine value.
%a = math.sin %b : f64
Return op name math.sincos as a bitstring.
math.sincos - sine and cosine of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
sin- Single,FloatLike, floating-point-likecos- Single,FloatLike, floating-point-like
Description
The sincos operation computes both the sine and cosine of a given value
simultaneously. It takes one operand of floating point type (i.e., scalar,
tensor or vector) and returns two results of the same type. This operation
can be more efficient than computing sine and cosine separately when both
values are needed.
Example:
// Scalar sine and cosine values.
%sin, %cos = math.sincos %input : f64
Return op name math.sinh as a bitstring.
math.sinh - hyperbolic sine of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The sinh operation computes the hyperbolic sine. It takes one operand
of floating point type (i.e., scalar, tensor or vector) and returns one
result of the same type. It has no standard attributes.
Example:
// Scalar hyperbolic sine value.
%a = math.sinh %b : f64
Return op name math.sqrt as a bitstring.
math.sqrt - sqrt of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The sqrt operation computes the square root. It takes one operand of
floating point type (i.e., scalar, tensor or vector) and returns one result of
the same type. It has no standard attributes.
Example:
// Scalar square root value.
%a = math.sqrt %b : f64
Return op name math.tan as a bitstring.
math.tan - tangent of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The tan operation computes the tangent. It takes one operand
of floating point type (i.e., scalar, tensor or vector) and returns one
result of the same type. It has no standard attributes.
Example:
// Scalar tangent value.
%a = math.tan %b : f64
Return op name math.tanh as a bitstring.
math.tanh - hyperbolic tangent of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The tanh operation computes the hyperbolic tangent. It takes one operand
of floating point type (i.e., scalar, tensor or vector) and returns one
result of the same type. It has no standard attributes.
Example:
// Scalar hyperbolic tangent value.
%a = math.tanh %b : f64
Return op name math.trunc as a bitstring.
math.trunc - trunc of the specified value
This op has support for result type inference.
Attributes
fastmath- Single,Arith_FastMathAttr, Floating point fast math flags
Operands
operand- Single,FloatLike, floating-point-like
Results
result- Single,FloatLike, floating-point-like
Description
The trunc operation returns the operand rounded to the nearest integer
value in floating-point format. It takes one operand of floating point type
(i.e., scalar, tensor or vector) and produces one result of the same type.
The operation always rounds to the nearest integer not larger in magnitude
than the operand, regardless of the current rounding direction.
Example:
// Scalar trunc operation.
%a = math.trunc %b : f64