Mathematical functions#

Trigonometric functions#

sin

sine of a Generalizes a scalar Op to tensors.

cos

cosine of a Generalizes a scalar Op to tensors.

tan

tangent of a Generalizes a scalar Op to tensors.

arcsin

arcsine of a Generalizes a scalar Op to tensors.

arccos

arccosine of a Generalizes a scalar Op to tensors.

arctan

arctangent of a Generalizes a scalar Op to tensors.

arctan2

arctangent of a / b Generalizes a scalar Op to tensors.

deg2rad

convert degree a to radian Generalizes a scalar Op to tensors.

rad2deg

convert radian a to degree Generalizes a scalar Op to tensors.

Hyperbolic functions#

sinh

hyperbolic sine of a Generalizes a scalar Op to tensors.

cosh

hyperbolic cosine of a Generalizes a scalar Op to tensors.

tanh

hyperbolic tangent of a Generalizes a scalar Op to tensors.

arcsinh

hyperbolic arc sine of a Generalizes a scalar Op to tensors.

arccosh

hyperbolic arc cosine of a Generalizes a scalar Op to tensors.

arctanh

hyperbolic arc tangent of a Generalizes a scalar Op to tensors.

Rounding#

round(a[, mode])

round_mode(a) with mode in [half_away_from_zero, half_to_even].

iround(a[, mode])

cast(round(a,mode),'int64')

floor

floor of a Generalizes a scalar Op to tensors.

ceil

ceiling of a Generalizes a scalar Op to tensors.

trunc

trunc of a Generalizes a scalar Op to tensors.

round_half_to_even

round_half_to_even(a) Generalizes a scalar Op to tensors.

round_half_away_from_zero

round_half_away_from_zero(a) Generalizes a scalar Op to tensors.

Sums, products, differences#

sum(input[, axis, dtype, keepdims, acc_dtype])

Computes the sum along the given axis(es) of a tensor input.

cumsum(x[, axis])

Return the cumulative sum of the elements along a given axis.

prod(input[, axis, dtype, keepdims, ...])

Computes the product along the given axis(es) of a tensor input.

cumprod(x[, axis])

Return the cumulative product of the elements along a given axis.

diff(x[, n, axis])

Calculate the n-th order discrete difference along the given axis.

Exponents and logarithms#

exp

e^`a` Generalizes a scalar Op to tensors.

expm1

e^`a` - 1 Generalizes a scalar Op to tensors.

exp2

2^`a` Generalizes a scalar Op to tensors.

log

base e logarithm of a Generalizes a scalar Op to tensors.

log2

base 2 logarithm of a Generalizes a scalar Op to tensors.

log10

base 10 logarithm of a Generalizes a scalar Op to tensors.

log1p

log(1+a) Generalizes a scalar Op to tensors.

logaddexp(*xs)

Logarithm of the sum of exponentiations of the inputs.

square

square of a Generalizes a scalar Op to tensors.

sqrt

square root of a Generalizes a scalar Op to tensors.

power(x, y)

Special functions#

erfc

complementary error function Generalizes a scalar Op to tensors.

erfcx

scaled complementary error function Generalizes a scalar Op to tensors.

erfcinv

inverse complementary error function Generalizes a scalar Op to tensors.

erfinv

inverse error function Generalizes a scalar Op to tensors.

owens_t

owens t function Generalizes a scalar Op to tensors.

gamma

gamma function Generalizes a scalar Op to tensors.

gammaln

log gamma function Generalizes a scalar Op to tensors.

psi

derivative of log gamma function Generalizes a scalar Op to tensors.

tri_gamma

second derivative of the log gamma function Generalizes a scalar Op to tensors.

chi2sf

chi squared survival function Generalizes a scalar Op to tensors.

gammainc

Regularized lower gamma function Generalizes a scalar Op to tensors.

gammaincc

Regularized upper gamma function Generalizes a scalar Op to tensors.

gammau

Upper incomplete gamma function.

