import { Tensor } from "./tensor"; /** * ![Plot of abs and its gradient](/plots/abs.svg) * * Calculates: * ```js * output = abs(input) * ``` * * Gradient: * ```js * inputGrad = input == 0 ? 0 : (input > 0 ? outputGrad : -outputGrad) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function abs(input: Tensor): Tensor; /** * Alias for `abs`. * * ![Plot of abs and its gradient](/plots/abs.svg) * * Calculates: * ```js * output = abs(input) * ``` * * Gradient: * ```js * inputGrad = input == 0 ? 0 : (input > 0 ? outputGrad : -outputGrad) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function absolute(input: Tensor): Tensor; /** * ![Plot of acos and its gradient](/plots/acos.svg) * * Calculates: * ```js * output = acos(input) * ``` * * Gradient: * ```js * inputGrad = -outputGrad / sqrt(1 - input * input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function acos(input: Tensor): Tensor; /** * Alias for `acos`. * * ![Plot of acos and its gradient](/plots/acos.svg) * * Calculates: * ```js * output = acos(input) * ``` * * Gradient: * ```js * inputGrad = -outputGrad / sqrt(1 - input * input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function arccos(input: Tensor): Tensor; /** * ![Plot of acosh and its gradient](/plots/acosh.svg) * * Calculates: * ```js * output = acosh(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / sqrt(input * input - 1) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function acosh(input: Tensor): Tensor; /** * Alias for `acosh`. * * ![Plot of acosh and its gradient](/plots/acosh.svg) * * Calculates: * ```js * output = acosh(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / sqrt(input * input - 1) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function arccosh(input: Tensor): Tensor; /** * Calculates: * ```js * output = input + other * ``` * * Gradient: * ```js * inputGrad = outputGrad; otherGrad = outputGrad * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @param alpha the alpha value to multiply `other` with * @returns the output tensor */ export declare function add(input: Tensor, other: Tensor, alpha?: number): Tensor; /** * ![Plot of asin and its gradient](/plots/asin.svg) * * Calculates: * ```js * output = asin(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / sqrt(1 - input * input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function asin(input: Tensor): Tensor; /** * Alias for `asin`. * * ![Plot of asin and its gradient](/plots/asin.svg) * * Calculates: * ```js * output = asin(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / sqrt(1 - input * input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function arcsin(input: Tensor): Tensor; /** * ![Plot of asinh and its gradient](/plots/asinh.svg) * * Calculates: * ```js * output = asinh(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / sqrt(input * input + 1) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function asinh(input: Tensor): Tensor; /** * Alias for `asinh`. * * ![Plot of asinh and its gradient](/plots/asinh.svg) * * Calculates: * ```js * output = asinh(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / sqrt(input * input + 1) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function arcsinh(input: Tensor): Tensor; /** * ![Plot of atan and its gradient](/plots/atan.svg) * * Calculates: * ```js * output = atan(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / (input * input + 1) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function atan(input: Tensor): Tensor; /** * Alias for `atan`. * * ![Plot of atan and its gradient](/plots/atan.svg) * * Calculates: * ```js * output = atan(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / (input * input + 1) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function arctan(input: Tensor): Tensor; /** * Calculates: * ```js * output = atan2(input, other) * ``` * * Gradient: * ```js * inputGrad = outputGrad * other / (input * input + other * other); otherGrad = -outputGrad * input / (input * input + other * other) * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @returns the output tensor */ export declare function atan2(input: Tensor, other: Tensor): Tensor; /** * Alias for `atan2`. * * Calculates: * ```js * output = atan2(input, other) * ``` * * Gradient: * ```js * inputGrad = outputGrad * other / (input * input + other * other); otherGrad = -outputGrad * input / (input * input + other * other) * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @returns the output tensor */ export declare function arctan2(input: Tensor, other: Tensor): Tensor; /** * ![Plot of ceil and its gradient](/plots/ceil.svg) * * Calculates: * ```js * output = ceil(input) * ``` * * Gradient: * ```js * inputGrad = 0 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function ceil(input: Tensor): Tensor; /** * Calculates: * ```js * output = other >= 0 ? abs(input) : -abs(input) * ``` * * Gradient: * ```js * var dir = other >= 0 ? (input >= 0 ? 1.0 : -1.0) : (input >= 0 ? -1.0 : 1.0); inputGrad = input == 0.0 ? 0.0 : outputGrad * dir; otherGrad = 0 * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @returns the output tensor */ export declare function copysign(input: Tensor, other: Tensor): Tensor; /** * ![Plot of cos and its gradient](/plots/cos.svg) * * Calculates: * ```js * output = cos(input) * ``` * * Gradient: * ```js * inputGrad = -outputGrad * sin(input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function cos(input: Tensor): Tensor; /** * ![Plot of cosh and its gradient](/plots/cosh.svg) * * Calculates: * ```js * output = cosh(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad * sinh(input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function cosh(input: Tensor): Tensor; /** * ![Plot of deg2rad and its gradient](/plots/deg2rad.svg) * * Calculates: * ```js * output = input * 0.017453292519943295 * ``` * * Gradient: * ```js * inputGrad = outputGrad * 0.017453292519943295 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function deg2rad(input: Tensor): Tensor; /** * Calculates: * ```js * output = input / other * ``` * * Gradient: * ```js * inputGrad = outputGrad / other; otherGrad = -outputGrad * input / (other * other) * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @param alpha the alpha value to multiply `other` with * @returns the output tensor */ export declare function div(input: Tensor, other: Tensor, alpha?: number): Tensor; /** * Alias for `div`. * * Calculates: * ```js * output = input / other * ``` * * Gradient: * ```js * inputGrad = outputGrad / other; otherGrad = -outputGrad * input / (other * other) * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @param alpha the alpha value to multiply `other` with * @returns the output tensor */ export declare function divide(input: Tensor, other: Tensor, alpha?: number): Tensor; /** * ![Plot of exp and its gradient](/plots/exp.svg) * * Calculates: * ```js * output = exp(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad * exp(input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function exp(input: Tensor): Tensor; /** * ![Plot of exp2 and its gradient](/plots/exp2.svg) * * Calculates: * ```js * output = exp2(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad * exp2(input) * 0.6931471805599453 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function exp2(input: Tensor): Tensor; /** * ![Plot of expm1 and its gradient](/plots/expm1.svg) * * Calculates: * ```js * output = exp(input) - 1.0 * ``` * * Gradient: * ```js * inputGrad = outputGrad * exp(input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function expm1(input: Tensor): Tensor; /** * ![Plot of floor and its gradient](/plots/floor.svg) * * Calculates: * ```js * output = floor(input) * ``` * * Gradient: * ```js * inputGrad = 0 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function floor(input: Tensor): Tensor; /** * ![Plot of frac and its gradient](/plots/frac.svg) * * Calculates: * ```js * output = input >= 0.0 ? fract(input) : -fract(-input) * ``` * * Gradient: * ```js * inputGrad = outputGrad * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function frac(input: Tensor): Tensor; /** * Calculates: * ```js * output = sqrt(input * input + other * other) * ``` * * Gradient: * ```js * inputGrad = outputGrad * input / sqrt(input * input + other * other); otherGrad = outputGrad * other / sqrt(input * input + other * other) * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @returns the output tensor */ export declare function hypot(input: Tensor, other: Tensor): Tensor; /** * Calculates: * ```js * output = input * pow(2.0, other) * ``` * * Gradient: * ```js * var out = pow(2.0, other); inputGrad = outputGrad * out; otherGrad = outputGrad * input * out * 0.6931471805599453 * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @returns the output tensor */ export declare function ldexp(input: Tensor, other: Tensor): Tensor; /** * ![Plot of log and its gradient](/plots/log.svg) * * Calculates: * ```js * output = log(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / input * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function log(input: Tensor): Tensor; /** * ![Plot of log10 and its gradient](/plots/log10.svg) * * Calculates: * ```js * output = log(input) * 0.4342944819032518 * ``` * * Gradient: * ```js * inputGrad = outputGrad / (input * 2.302585092994046) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function log10(input: Tensor): Tensor; /** * ![Plot of log1p and its gradient](/plots/log1p.svg) * * Calculates: * ```js * output = log(input + 1.0) * ``` * * Gradient: * ```js * inputGrad = outputGrad / (input + 1.0) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function log1p(input: Tensor): Tensor; /** * ![Plot of log2 and its gradient](/plots/log2.svg) * * Calculates: * ```js * output = log2(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / (input * 0.6931471805599453) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function log2(input: Tensor): Tensor; /** * Calculates: * ```js * output = log(exp(input) + exp(other)) * ``` * * Gradient: * ```js * var ein = exp(input); var eoth = exp(other); var addeinv = outputGrad/(ein + eoth); inputGrad = addeinv * ein; otherGrad = addeinv * eoth * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @returns the output tensor */ export declare function logaddexp(input: Tensor, other: Tensor): Tensor; /** * Calculates: * ```js * output = log2(exp2(input) + exp2(other)) * ``` * * Gradient: * ```js * var ein = exp2(input); var eoth = exp2(other); var sum_ein_eoth = ein + eoth; inputGrad = outputGrad * (ein / sum_ein_eoth); otherGrad = outputGrad * (eoth / sum_ein_eoth ); * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @returns the output tensor */ export declare function logaddexp2(input: Tensor, other: Tensor): Tensor; /** * Calculates: * ```js * output = input * other * ``` * * Gradient: * ```js * inputGrad = outputGrad * other; otherGrad = outputGrad * input * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @param alpha the alpha value to multiply `other` with * @returns the output tensor */ export declare function mul(input: Tensor, other: Tensor, alpha?: number): Tensor; /** * Alias for `mul`. * * Calculates: * ```js * output = input * other * ``` * * Gradient: * ```js * inputGrad = outputGrad * other; otherGrad = outputGrad * input * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @param alpha the alpha value to multiply `other` with * @returns the output tensor */ export declare function multiply(input: Tensor, other: Tensor, alpha?: number): Tensor; /** * ![Plot of neg and its gradient](/plots/neg.svg) * * Calculates: * ```js * output = -input * ``` * * Gradient: * ```js * inputGrad = -outputGrad * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function neg(input: Tensor): Tensor; /** * Alias for `neg`. * * ![Plot of neg and its gradient](/plots/neg.svg) * * Calculates: * ```js * output = -input * ``` * * Gradient: * ```js * inputGrad = -outputGrad * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function negative(input: Tensor): Tensor; /** * ![Plot of positive and its gradient](/plots/positive.svg) * * Calculates: * ```js * output = input * ``` * * Gradient: * ```js * inputGrad = outputGrad * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function positive(input: Tensor): Tensor; /** * Calculates: * ```js * output = pow(input, other) * ``` * * Gradient: * ```js * inputGrad = outputGrad * other * pow(input, other - 1.0); otherGrad = outputGrad * pow(input, other) * log(input) * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @returns the output tensor */ export declare function pow(input: Tensor, other: Tensor): Tensor; /** * ![Plot of rad2deg and its gradient](/plots/rad2deg.svg) * * Calculates: * ```js * output = input * 57.29577951308232 * ``` * * Gradient: * ```js * inputGrad = outputGrad * 57.29577951308232 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function rad2deg(input: Tensor): Tensor; /** * ![Plot of reciprocal and its gradient](/plots/reciprocal.svg) * * Calculates: * ```js * output = 1.0 / input * ``` * * Gradient: * ```js * inputGrad = -outputGrad / (input * input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function reciprocal(input: Tensor): Tensor; /** * ![Plot of relu and its gradient](/plots/relu.svg) * * Calculates: * ```js * output = max(input, 0.0) * ``` * * Gradient: * ```js * inputGrad = input > 0.0 ? outputGrad : 0.0 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function relu(input: Tensor): Tensor; /** * ![Plot of round and its gradient](/plots/round.svg) * * Calculates: * ```js * output = round(input) * ``` * * Gradient: * ```js * inputGrad = 0 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function round(input: Tensor): Tensor; /** * ![Plot of rsqrt and its gradient](/plots/rsqrt.svg) * * Calculates: * ```js * output = 1.0 / sqrt(input) * ``` * * Gradient: * ```js * inputGrad = -outputGrad / (2.0 * sqrt(input) * input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function rsqrt(input: Tensor): Tensor; /** * ![Plot of sigmoid and its gradient](/plots/sigmoid.svg) * * Calculates: * ```js * output = 1.0 / (1.0 + exp(-input)) * ``` * * Gradient: * ```js * var out = 1.0 / (1.0 + exp(-input)); inputGrad = outputGrad * out * (1.0 - out) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function sigmoid(input: Tensor): Tensor; /** * ![Plot of sign and its gradient](/plots/sign.svg) * * Calculates: * ```js * output = sign(input) * ``` * * Gradient: * ```js * inputGrad = 0 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function sign(input: Tensor): Tensor; /** * ![Plot of silu and its gradient](/plots/silu.svg) * * Calculates: * ```js * output = input / (1.0 + exp(-input)) * ``` * * Gradient: * ```js * var out = 1.0 / (1.0 + exp(-input)); inputGrad = outputGrad * (out + input * out * (1.0 - out)) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function silu(input: Tensor): Tensor; /** * ![Plot of sin and its gradient](/plots/sin.svg) * * Calculates: * ```js * output = sin(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad * cos(input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function sin(input: Tensor): Tensor; /** * ![Plot of sinc and its gradient](/plots/sinc.svg) * * Calculates: * ```js * var inpi = input * 3.141592653589793; output = input == 0.0 ? 1.0 : sin(inpi) / inpi * ``` * * Gradient: * ```js * var inpi = input * 3.141592653589793; inputGrad = input == 0.0 ? 0.0 : (outputGrad * 3.141592653589793 * (inpi*cos(inpi) - sin(inpi)) / (inpi*inpi)) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function sinc(input: Tensor): Tensor; /** * ![Plot of sinh and its gradient](/plots/sinh.svg) * * Calculates: * ```js * output = sinh(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad * cosh(input) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function sinh(input: Tensor): Tensor; /** * ![Plot of sqrt and its gradient](/plots/sqrt.svg) * * Calculates: * ```js * output = sqrt(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / (2.0 * sqrt(input)) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function sqrt(input: Tensor): Tensor; /** * ![Plot of square and its gradient](/plots/square.svg) * * Calculates: * ```js * output = input * input * ``` * * Gradient: * ```js * inputGrad = outputGrad * 2.0 * input * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function square(input: Tensor): Tensor; /** * Calculates: * ```js * output = input - other * ``` * * Gradient: * ```js * inputGrad = outputGrad; otherGrad = -outputGrad * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @param alpha the alpha value to multiply `other` with * @returns the output tensor */ export declare function sub(input: Tensor, other: Tensor, alpha?: number): Tensor; /** * Alias for `sub`. * * Calculates: * ```js * output = input - other * ``` * * Gradient: * ```js * inputGrad = outputGrad; otherGrad = -outputGrad * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @param alpha the alpha value to multiply `other` with * @returns the output tensor */ export declare function subtract(input: Tensor, other: Tensor, alpha?: number): Tensor; /** * ![Plot of tan and its gradient](/plots/tan.svg) * * Calculates: * ```js * output = tan(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad / (cos(input) * cos(input)) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function tan(input: Tensor): Tensor; /** * ![Plot of tanh and its gradient](/plots/tanh.svg) * * Calculates: * ```js * output = tanh(input) * ``` * * Gradient: * ```js * inputGrad = outputGrad * (1.0 - tanh(input) * tanh(input)) * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function tanh(input: Tensor): Tensor; /** * ![Plot of trunc and its gradient](/plots/trunc.svg) * * Calculates: * ```js * output = trunc(input) * ``` * * Gradient: * ```js * inputGrad = 0 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function trunc(input: Tensor): Tensor; /** * Alias for `trunc`. * * ![Plot of trunc and its gradient](/plots/trunc.svg) * * Calculates: * ```js * output = trunc(input) * ``` * * Gradient: * ```js * inputGrad = 0 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function fix(input: Tensor): Tensor; /** * Calculates: * ```js * output = input == 0.0 ? 0.0 : input * log(other) * ``` * * Gradient: * ```js * inputGrad = input == 0.0 ? 0.0 : outputGrad * log(other); otherGrad = input == 0.0 ? 0.0 : outputGrad * (input / other); * ``` * * @param input the input tensor of any shape * @param other the other tensor whose shape is broadcastable with the input tensor * @returns the output tensor */ export declare function xlogy(input: Tensor, other: Tensor): Tensor; /** * Calculates: * ```js * output = output && input * ``` * * with an initial value of `output = 1`. * * Gradient: * ```js * inputGrad = output ? outputGrad : 0.0 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function all(input: Tensor): Tensor; /** * Calculates: * ```js * output = output || input * ``` * * with an initial value of `output = 0`. * * Gradient: * ```js * inputGrad = output ? outputGrad : 0.0 * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function any(input: Tensor): Tensor; /** * Calculates: * ```js * output = output + input * ``` * * with an initial value of `output = 0.0`. * * Gradient: * ```js * inputGrad = outputGrad / inputSize * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function mean(input: Tensor): Tensor; /** * Calculates: * ```js * output = output + input * input * ``` * * with an initial value of `output = 0.0`. * * Gradient: * ```js * inputGrad = outputGrad * input / output * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function norm(input: Tensor): Tensor; /** * Calculates: * ```js * output = output * input * ``` * * with an initial value of `output = 1.0`. * * Gradient: * ```js * inputGrad = outputGrad * output / input * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function prod(input: Tensor): Tensor; /** * Calculates: * ```js * output = output + input * ``` * * with an initial value of `output = 0.0`. * * Gradient: * ```js * inputGrad = outputGrad * ``` * * @param input the input tensor of any shape * @returns the output tensor */ export declare function sum(input: Tensor): Tensor; /** * Calculates: * ```js * output = output + (input != 0) * ``` * * with an initial value of `output = 0.0`. * * @param input the input tensor of any shape * @returns the output tensor */ export declare function countNonzero(input: Tensor): Tensor;