Math & logic#

Elementwise numeric, trigonometric, activation, and boolean operations.

Arithmetic#

Elementwise numeric operations: rounding, powers, logs, exponentials, affine transforms, sign, and special functions.

Function

Description

Absolute value

Absolute value of each element.

Add

Elementwise sum of two aligned streams (x + y).

Ceiling

Round each element toward positive infinity.

Clip to bounds

Bound each element below and/or above.

Cube

x cubed (faster than Power(3)).

Div

Elementwise quotient of two aligned streams (x / y).

Error function

Gauss error function.

Complementary error function

Complementary error function (1 - erf).

Exponential

e to the power of each element.

Floor

Round each element toward negative infinity.

Identity

Pass-through (y = x).

Linear (affine)

Affine transform: scale * x + shift.

Linear (two-input affine)

Two-input affine combination: a*x + b*y + c.

Natural logarithm

Natural logarithm of each element.

Mul

Elementwise product of two aligned streams (x * y).

Negative Part

Negative part of x: max(-x, 0).

Positive Part

Positive part of x: max(x, 0).

Power

x raised to a fixed exponent p.

Round (banker's rounding)

Round each element to the nearest integer (half-to-even).

Sign

Sign of each element: -1, 0, or +1.

Square root

Square root of each element.

Square

x squared (faster than Power(2)).

Sub

Elementwise difference of two aligned streams (x - y).

Trigonometry & geometry#

Angles, inverse trigonometric functions, coordinate conversions, and distances.

Function

Description

Arccosine

Inverse cosine of each element (radians, input in [-1, 1]).

Arcsine

Inverse sine of each element (radians, input in [-1, 1]).

Arctangent

Inverse tangent of each element (radians).

Two-argument arctangent

Signed angle of (x, y) from the positive x-axis (numpy.arctan2 order).

Cartesian to polar

Convert (x, y) to (r, theta).

Cosine

Cosine of each element (radians).

Hypotenuse

Euclidean distance sqrt(x^2 + y^2), numerically stable.

Polar to Cartesian

Convert (r, theta) to (x, y).

Sine

Sine of each element (radians).

Tanh

Hyperbolic tangent.

Activations#

Neural-network activation functions.

Function

Description

ELU

Exponential linear unit.

ReLU

Rectified linear unit: max(0, x).

SELU

Scaled exponential linear unit (self-normalizing networks).

Sigmoid

Logistic sigmoid: 1 / (1 + exp(-x)).

Softsign

Softsign: x / (1 + |x|).

Tanh

Hyperbolic tangent.

Logic & comparison#

Boolean masks, comparisons, and conditional selection. Outputs are 1.0 (true) or 0.0 (false).

Function

Description

And

Returns 1.0 if both inputs are nonzero, else 0.0. NaN in either input yields NaN.

Equal

Returns 1.0 if a == b, else 0.0. NaN in either input yields NaN.

GreaterEqual

Returns 1.0 if a >= b, else 0.0. NaN in either input yields NaN.

GreaterThan

Returns 1.0 if a > b, else 0.0. NaN in either input yields NaN.

IsFinite

Returns 1.0 for finite values, 0.0 for NaN or inf. Does not propagate NaN.

IsNan

Returns 1.0 if the input is NaN, else 0.0. Does not propagate NaN.

LessEqual

Returns 1.0 if a <= b, else 0.0. NaN in either input yields NaN.

LessThan

Returns 1.0 if a < b, else 0.0. NaN in either input yields NaN.

Not

Returns 0.0 if input is nonzero, 1.0 if zero. NaN propagates.

NotEqual

Returns 1.0 if a != b, else 0.0. NaN in either input yields NaN.

Or

Returns 1.0 if either input is nonzero, else 0.0. NaN in either input yields NaN.

Where

Returns a if mask is nonzero, b otherwise. NaN mask yields NaN.