hyp2f1

Gaussian hypergeometric function.

hyp2f1_der

Derivatives for Gaussian hypergeometric function.

j0

Bessel function of the first kind of order 0.

j1

Bessel function of the first kind of order 1.

jv

Bessel function of the first kind of order v (real).

i0

Modified Bessel function of the first kind of order 0.

i1

Modified Bessel function of the first kind of order 1.

iv

Modified Bessel function of the first kind of order v (real).

sigmoid

Logistic sigmoid function (1 / (1 + exp(-x)), also known as expit or inverse logit Generalizes a scalar Op to tensors.

softplus

Compute log(1 + exp(x)), also known as softplus or log1pexp Generalizes a scalar Op to tensors.

special.softmax(c[, axis])

special.log_softmax(c[, axis])

extra_ops.to_one_hot(y, nb_class[, dtype])

Return a matrix where each row correspond to the one hot encoding of each element in y.

special.poch(z, m)

Compute the Pochhammer/rising factorial.

special.factorial(n)

Compute the factorial.

log1mexp

Compute log(1 - exp(x)), also known as log1mexp Generalizes a scalar Op to tensors.

betainc

Regularized incomplete beta function Generalizes a scalar Op to tensors.

logsumexp(x[, axis, keepdims])

Compute the log of the sum of exponentials of input elements.

xlogx.xlogx

Generalizes a scalar Op to tensors.

xlogx.xlogy0

Generalizes a scalar Op to tensors.

Arithmetic operations#

add

elementwise addition Generalizes a scalar Op to tensors.

reciprocal

1.0/a Generalizes a scalar Op to tensors.

power(x, y)

mod

elementwise modulo Generalizes a scalar Op to tensors.

abs

|`a`| Generalizes a scalar Op to tensors.

neg

-a Generalizes a scalar Op to tensors.

pow

elementwise power Generalizes a scalar Op to tensors.

sgn

sign of a Generalizes a scalar Op to tensors.

mul

elementwise multiplication Generalizes a scalar Op to tensors.

sub

elementwise subtraction Generalizes a scalar Op to tensors.

int_div

elementwise [floor] division (inverse of multiplication) Generalizes a scalar Op to tensors.

ceil_intdiv(a, b)

Safely compute ceil(float_division(a, b)).

true_div

elementwise [true] division (inverse of multiplication) Generalizes a scalar Op to tensors.

divmod(x, y)

Element-wise divmod, using floor_divide and mod_check.

>>> a, b = at.itensor3(), at.itensor3() # example inputs
>>> a + 3      # at.add(a, 3) -> itensor3
>>> 3 - a      # at.sub(3, a)
>>> a * 3.5    # at.mul(a, 3.5) -> ftensor3 or dtensor3 (depending on casting)
>>> 2.2 / a    # at.truediv(2.2, a)
>>> 2.2 // a   # at.intdiv(2.2, a)
>>> 2.2**a     # at.pow(2.2, a)
>>> b % a      # at.mod(b, a)

Extrema#

maximum

elemwise maximum.

minimum

elemwise minimum.

topk(x, kth[, axis, sorted, idx_dtype])

Returns the k-largest elements along an axis.

argtopk(x, kth[, axis, sorted, idx_dtype])

Returns the indices of k-largest elements along an axis.

topk_and_argtopk(x, kth[, axis, sorted, ...])

Returns the results of both topk() and argtopk() in one Op.

Complex numbers#

angle

Return polar-coordinate angle of complex-valued tensor z Generalizes a scalar Op to tensors.

real

Return real component of complex-valued tensor z Generalizes a scalar Op to tensors.

imag

Return imaginary component of complex-valued tensor z Generalizes a scalar Op to tensors.

conjugate(x)

complex_from_polar

Return complex-valued tensor from polar coordinate specification.

complex

Return complex-valued tensor with real and imag components Generalizes a scalar Op to tensors.

Miscellaneous#

clip

Clip x to be between min and max.