Class NDMath


  • public class NDMath
    extends Object
    • Constructor Summary

      Constructors 
      Constructor Description
      NDMath()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      INDArray abs​(INDArray x)
      Elementwise absolute value operation: out = abs(x)
      INDArray acos​(INDArray x)
      Elementwise acos (arccosine, inverse cosine) operation: out = arccos(x)
      INDArray acosh​(INDArray x)
      Elementwise acosh (inverse hyperbolic cosine) function: out = acosh(x)
      INDArray add​(INDArray x, double value)
      Scalar add operation, out = in + scalar
      INDArray add​(INDArray x, INDArray y)
      Pairwise addition operation, out = x + y
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray and​(INDArray x, INDArray y)
      Boolean AND operation: elementwise (x != 0) && (y != 0)
      If x and y arrays have equal shape, the output shape is the same as these inputs.
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
      INDArray asin​(INDArray x)
      Elementwise asin (arcsin, inverse sine) operation: out = arcsin(x)
      INDArray asinh​(INDArray x)
      Elementwise asinh (inverse hyperbolic sine) function: out = asinh(x)
      INDArray asum​(INDArray in, boolean keepDims, int... dimensions)
      Absolute sum array reduction operation, optionally along specified dimensions: out = sum(abs(x))
      INDArray asum​(INDArray in, int... dimensions)
      Absolute sum array reduction operation, optionally along specified dimensions: out = sum(abs(x))
      INDArray atan​(INDArray x)
      Elementwise atan (arctangent, inverse tangent) operation: out = arctangent(x)
      INDArray atan2​(INDArray y, INDArray x)
      Elementwise atan (arctangent, inverse tangent) operation: out = atan2(x,y).
      Similar to atan(y/x) but sigts of x and y are used to determine the location of the result
      INDArray atanh​(INDArray x)
      Elementwise atanh (inverse hyperbolic tangent) function: out = atanh(x)
      INDArray bitShift​(INDArray x, INDArray shift)
      Bit shift operation
      INDArray bitShiftRight​(INDArray x, INDArray shift)
      Right bit shift operation
      INDArray bitShiftRotl​(INDArray x, INDArray shift)
      Cyclic bit shift operation
      INDArray bitShiftRotr​(INDArray x, INDArray shift)
      Cyclic right shift operation
      INDArray ceil​(INDArray x)
      Element-wise ceiling function: out = ceil(x).
      Rounds each value up to the nearest integer value (if not already an integer)
      INDArray clipByAvgNorm​(INDArray x, double clipValue, int... dimensions)
      Clips tensor values to a maximum average L2-norm.
      INDArray clipByNorm​(INDArray x, double clipValue, int... dimensions)
      Clipping by L2 norm, optionally along dimension(s)
      if l2Norm(x,dimension) < clipValue, then input is returned unmodifed
      Otherwise, out[i] = in[i] * clipValue / l2Norm(in, dimensions) where each value is clipped according
      to the corresponding l2Norm along the specified dimensions
      INDArray clipByValue​(INDArray x, double clipValueMin, double clipValueMax)
      Element-wise clipping function:
      out[i] = in[i] if in[i] >= clipValueMin and in[i] <= clipValueMax
      out[i] = clipValueMin if in[i] < clipValueMin
      out[i] = clipValueMax if in[i] > clipValueMax
      INDArray confusionMatrix​(INDArray labels, INDArray pred, int numClasses)
      Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
      which are represented as integer values.
      For example, if labels = [0, 1, 1], predicted = [0, 2, 1], and numClasses=4 then output is:
      [1, 0, 0, 0]
      [0, 1, 1, 0]
      [0, 0, 0, 0]
      [0, 0, 0, 0]
      INDArray confusionMatrix​(INDArray labels, INDArray pred, DataType dataType)
      Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
      which are represented as integer values.
      INDArray confusionMatrix​(INDArray labels, INDArray pred, INDArray weights)
      Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
      which are represented as integer values.
      INDArray confusionMatrix​(INDArray labels, INDArray pred, INDArray weights, int numClasses)
      Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
      which are represented as integer values.
      For example, if labels = [0, 1, 1], predicted = [0, 2, 1], numClasses = 4, and weights = [1, 2, 3]
      [1, 0, 0, 0]
      [0, 3, 2, 0]
      [0, 0, 0, 0]
      [0, 0, 0, 0]
      INDArray cos​(INDArray x)
      Elementwise cosine operation: out = cos(x)
      INDArray cosh​(INDArray x)
      Elementwise cosh (hyperbolic cosine) operation: out = cosh(x)
      INDArray cosineDistance​(INDArray x, INDArray y, boolean keepDims, boolean isComplex, int... dimensions)
      Cosine distance reduction operation.
      INDArray cosineDistance​(INDArray x, INDArray y, int... dimensions)
      Cosine distance reduction operation.
      INDArray cosineSimilarity​(INDArray x, INDArray y, boolean keepDims, boolean isComplex, int... dimensions)
      Cosine similarity pairwise reduction operation.
      INDArray cosineSimilarity​(INDArray x, INDArray y, int... dimensions)
      Cosine similarity pairwise reduction operation.
      INDArray countNonZero​(INDArray in, boolean keepDims, int... dimensions)
      Count non zero array reduction operation, optionally along specified dimensions: out = count(x != 0)
      INDArray countNonZero​(INDArray in, int... dimensions)
      Count non zero array reduction operation, optionally along specified dimensions: out = count(x != 0)
      INDArray countZero​(INDArray in, boolean keepDims, int... dimensions)
      Count zero array reduction operation, optionally along specified dimensions: out = count(x == 0)
      INDArray countZero​(INDArray in, int... dimensions)
      Count zero array reduction operation, optionally along specified dimensions: out = count(x == 0)
      INDArray cross​(INDArray a, INDArray b)
      Returns the pair-wise cross product of equal size arrays a and b: a x b = ||a||x||b|| sin(theta).
      Can take rank 1 or above inputs (of equal shapes), but note that the last dimension must have dimension 3
      INDArray cube​(INDArray x)
      Element-wise cube function: out = x^3
      INDArray diag​(INDArray x)
      Returns an output variable with diagonal values equal to the specified values; off-diagonal values will be set to 0
      For example, if input = [1,2,3], then output is given by:
      [ 1, 0, 0]
      [ 0, 2, 0]
      [ 0, 0, 3]

      Higher input ranks are also supported: if input has shape [a,...,R-1] then output[i,...,k,i,...,k] = input[i,...,k].
      i.e., for input rank R, output has rank 2R
      INDArray diagPart​(INDArray x)
      Extract the diagonal part from the input array.
      If input is
      [ 1, 0, 0]
      [ 0, 2, 0]
      [ 0, 0, 3]
      then output is [1, 2, 3].
      Supports higher dimensions: in general, out[i,...,k] = in[i,...,k,i,...,k]
      INDArray div​(INDArray x, double value)
      Scalar division operation, out = in / scalar
      INDArray div​(INDArray x, INDArray y)
      Pairwise division operation, out = x / y
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray embeddingLookup​(INDArray x, INDArray indices, PartitionMode PartitionMode)
      Looks up ids in a list of embedding tensors.
      INDArray entropy​(INDArray in, boolean keepDims, int... dimensions)
      Entropy reduction: -sum(x * log(x))
      INDArray entropy​(INDArray in, int... dimensions)
      Entropy reduction: -sum(x * log(x))
      INDArray erf​(INDArray x)
      Element-wise Gaussian error function - out = erf(in)
      INDArray erfc​(INDArray x)
      Element-wise complementary Gaussian error function - out = erfc(in) = 1 - erf(in)
      INDArray euclideanDistance​(INDArray x, INDArray y, boolean keepDims, boolean isComplex, int... dimensions)
      Euclidean distance (l2 norm, l2 distance) reduction operation.
      INDArray euclideanDistance​(INDArray x, INDArray y, int... dimensions)
      Euclidean distance (l2 norm, l2 distance) reduction operation.
      INDArray exp​(INDArray x)
      Elementwise exponent function: out = exp(x) = 2.71828...^x
      INDArray expm1​(INDArray x)
      Elementwise 1.0 - exponent function: out = 1.0 - exp(x) = 1.0 - 2.71828...^x
      INDArray eye​(int rows)
      Generate an identity matrix with the specified number of rows and columns.
      INDArray eye​(int rows, int cols)
      As per eye(String, int, int, DataType) but with the default datatype, Eye.DEFAULT_DTYPE
      INDArray eye​(int rows, int cols, DataType dataType, int... dimensions)
      Generate an identity matrix with the specified number of rows and columns
      Example:
      INDArray eye​(INDArray rows)
      As per eye(String, int) but with the number of rows specified as a scalar INDArray
      INDArray eye​(INDArray rows, INDArray cols)
      As per eye(int, int) bit with the number of rows/columns specified as scalar INDArrays
      INDArray firstIndex​(INDArray in, Condition condition, boolean keepDims, int... dimensions)
      First index reduction operation.
      Returns a variable that contains the index of the first element that matches the specified condition (for each
      slice along the specified dimensions)
      Note that if keepDims = true, the output variable has the same rank as the input variable,
      with the reduced dimensions having size 1.
      INDArray firstIndex​(INDArray in, Condition condition, int... dimensions)
      First index reduction operation.
      Returns a variable that contains the index of the first element that matches the specified condition (for each
      slice along the specified dimensions)
      Note that if keepDims = true, the output variable has the same rank as the input variable,
      with the reduced dimensions having size 1.
      INDArray floor​(INDArray x)
      Element-wise floor function: out = floor(x).
      Rounds each value down to the nearest integer value (if not already an integer)
      INDArray floorDiv​(INDArray x, INDArray y)
      Pairwise floor division operation, out = floor(x / y)
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray floorMod​(INDArray x, double value)
      Scalar floor modulus operation
      INDArray floorMod​(INDArray x, INDArray y)
      Pairwise Modulus division operation
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray hammingDistance​(INDArray x, INDArray y, boolean keepDims, boolean isComplex, int... dimensions)
      Hamming distance reduction operation.
      INDArray hammingDistance​(INDArray x, INDArray y, int... dimensions)
      Hamming distance reduction operation.
      INDArray iamax​(INDArray in, boolean keepDims, int... dimensions)
      Index of the max absolute value: argmax(abs(in))
      see argmax(String, INDArray, boolean, int...)
      INDArray iamax​(INDArray in, int... dimensions)
      Index of the max absolute value: argmax(abs(in))
      see argmax(String, INDArray, boolean, int...)
      INDArray iamin​(INDArray in, boolean keepDims, int... dimensions)
      Index of the min absolute value: argmin(abs(in))
      see argmin(String, INDArray, boolean, int...)
      INDArray iamin​(INDArray in, int... dimensions)
      Index of the min absolute value: argmin(abs(in))
      see argmin(String, INDArray, boolean, int...)
      INDArray isFinite​(INDArray x)
      Is finite operation: elementwise isFinite(x)
      Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or
      value 0 otherwise
      INDArray isInfinite​(INDArray x)
      Is infinite operation: elementwise isInfinite(x)
      Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or
      value 0 otherwise
      INDArray isMax​(INDArray x)
      Is maximum operation: elementwise x == max(x)
      Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or
      value 0 otherwise
      INDArray isNaN​(INDArray x)
      Is Not a Number operation: elementwise isNaN(x)
      Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or
      value 0 otherwise
      INDArray isNonDecreasing​(INDArray x)
      Is the array non decreasing?
      An array is non-decreasing if for every valid i, x[i] <= x[i+1].
      INDArray isStrictlyIncreasing​(INDArray x)
      Is the array strictly increasing?
      An array is strictly increasing if for every valid i, x[i] < x[i+1].
      INDArray jaccardDistance​(INDArray x, INDArray y, boolean keepDims, boolean isComplex, int... dimensions)
      Jaccard similarity reduction operation.
      INDArray jaccardDistance​(INDArray x, INDArray y, int... dimensions)
      Jaccard similarity reduction operation.
      INDArray lastIndex​(INDArray in, Condition condition, boolean keepDims, int... dimensions)
      Last index reduction operation.
      Returns a variable that contains the index of the last element that matches the specified condition (for each
      slice along the specified dimensions)
      Note that if keepDims = true, the output variable has the same rank as the input variable,
      with the reduced dimensions having size 1.
      INDArray lastIndex​(INDArray in, Condition condition, int... dimensions)
      Last index reduction operation.
      Returns a variable that contains the index of the last element that matches the specified condition (for each
      slice along the specified dimensions)
      Note that if keepDims = true, the output variable has the same rank as the input variable,
      with the reduced dimensions having size 1.
      INDArray[] listDiff​(INDArray x, INDArray y)
      Calculates difference between inputs X and Y.
      INDArray log​(INDArray x)
      Element-wise logarithm function (base e - natural logarithm): out = log(x)
      INDArray log​(INDArray x, double base)
      Element-wise logarithm function (with specified base): out = log_{base}(x)
      INDArray log1p​(INDArray x)
      Elementwise natural logarithm function: out = log_e (1 + x)
      INDArray logEntropy​(INDArray in, boolean keepDims, int... dimensions)
      Log entropy reduction: log(-sum(x * log(x)))
      INDArray logEntropy​(INDArray in, int... dimensions)
      Log entropy reduction: log(-sum(x * log(x)))
      INDArray logSumExp​(INDArray input, int... dimensions)
      Log-sum-exp reduction (optionally along dimension).
      Computes log(sum(exp(x))
      INDArray manhattanDistance​(INDArray x, INDArray y, boolean keepDims, boolean isComplex, int... dimensions)
      Manhattan distance (l1 norm, l1 distance) reduction operation.
      INDArray manhattanDistance​(INDArray x, INDArray y, int... dimensions)
      Manhattan distance (l1 norm, l1 distance) reduction operation.
      INDArray matrixDeterminant​(INDArray in)
      Matrix determinant op.
      INDArray matrixInverse​(INDArray in)
      Matrix inverse op.
      INDArray max​(INDArray x, INDArray y)
      Pairwise max operation, out = max(x, y)
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray mean​(INDArray in, boolean keepDims, int... dimensions)
      Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
      INDArray mean​(INDArray in, int... dimensions)
      Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
      INDArray mean​(INDArray in, INDArray dimensions)
      Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
      INDArray mean​(INDArray in, INDArray dimensions, boolean keepDims)
      Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
      INDArray mergeAdd​(INDArray... inputs)
      Merge add function: merges an arbitrary number of equal shaped arrays using element-wise addition:
      out = sum_i in[i]
      INDArray mergeAvg​(INDArray... inputs)
      Merge average function: merges an arbitrary number of equal shaped arrays using element-wise mean operation:
      out = mean_i in[i]
      INDArray mergeMax​(INDArray... inputs)
      Merge max function: merges an arbitrary number of equal shaped arrays using element-wise maximum operation:
      out = max_i in[i]
      INDArray mergeMaxIndex​(INDArray... x)
      Return array of max elements indices with along tensor dimensions
      INDArray mergeMaxIndex​(INDArray[] x, DataType dataType)
      Return array of max elements indices with along tensor dimensions
      INDArray[] meshgrid​(INDArray[] inputs, boolean cartesian)
      Broadcasts parameters for evaluation on an N-D grid.
      INDArray min​(INDArray x, INDArray y)
      Pairwise max operation, out = min(x, y)
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray mod​(INDArray x, INDArray y)
      Pairwise modulus (remainder) operation, out = x % y
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray[] moments​(INDArray input, int[] axes, boolean keepDims)
      Calculate the mean and (population) variance for the input variable, for the specified axis
      INDArray[] moments​(INDArray input, INDArray axes, boolean keepDims)
      Calculate the mean and (population) variance for the input variable, for the specified axis
      INDArray mul​(INDArray x, double value)
      Scalar multiplication operation, out = in * scalar
      INDArray mul​(INDArray x, INDArray y)
      Pairwise multiplication operation, out = x * y
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray neg​(INDArray x)
      Elementwise negative operation: out = -x
      INDArray norm1​(INDArray in, boolean keepDims, int... dimensions)
      Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
      INDArray norm1​(INDArray in, int... dimensions)
      Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
      INDArray norm1​(INDArray in, INDArray dimensions)
      Sum of absolute differences.
      INDArray norm1​(INDArray in, INDArray dimensions, boolean keepDims)
      Sum of absolute differences.
      INDArray norm2​(INDArray in, boolean keepDims, int... dimensions)
      Euclidean norm: euclidean distance of a vector from the origin
      INDArray norm2​(INDArray in, int... dimensions)
      Euclidean norm: euclidean distance of a vector from the origin
      INDArray norm2​(INDArray in, INDArray dimensions)
      Euclidean norm: euclidean distance of a vector from the origin
      INDArray norm2​(INDArray in, INDArray dimensions, boolean keepDims)
      Euclidean norm: euclidean distance of a vector from the origin
      INDArray[] normalizeMoments​(INDArray counts, INDArray means, INDArray variances, double shift)
      Calculate the mean and variance from the sufficient statistics
      INDArray normMax​(INDArray in, boolean keepDims, int... dimensions)
      Differences between max absolute value
      INDArray normMax​(INDArray in, int... dimensions)
      Differences between max absolute value
      INDArray normMax​(INDArray in, INDArray dimensions)
      Differences between max absolute value
      INDArray normMax​(INDArray in, INDArray dimensions, boolean keepDims)
      Differences between max absolute value
      INDArray or​(INDArray x, INDArray y)
      Boolean OR operation: elementwise (x != 0) || (y != 0)
      If x and y arrays have equal shape, the output shape is the same as these inputs.
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
      INDArray pow​(INDArray x, double value)
      Element-wise power function: out = x^value
      INDArray pow​(INDArray x, INDArray y)
      Element-wise (broadcastable) power function: out = x[i]^y[i]
      INDArray prod​(INDArray in, boolean keepDims, int... dimensions)
      The max of an array along each dimension
      INDArray prod​(INDArray in, int... dimensions)
      The max of an array along each dimension
      INDArray prod​(INDArray in, INDArray dimensions)
      The product of an array long each dimension
      INDArray prod​(INDArray in, INDArray dimensions, boolean keepDims)
      The product of an array long each dimension
      INDArray rationalTanh​(INDArray x)
      Rational Tanh Approximation elementwise function, as described in the paper:
      Compact Convolutional Neural Network Cascade for Face Detection
      This is a faster Tanh approximation
      INDArray rdiv​(INDArray x, double value)
      Scalar reverse division operation, out = scalar / in
      INDArray rdiv​(INDArray x, INDArray y)
      Pairwise reverse division operation, out = y / x
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray reciprocal​(INDArray x)
      Element-wise reciprocal (inverse) function: out[i] = 1 / in[i]
      INDArray rectifiedTanh​(INDArray x)
      Rectified tanh operation: max(0, tanh(in))
      INDArray reduceAMax​(INDArray in, boolean keepDims, int... dimensions)
      Absolute max array reduction operation, optionally along specified dimensions: out = max(abs(x))
      INDArray reduceAMax​(INDArray in, int... dimensions)
      Absolute max array reduction operation, optionally along specified dimensions: out = max(abs(x))
      INDArray reduceAMax​(INDArray in, INDArray dimensions)
      Absolute max array reduction operation, optionally along specified dimensions: out = max(abs(x))
      INDArray reduceAMax​(INDArray in, INDArray dimensions, boolean keepDims)
      Absolute max array reduction operation, optionally along specified dimensions: out = max(abs(x))
      INDArray reduceAmean​(INDArray in, boolean keepDims, int... dimensions)
      Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
      INDArray reduceAmean​(INDArray in, int... dimensions)
      Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
      INDArray reduceAmean​(INDArray in, INDArray dimensions)
      Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
      INDArray reduceAmean​(INDArray in, INDArray dimensions, boolean keepDims)
      Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
      INDArray reduceAmin​(INDArray in, boolean keepDims, int... dimensions)
      Absolute min array reduction operation, optionally along specified dimensions: out = min(abs(x))
      INDArray reduceAmin​(INDArray in, int... dimensions)
      Absolute min array reduction operation, optionally along specified dimensions: out = min(abs(x))
      INDArray reduceAmin​(INDArray in, INDArray dimensions)
      Absolute min array reduction operation, optionally along specified dimensions: out = min(abs(x))
      INDArray reduceAmin​(INDArray in, INDArray dimensions, boolean keepDims)
      Absolute min array reduction operation, optionally along specified dimensions: out = min(abs(x))
      INDArray reduceMax​(INDArray in, boolean keepDims, int... dimensions)
      The max of an array along each dimension
      INDArray reduceMax​(INDArray in, int... dimensions)
      The max of an array along each dimension
      INDArray reduceMax​(INDArray in, INDArray dimensions)
      The max of an array long each dimension
      INDArray reduceMax​(INDArray in, INDArray dimensions, boolean keepDims)
      The max of an array long each dimension
      INDArray reduceMin​(INDArray in, boolean keepDims, int... dimensions)
      The minimum of an array along each dimension
      INDArray reduceMin​(INDArray in, int... dimensions)
      The minimum of an array along each dimension
      INDArray reduceMin​(INDArray in, INDArray dimensions)
      The minimum of an array long each dimension
      INDArray reduceMin​(INDArray in, INDArray dimensions, boolean keepDims)
      The minimum of an array long each dimension
      INDArray round​(INDArray x)
      Element-wise round function: out = round(x).
      Rounds (up or down depending on value) to the nearest integer value.
      INDArray rsqrt​(INDArray x)
      Element-wise reciprocal (inverse) of square root: out = 1.0 / sqrt(x)
      INDArray rsub​(INDArray x, double value)
      Scalar reverse subtraction operation, out = scalar - in
      INDArray rsub​(INDArray x, INDArray y)
      Pairwise reverse subtraction operation, out = y - x
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray setDiag​(INDArray in, INDArray diag)
      Set the diagonal value to the specified values
      If input is
      [ a, b, c]
      [ d, e, f]
      [ g, h, i]
      and diag = [ 1, 2, 3] then output is
      [ 1, b, c]
      [ d, 2, f]
      [ g, h, 3]
      INDArray shannonEntropy​(INDArray in, boolean keepDims, int... dimensions)
      Shannon Entropy reduction: -sum(x * log2(x))
      INDArray shannonEntropy​(INDArray in, int... dimensions)
      Shannon Entropy reduction: -sum(x * log2(x))
      INDArray shannonEntropy​(INDArray in, INDArray dimensions)
      Shannon Entropy reduction: -sum(x * log2(x))
      INDArray shannonEntropy​(INDArray in, INDArray dimensions, boolean keepDims)
      Shannon Entropy reduction: -sum(x * log2(x))
      INDArray sign​(INDArray x)
      Element-wise sign (signum) function:
      out = -1 if in < 0
      out = 0 if in = 0
      out = 1 if in > 0
      INDArray sin​(INDArray x)
      Elementwise sine operation: out = sin(x)
      INDArray sinh​(INDArray x)
      Elementwise sinh (hyperbolic sine) operation: out = sinh(x)
      INDArray sqrt​(INDArray x)
      Element-wise square root function: out = sqrt(x)
      INDArray square​(INDArray x)
      Element-wise square function: out = x^2
      INDArray squaredDifference​(INDArray x, INDArray y)
      Pairwise squared difference operation.
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray squaredNorm​(INDArray in, boolean keepDims, int... dimensions)
      Sum of squared differences.
      INDArray squaredNorm​(INDArray in, int... dimensions)
      Sum of squared differences.
      INDArray squaredNorm​(INDArray in, INDArray dimensions)
      Sum of squared differences.
      INDArray squaredNorm​(INDArray in, INDArray dimensions, boolean keepDims)
      Sum of squared differences.
      INDArray standardize​(INDArray x, int... dimensions)
      Standardize input variable along given axis
      INDArray step​(INDArray x, double value)
      Elementwise step function:
      out(x) = 1 if x >= cutoff
      out(x) = 0 otherwise
      INDArray sub​(INDArray x, double value)
      Scalar subtraction operation, out = in - scalar
      INDArray sub​(INDArray x, INDArray y)
      Pairwise subtraction operation, out = x - y
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
      Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
      INDArray sum​(INDArray in, boolean keepDims, int... dimensions)
      Sum of an array, optionally along specified dimensions: out = sum(x))
      INDArray sum​(INDArray in, int... dimensions)
      Sum of an array, optionally along specified dimensions: out = sum(x))
      INDArray sum​(INDArray in, INDArray dimensions)
      Sum of an array, optionally along specified dimensions: out = sum(x))
      INDArray sum​(INDArray in, INDArray dimensions, boolean keepDims)
      Sum of an array, optionally along specified dimensions: out = sum(x))
      INDArray tan​(INDArray x)
      Elementwise tangent operation: out = tan(x)
      INDArray tanh​(INDArray x)
      Elementwise tanh (hyperbolic tangent) operation: out = tanh(x)
      INDArray trace​(INDArray in)
      Matrix trace operation
      For rank 2 matrices, the output is a scalar with the trace - i.e., sum of the main diagonal.
      For higher rank inputs, output[a,b,c] = trace(in[a,b,c,:,:])
      INDArray xor​(INDArray x, INDArray y)
      Boolean XOR (exclusive OR) operation: elementwise (x != 0) XOR (y != 0)
      If x and y arrays have equal shape, the output shape is the same as these inputs.
      Note: supports broadcasting if x and y have different shapes and are broadcastable.
      Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
      INDArray zeroFraction​(INDArray input)
      Full array zero fraction array reduction operation, optionally along specified dimensions: out = (count(x == 0) / length(x))
    • Constructor Detail

      • NDMath

        public NDMath()
    • Method Detail

      • clipByAvgNorm

        public INDArray clipByAvgNorm​(INDArray x,
                                      double clipValue,
                                      int... dimensions)
        Clips tensor values to a maximum average L2-norm.
        Parameters:
        x - Input variable (NUMERIC type)
        clipValue - Value for clipping
        dimensions - Dimensions to reduce over (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • embeddingLookup

        public INDArray embeddingLookup​(INDArray x,
                                        INDArray indices,
                                        PartitionMode PartitionMode)
        Looks up ids in a list of embedding tensors.
        Parameters:
        x - Input tensor (NUMERIC type)
        indices - A Tensor containing the ids to be looked up. (INT type)
        PartitionMode - partition_mode == 0 - i.e. 'mod' , 1 - 'div'
        Returns:
        output Shifted output (NUMERIC type)
      • mergeMaxIndex

        public INDArray mergeMaxIndex​(INDArray[] x,
                                      DataType dataType)
        Return array of max elements indices with along tensor dimensions
        Parameters:
        x - Input tensor (NUMERIC type)
        dataType - Data type
        Returns:
        output Array max elements indices with along dimensions. (INT type)
      • mergeMaxIndex

        public INDArray mergeMaxIndex​(INDArray... x)
        Return array of max elements indices with along tensor dimensions
        Parameters:
        x - Input tensor (NUMERIC type)
        Returns:
        output Array max elements indices with along dimensions. (INT type)
      • abs

        public INDArray abs​(INDArray x)
        Elementwise absolute value operation: out = abs(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • acos

        public INDArray acos​(INDArray x)
        Elementwise acos (arccosine, inverse cosine) operation: out = arccos(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • acosh

        public INDArray acosh​(INDArray x)
        Elementwise acosh (inverse hyperbolic cosine) function: out = acosh(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • add

        public INDArray add​(INDArray x,
                            INDArray y)
        Pairwise addition operation, out = x + y
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - Input variable (NUMERIC type)
        y - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • add

        public INDArray add​(INDArray x,
                            double value)
        Scalar add operation, out = in + scalar
        Parameters:
        x - Input variable (NUMERIC type)
        value - Scalar value for op
        Returns:
        output Output variable (NUMERIC type)
      • and

        public INDArray and​(INDArray x,
                            INDArray y)
        Boolean AND operation: elementwise (x != 0) && (y != 0)
        If x and y arrays have equal shape, the output shape is the same as these inputs.
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
        Parameters:
        x - Input 1 (BOOL type)
        y - Input 2 (BOOL type)
        Returns:
        output INDArray with values 0 and 1 based on where the condition is satisfied (BOOL type)
      • asin

        public INDArray asin​(INDArray x)
        Elementwise asin (arcsin, inverse sine) operation: out = arcsin(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • asinh

        public INDArray asinh​(INDArray x)
        Elementwise asinh (inverse hyperbolic sine) function: out = asinh(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • asum

        public INDArray asum​(INDArray in,
                             boolean keepDims,
                             int... dimensions)
        Absolute sum array reduction operation, optionally along specified dimensions: out = sum(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • asum

        public INDArray asum​(INDArray in,
                             int... dimensions)
        Absolute sum array reduction operation, optionally along specified dimensions: out = sum(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • atan

        public INDArray atan​(INDArray x)
        Elementwise atan (arctangent, inverse tangent) operation: out = arctangent(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • atan2

        public INDArray atan2​(INDArray y,
                              INDArray x)
        Elementwise atan (arctangent, inverse tangent) operation: out = atan2(x,y).
        Similar to atan(y/x) but sigts of x and y are used to determine the location of the result
        Parameters:
        y - Input Y variable (NUMERIC type)
        x - Input X variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • atanh

        public INDArray atanh​(INDArray x)
        Elementwise atanh (inverse hyperbolic tangent) function: out = atanh(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • bitShift

        public INDArray bitShift​(INDArray x,
                                 INDArray shift)
        Bit shift operation
        Parameters:
        x - input (NUMERIC type)
        shift - shift value (NUMERIC type)
        Returns:
        output shifted output (NUMERIC type)
      • bitShiftRight

        public INDArray bitShiftRight​(INDArray x,
                                      INDArray shift)
        Right bit shift operation
        Parameters:
        x - Input tensor (NUMERIC type)
        shift - shift argument (NUMERIC type)
        Returns:
        output shifted output (NUMERIC type)
      • bitShiftRotl

        public INDArray bitShiftRotl​(INDArray x,
                                     INDArray shift)
        Cyclic bit shift operation
        Parameters:
        x - Input tensor (NUMERIC type)
        shift - shift argy=ument (NUMERIC type)
        Returns:
        output shifted output (NUMERIC type)
      • bitShiftRotr

        public INDArray bitShiftRotr​(INDArray x,
                                     INDArray shift)
        Cyclic right shift operation
        Parameters:
        x - Input tensor (NUMERIC type)
        shift - Shift argument (NUMERIC type)
        Returns:
        output Shifted output (NUMERIC type)
      • ceil

        public INDArray ceil​(INDArray x)
        Element-wise ceiling function: out = ceil(x).
        Rounds each value up to the nearest integer value (if not already an integer)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • clipByNorm

        public INDArray clipByNorm​(INDArray x,
                                   double clipValue,
                                   int... dimensions)
        Clipping by L2 norm, optionally along dimension(s)
        if l2Norm(x,dimension) < clipValue, then input is returned unmodifed
        Otherwise, out[i] = in[i] * clipValue / l2Norm(in, dimensions) where each value is clipped according
        to the corresponding l2Norm along the specified dimensions
        Parameters:
        x - Input variable (NUMERIC type)
        clipValue - Clipping value (maximum l2 norm)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • clipByValue

        public INDArray clipByValue​(INDArray x,
                                    double clipValueMin,
                                    double clipValueMax)
        Element-wise clipping function:
        out[i] = in[i] if in[i] >= clipValueMin and in[i] <= clipValueMax
        out[i] = clipValueMin if in[i] < clipValueMin
        out[i] = clipValueMax if in[i] > clipValueMax
        Parameters:
        x - Input variable (NUMERIC type)
        clipValueMin - Minimum value for clipping
        clipValueMax - Maximum value for clipping
        Returns:
        output Output variable (NUMERIC type)
      • confusionMatrix

        public INDArray confusionMatrix​(INDArray labels,
                                        INDArray pred,
                                        DataType dataType)
        Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
        which are represented as integer values. This version assumes the number of classes is 1 + max(max(labels), max(pred))
        For example, if labels = [0, 1, 1] and predicted = [0, 2, 1] then output is:
        [1, 0, 0]
        [0, 1, 1]
        [0, 0, 0]
        Parameters:
        labels - Labels - 1D array of integer values representing label values (NUMERIC type)
        pred - Predictions - 1D array of integer values representing predictions. Same length as labels (NUMERIC type)
        dataType - Data type
        Returns:
        output variable (2D, shape [numClasses, numClasses}) (NUMERIC type)
      • confusionMatrix

        public INDArray confusionMatrix​(INDArray labels,
                                        INDArray pred,
                                        int numClasses)
        Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
        which are represented as integer values.
        For example, if labels = [0, 1, 1], predicted = [0, 2, 1], and numClasses=4 then output is:
        [1, 0, 0, 0]
        [0, 1, 1, 0]
        [0, 0, 0, 0]
        [0, 0, 0, 0]
        Parameters:
        labels - Labels - 1D array of integer values representing label values (NUMERIC type)
        pred - Predictions - 1D array of integer values representing predictions. Same length as labels (NUMERIC type)
        numClasses - Number of classes
        Returns:
        output variable (2D, shape [numClasses, numClasses}) (NUMERIC type)
      • confusionMatrix

        public INDArray confusionMatrix​(INDArray labels,
                                        INDArray pred,
                                        INDArray weights)
        Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
        which are represented as integer values. This version assumes the number of classes is 1 + max(max(labels), max(pred))
        For example, if labels = [0, 1, 1], predicted = [0, 2, 1] and weights = [1, 2, 3]
        [1, 0, 0]
        [0, 3, 2]
        [0, 0, 0]
        Parameters:
        labels - Labels - 1D array of integer values representing label values (NUMERIC type)
        pred - Predictions - 1D array of integer values representing predictions. Same length as labels (NUMERIC type)
        weights - Weights - 1D array of values (may be real/decimal) representing the weight/contribution of each prediction. Must be same length as both labels and predictions arrays (NUMERIC type)
        Returns:
        output variable (2D, shape [numClasses, numClasses}) (NUMERIC type)
      • confusionMatrix

        public INDArray confusionMatrix​(INDArray labels,
                                        INDArray pred,
                                        INDArray weights,
                                        int numClasses)
        Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
        which are represented as integer values.
        For example, if labels = [0, 1, 1], predicted = [0, 2, 1], numClasses = 4, and weights = [1, 2, 3]
        [1, 0, 0, 0]
        [0, 3, 2, 0]
        [0, 0, 0, 0]
        [0, 0, 0, 0]
        Parameters:
        labels - Labels - 1D array of integer values representing label values (NUMERIC type)
        pred - Predictions - 1D array of integer values representing predictions. Same length as labels (NUMERIC type)
        weights - Weights - 1D array of values (may be real/decimal) representing the weight/contribution of each prediction. Must be same length as both labels and predictions arrays (NUMERIC type)
        numClasses -
        Returns:
        output Output variable (2D, shape [numClasses, numClasses}) (NUMERIC type)
      • cos

        public INDArray cos​(INDArray x)
        Elementwise cosine operation: out = cos(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • cosh

        public INDArray cosh​(INDArray x)
        Elementwise cosh (hyperbolic cosine) operation: out = cosh(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • cosineDistance

        public INDArray cosineDistance​(INDArray x,
                                       INDArray y,
                                       boolean keepDims,
                                       boolean isComplex,
                                       int... dimensions)
        Cosine distance reduction operation. The output contains the cosine distance for each
        tensor/subset along the specified dimensions:
        out = 1.0 - cosineSimilarity(x,y)
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        keepDims - Whether to preserve original dimensions or not
        isComplex - Depending on the implementation, such as distance calculations, this can determine whether all distance calculations for all points should be done.
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • cosineDistance

        public INDArray cosineDistance​(INDArray x,
                                       INDArray y,
                                       int... dimensions)
        Cosine distance reduction operation. The output contains the cosine distance for each
        tensor/subset along the specified dimensions:
        out = 1.0 - cosineSimilarity(x,y)
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • cosineSimilarity

        public INDArray cosineSimilarity​(INDArray x,
                                         INDArray y,
                                         boolean keepDims,
                                         boolean isComplex,
                                         int... dimensions)
        Cosine similarity pairwise reduction operation. The output contains the cosine similarity for each tensor/subset
        along the specified dimensions:
        out = (sum_i x[i] * y[i]) / ( sqrt(sum_i x[i]^2) * sqrt(sum_i y[i]^2)
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        keepDims - Whether to preserve original dimensions or not
        isComplex - Depending on the implementation, such as distance calculations, this can determine whether all distance calculations for all points should be done.
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • cosineSimilarity

        public INDArray cosineSimilarity​(INDArray x,
                                         INDArray y,
                                         int... dimensions)
        Cosine similarity pairwise reduction operation. The output contains the cosine similarity for each tensor/subset
        along the specified dimensions:
        out = (sum_i x[i] * y[i]) / ( sqrt(sum_i x[i]^2) * sqrt(sum_i y[i]^2)
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • countNonZero

        public INDArray countNonZero​(INDArray in,
                                     boolean keepDims,
                                     int... dimensions)
        Count non zero array reduction operation, optionally along specified dimensions: out = count(x != 0)
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • countNonZero

        public INDArray countNonZero​(INDArray in,
                                     int... dimensions)
        Count non zero array reduction operation, optionally along specified dimensions: out = count(x != 0)
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • countZero

        public INDArray countZero​(INDArray in,
                                  boolean keepDims,
                                  int... dimensions)
        Count zero array reduction operation, optionally along specified dimensions: out = count(x == 0)
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • countZero

        public INDArray countZero​(INDArray in,
                                  int... dimensions)
        Count zero array reduction operation, optionally along specified dimensions: out = count(x == 0)
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • cross

        public INDArray cross​(INDArray a,
                              INDArray b)
        Returns the pair-wise cross product of equal size arrays a and b: a x b = ||a||x||b|| sin(theta).
        Can take rank 1 or above inputs (of equal shapes), but note that the last dimension must have dimension 3
        Parameters:
        a - First input (NUMERIC type)
        b - Second input (NUMERIC type)
        Returns:
        output Element-wise cross product (NUMERIC type)
      • cube

        public INDArray cube​(INDArray x)
        Element-wise cube function: out = x^3
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • diag

        public INDArray diag​(INDArray x)
        Returns an output variable with diagonal values equal to the specified values; off-diagonal values will be set to 0
        For example, if input = [1,2,3], then output is given by:
        [ 1, 0, 0]
        [ 0, 2, 0]
        [ 0, 0, 3]

        Higher input ranks are also supported: if input has shape [a,...,R-1] then output[i,...,k,i,...,k] = input[i,...,k].
        i.e., for input rank R, output has rank 2R
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • diagPart

        public INDArray diagPart​(INDArray x)
        Extract the diagonal part from the input array.
        If input is
        [ 1, 0, 0]
        [ 0, 2, 0]
        [ 0, 0, 3]
        then output is [1, 2, 3].
        Supports higher dimensions: in general, out[i,...,k] = in[i,...,k,i,...,k]
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Diagonal part of the input (NUMERIC type)
      • div

        public INDArray div​(INDArray x,
                            INDArray y)
        Pairwise division operation, out = x / y
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - Input variable (NUMERIC type)
        y - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • div

        public INDArray div​(INDArray x,
                            double value)
        Scalar division operation, out = in / scalar
        Parameters:
        x - Input variable (NUMERIC type)
        value - Scalar value for op
        Returns:
        output Output variable (NUMERIC type)
      • entropy

        public INDArray entropy​(INDArray in,
                                boolean keepDims,
                                int... dimensions)
        Entropy reduction: -sum(x * log(x))
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • entropy

        public INDArray entropy​(INDArray in,
                                int... dimensions)
        Entropy reduction: -sum(x * log(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • erf

        public INDArray erf​(INDArray x)
        Element-wise Gaussian error function - out = erf(in)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • erfc

        public INDArray erfc​(INDArray x)
        Element-wise complementary Gaussian error function - out = erfc(in) = 1 - erf(in)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • euclideanDistance

        public INDArray euclideanDistance​(INDArray x,
                                          INDArray y,
                                          boolean keepDims,
                                          boolean isComplex,
                                          int... dimensions)
        Euclidean distance (l2 norm, l2 distance) reduction operation. The output contains the Euclidean distance for each
        tensor/subset along the specified dimensions:
        out = sqrt( sum_i (x[i] - y[i])^2 )
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        keepDims - Whether to preserve original dimensions or not
        isComplex - Depending on the implementation, such as distance calculations, this can determine whether all distance calculations for all points should be done.
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • euclideanDistance

        public INDArray euclideanDistance​(INDArray x,
                                          INDArray y,
                                          int... dimensions)
        Euclidean distance (l2 norm, l2 distance) reduction operation. The output contains the Euclidean distance for each
        tensor/subset along the specified dimensions:
        out = sqrt( sum_i (x[i] - y[i])^2 )
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • exp

        public INDArray exp​(INDArray x)
        Elementwise exponent function: out = exp(x) = 2.71828...^x
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • expm1

        public INDArray expm1​(INDArray x)
        Elementwise 1.0 - exponent function: out = 1.0 - exp(x) = 1.0 - 2.71828...^x
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • eye

        public INDArray eye​(int rows)
        Generate an identity matrix with the specified number of rows and columns.
        Parameters:
        rows - Number of rows
        Returns:
        output Identity matrix (NUMERIC type)
      • eye

        public INDArray eye​(int rows,
                            int cols)
        As per eye(String, int, int, DataType) but with the default datatype, Eye.DEFAULT_DTYPE
        Parameters:
        rows - Number of rows
        cols - Number of columns
        Returns:
        output (NUMERIC type)
      • eye

        public INDArray eye​(int rows,
                            int cols,
                            DataType dataType,
                            int... dimensions)
        Generate an identity matrix with the specified number of rows and columns
        Example:

        INDArray eye = eye(3,2)<br> eye:<br> [ 1, 0]<br> [ 0, 1]<br> [ 0, 0]

        Parameters:
        rows - Number of rows
        cols - Number of columns
        dataType - Data type
        dimensions - (Size: AtLeast(min=0))
        Returns:
        output Identity matrix (NUMERIC type)
      • eye

        public INDArray eye​(INDArray rows,
                            INDArray cols)
        As per eye(int, int) bit with the number of rows/columns specified as scalar INDArrays
        Parameters:
        rows - Number of rows (INT type)
        cols - Number of columns (INT type)
        Returns:
        output Identity matrix (NUMERIC type)
      • eye

        public INDArray eye​(INDArray rows)
        As per eye(String, int) but with the number of rows specified as a scalar INDArray
        Parameters:
        rows - Number of rows (INT type)
        Returns:
        output SDVaribable identity matrix (NUMERIC type)
      • firstIndex

        public INDArray firstIndex​(INDArray in,
                                   Condition condition,
                                   int... dimensions)
        First index reduction operation.
        Returns a variable that contains the index of the first element that matches the specified condition (for each
        slice along the specified dimensions)
        Note that if keepDims = true, the output variable has the same rank as the input variable,
        with the reduced dimensions having size 1. This can be useful for later broadcast operations (such as subtracting
        the mean along a dimension).
        Example: if input has shape [a,b,c] and dimensions=[1] then output has shape:
        keepDims = true: [a,1,c]
        keepDims = false: [a,c]
        Parameters:
        in - Input variable (NUMERIC type)
        condition - Condition to check on input variable
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=1))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • firstIndex

        public INDArray firstIndex​(INDArray in,
                                   Condition condition,
                                   boolean keepDims,
                                   int... dimensions)
        First index reduction operation.
        Returns a variable that contains the index of the first element that matches the specified condition (for each
        slice along the specified dimensions)
        Note that if keepDims = true, the output variable has the same rank as the input variable,
        with the reduced dimensions having size 1. This can be useful for later broadcast operations (such as subtracting
        the mean along a dimension).
        Example: if input has shape [a,b,c] and dimensions=[1] then output has shape:
        keepDims = true: [a,1,c]
        keepDims = false: [a,c]
        Parameters:
        in - Input variable (NUMERIC type)
        condition - Condition to check on input variable
        keepDims - If true: keep the dimensions that are reduced on (as length 1). False: remove the reduction dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=1))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • floor

        public INDArray floor​(INDArray x)
        Element-wise floor function: out = floor(x).
        Rounds each value down to the nearest integer value (if not already an integer)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • floorDiv

        public INDArray floorDiv​(INDArray x,
                                 INDArray y)
        Pairwise floor division operation, out = floor(x / y)
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - Input variable (NUMERIC type)
        y - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • floorMod

        public INDArray floorMod​(INDArray x,
                                 INDArray y)
        Pairwise Modulus division operation
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - Input variable (NUMERIC type)
        y - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • floorMod

        public INDArray floorMod​(INDArray x,
                                 double value)
        Scalar floor modulus operation
        Parameters:
        x - Input variable (NUMERIC type)
        value - Scalar value for op
        Returns:
        output Output variable (NUMERIC type)
      • hammingDistance

        public INDArray hammingDistance​(INDArray x,
                                        INDArray y,
                                        boolean keepDims,
                                        boolean isComplex,
                                        int... dimensions)
        Hamming distance reduction operation. The output contains the cosine distance for each
        tensor/subset along the specified dimensions:
        out = count( x[i] != y[i] )
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        keepDims - Whether to preserve original dimensions or not
        isComplex - Depending on the implementation, such as distance calculations, this can determine whether all distance calculations for all points should be done.
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • hammingDistance

        public INDArray hammingDistance​(INDArray x,
                                        INDArray y,
                                        int... dimensions)
        Hamming distance reduction operation. The output contains the cosine distance for each
        tensor/subset along the specified dimensions:
        out = count( x[i] != y[i] )
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • iamax

        public INDArray iamax​(INDArray in,
                              int... dimensions)
        Index of the max absolute value: argmax(abs(in))
        see argmax(String, INDArray, boolean, int...)
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=1))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • iamax

        public INDArray iamax​(INDArray in,
                              boolean keepDims,
                              int... dimensions)
        Index of the max absolute value: argmax(abs(in))
        see argmax(String, INDArray, boolean, int...)
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - If true: keep the dimensions that are reduced on (as length 1). False: remove the reduction dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=1))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • iamin

        public INDArray iamin​(INDArray in,
                              int... dimensions)
        Index of the min absolute value: argmin(abs(in))
        see argmin(String, INDArray, boolean, int...)
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=1))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • iamin

        public INDArray iamin​(INDArray in,
                              boolean keepDims,
                              int... dimensions)
        Index of the min absolute value: argmin(abs(in))
        see argmin(String, INDArray, boolean, int...)
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - If true: keep the dimensions that are reduced on (as length 1). False: remove the reduction dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=1))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • isFinite

        public INDArray isFinite​(INDArray x)
        Is finite operation: elementwise isFinite(x)
        Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or
        value 0 otherwise
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • isInfinite

        public INDArray isInfinite​(INDArray x)
        Is infinite operation: elementwise isInfinite(x)
        Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or
        value 0 otherwise
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • isMax

        public INDArray isMax​(INDArray x)
        Is maximum operation: elementwise x == max(x)
        Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or
        value 0 otherwise
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • isNaN

        public INDArray isNaN​(INDArray x)
        Is Not a Number operation: elementwise isNaN(x)
        Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or
        value 0 otherwise
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • isNonDecreasing

        public INDArray isNonDecreasing​(INDArray x)
        Is the array non decreasing?
        An array is non-decreasing if for every valid i, x[i] <= x[i+1]. For Rank 2+ arrays, values are compared
        in 'c' (row major) order
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Scalar variable with value 1 if non-decreasing, or 0 otherwise (NUMERIC type)
      • isStrictlyIncreasing

        public INDArray isStrictlyIncreasing​(INDArray x)
        Is the array strictly increasing?
        An array is strictly increasing if for every valid i, x[i] < x[i+1]. For Rank 2+ arrays, values are compared
        in 'c' (row major) order
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Scalar variable with value 1 if strictly increasing, or 0 otherwise (NUMERIC type)
      • jaccardDistance

        public INDArray jaccardDistance​(INDArray x,
                                        INDArray y,
                                        boolean keepDims,
                                        boolean isComplex,
                                        int... dimensions)
        Jaccard similarity reduction operation. The output contains the Jaccard distance for each
        tensor along the specified dimensions.
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        keepDims - Whether to preserve original dimensions or not
        isComplex - Depending on the implementation, such as distance calculations, this can determine whether all distance calculations for all points should be done.
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • jaccardDistance

        public INDArray jaccardDistance​(INDArray x,
                                        INDArray y,
                                        int... dimensions)
        Jaccard similarity reduction operation. The output contains the Jaccard distance for each
        tensor along the specified dimensions.
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • lastIndex

        public INDArray lastIndex​(INDArray in,
                                  Condition condition,
                                  int... dimensions)
        Last index reduction operation.
        Returns a variable that contains the index of the last element that matches the specified condition (for each
        slice along the specified dimensions)
        Note that if keepDims = true, the output variable has the same rank as the input variable,
        with the reduced dimensions having size 1. This can be useful for later broadcast operations (such as subtracting
        the mean along a dimension).
        Example: if input has shape [a,b,c] and dimensions=[1] then output has shape:
        keepDims = true: [a,1,c]
        keepDims = false: [a,c]
        Parameters:
        in - Input variable (NUMERIC type)
        condition - Condition to check on input variable
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=1))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • lastIndex

        public INDArray lastIndex​(INDArray in,
                                  Condition condition,
                                  boolean keepDims,
                                  int... dimensions)
        Last index reduction operation.
        Returns a variable that contains the index of the last element that matches the specified condition (for each
        slice along the specified dimensions)
        Note that if keepDims = true, the output variable has the same rank as the input variable,
        with the reduced dimensions having size 1. This can be useful for later broadcast operations (such as subtracting
        the mean along a dimension).
        Example: if input has shape [a,b,c] and dimensions=[1] then output has shape:
        keepDims = true: [a,1,c]
        keepDims = false: [a,c]
        Parameters:
        in - Input variable (NUMERIC type)
        condition - Condition to check on input variable
        keepDims - If true: keep the dimensions that are reduced on (as length 1). False: remove the reduction dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=1))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • listDiff

        public INDArray[] listDiff​(INDArray x,
                                   INDArray y)
        Calculates difference between inputs X and Y.
        Parameters:
        x - Input variable X (NUMERIC type)
        y - Input variable Y (NUMERIC type)
      • log

        public INDArray log​(INDArray x)
        Element-wise logarithm function (base e - natural logarithm): out = log(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • log

        public INDArray log​(INDArray x,
                            double base)
        Element-wise logarithm function (with specified base): out = log_{base}(x)
        Parameters:
        x - Input variable (NUMERIC type)
        base - Logarithm base
        Returns:
        output Output variable (NUMERIC type)
      • log1p

        public INDArray log1p​(INDArray x)
        Elementwise natural logarithm function: out = log_e (1 + x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • logEntropy

        public INDArray logEntropy​(INDArray in,
                                   boolean keepDims,
                                   int... dimensions)
        Log entropy reduction: log(-sum(x * log(x)))
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • logEntropy

        public INDArray logEntropy​(INDArray in,
                                   int... dimensions)
        Log entropy reduction: log(-sum(x * log(x)))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • logSumExp

        public INDArray logSumExp​(INDArray input,
                                  int... dimensions)
        Log-sum-exp reduction (optionally along dimension).
        Computes log(sum(exp(x))
        Parameters:
        input - Input variable (NUMERIC type)
        dimensions - Optional dimensions to reduce along (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • manhattanDistance

        public INDArray manhattanDistance​(INDArray x,
                                          INDArray y,
                                          boolean keepDims,
                                          boolean isComplex,
                                          int... dimensions)
        Manhattan distance (l1 norm, l1 distance) reduction operation. The output contains the Manhattan distance for each
        tensor/subset along the specified dimensions:
        out = sum_i abs(x[i]-y[i])
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        keepDims - Whether to preserve original dimensions or not
        isComplex - Depending on the implementation, such as distance calculations, this can determine whether all distance calculations for all points should be done.
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • manhattanDistance

        public INDArray manhattanDistance​(INDArray x,
                                          INDArray y,
                                          int... dimensions)
        Manhattan distance (l1 norm, l1 distance) reduction operation. The output contains the Manhattan distance for each
        tensor/subset along the specified dimensions:
        out = sum_i abs(x[i]-y[i])
        Parameters:
        x - Input variable x (NUMERIC type)
        y - Input variable y (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Output variable (NUMERIC type)
      • matrixDeterminant

        public INDArray matrixDeterminant​(INDArray in)
        Matrix determinant op. For 2D input, this returns the standard matrix determinant.
        For higher dimensional input with shape [..., m, m] the matrix determinant is returned for each
        shape [m,m] sub-matrix.
        Parameters:
        in - Input (NUMERIC type)
        Returns:
        output Matrix determinant variable (NUMERIC type)
      • matrixInverse

        public INDArray matrixInverse​(INDArray in)
        Matrix inverse op. For 2D input, this returns the standard matrix inverse.
        For higher dimensional input with shape [..., m, m] the matrix inverse is returned for each
        shape [m,m] sub-matrix.
        Parameters:
        in - Input (NUMERIC type)
        Returns:
        output Matrix inverse variable (NUMERIC type)
      • max

        public INDArray max​(INDArray x,
                            INDArray y)
        Pairwise max operation, out = max(x, y)
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - First input variable, x (NUMERIC type)
        y - Second input variable, y (NUMERIC type)
        Returns:
        out Output (NUMERIC type)
      • mean

        public INDArray mean​(INDArray in,
                             boolean keepDims,
                             int... dimensions)
        Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • mean

        public INDArray mean​(INDArray in,
                             int... dimensions)
        Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • mean

        public INDArray mean​(INDArray in,
                             INDArray dimensions,
                             boolean keepDims)
        Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • mean

        public INDArray mean​(INDArray in,
                             INDArray dimensions)
        Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • mergeAdd

        public INDArray mergeAdd​(INDArray... inputs)
        Merge add function: merges an arbitrary number of equal shaped arrays using element-wise addition:
        out = sum_i in[i]
        Parameters:
        inputs - Input variables (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • mergeAvg

        public INDArray mergeAvg​(INDArray... inputs)
        Merge average function: merges an arbitrary number of equal shaped arrays using element-wise mean operation:
        out = mean_i in[i]
        Parameters:
        inputs - Input variables (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • mergeMax

        public INDArray mergeMax​(INDArray... inputs)
        Merge max function: merges an arbitrary number of equal shaped arrays using element-wise maximum operation:
        out = max_i in[i]
        Parameters:
        inputs - Input variables (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • meshgrid

        public INDArray[] meshgrid​(INDArray[] inputs,
                                   boolean cartesian)
        Broadcasts parameters for evaluation on an N-D grid.
        Parameters:
        inputs - (NUMERIC type)
        cartesian -
      • min

        public INDArray min​(INDArray x,
                            INDArray y)
        Pairwise max operation, out = min(x, y)
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - First input variable, x (NUMERIC type)
        y - Second input variable, y (NUMERIC type)
        Returns:
        out Output (NUMERIC type)
      • mod

        public INDArray mod​(INDArray x,
                            INDArray y)
        Pairwise modulus (remainder) operation, out = x % y
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - Input variable (NUMERIC type)
        y - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • moments

        public INDArray[] moments​(INDArray input,
                                  int[] axes,
                                  boolean keepDims)
        Calculate the mean and (population) variance for the input variable, for the specified axis
        Parameters:
        input - Input to calculate moments for (NUMERIC type)
        axes - Dimensions to perform calculation over (Size: AtLeast(min=0))
        keepDims - Whether to keep dimensions during reduction or not.
      • moments

        public INDArray[] moments​(INDArray input,
                                  INDArray axes,
                                  boolean keepDims)
        Calculate the mean and (population) variance for the input variable, for the specified axis
        Parameters:
        input - Input to calculate moments for (NUMERIC type)
        axes - Dimensions to perform calculation over (NUMERIC type)
        keepDims - Whether to keep dimensions during reduction or not.
      • mul

        public INDArray mul​(INDArray x,
                            INDArray y)
        Pairwise multiplication operation, out = x * y
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - Input variable (NUMERIC type)
        y - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • mul

        public INDArray mul​(INDArray x,
                            double value)
        Scalar multiplication operation, out = in * scalar
        Parameters:
        x - Input variable (NUMERIC type)
        value - Scalar value for op
        Returns:
        output Output variable (NUMERIC type)
      • neg

        public INDArray neg​(INDArray x)
        Elementwise negative operation: out = -x
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • norm1

        public INDArray norm1​(INDArray in,
                              boolean keepDims,
                              int... dimensions)
        Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • norm1

        public INDArray norm1​(INDArray in,
                              int... dimensions)
        Mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • norm1

        public INDArray norm1​(INDArray in,
                              INDArray dimensions,
                              boolean keepDims)
        Sum of absolute differences.
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • norm1

        public INDArray norm1​(INDArray in,
                              INDArray dimensions)
        Sum of absolute differences.
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • norm2

        public INDArray norm2​(INDArray in,
                              boolean keepDims,
                              int... dimensions)
        Euclidean norm: euclidean distance of a vector from the origin
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • norm2

        public INDArray norm2​(INDArray in,
                              int... dimensions)
        Euclidean norm: euclidean distance of a vector from the origin
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • norm2

        public INDArray norm2​(INDArray in,
                              INDArray dimensions,
                              boolean keepDims)
        Euclidean norm: euclidean distance of a vector from the origin
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • norm2

        public INDArray norm2​(INDArray in,
                              INDArray dimensions)
        Euclidean norm: euclidean distance of a vector from the origin
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • normMax

        public INDArray normMax​(INDArray in,
                                boolean keepDims,
                                int... dimensions)
        Differences between max absolute value
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • normMax

        public INDArray normMax​(INDArray in,
                                int... dimensions)
        Differences between max absolute value
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • normMax

        public INDArray normMax​(INDArray in,
                                INDArray dimensions,
                                boolean keepDims)
        Differences between max absolute value
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • normMax

        public INDArray normMax​(INDArray in,
                                INDArray dimensions)
        Differences between max absolute value
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • normalizeMoments

        public INDArray[] normalizeMoments​(INDArray counts,
                                           INDArray means,
                                           INDArray variances,
                                           double shift)
        Calculate the mean and variance from the sufficient statistics
        Parameters:
        counts - Rank 0 (scalar) value with the total number of values used to calculate the sufficient statistics (NUMERIC type)
        means - Mean-value sufficient statistics: this is the SUM of all data values (NUMERIC type)
        variances - Variaance sufficient statistics: this is the squared sum of all data values (NUMERIC type)
        shift - Shift value, possibly 0, used when calculating the sufficient statistics (for numerical stability)
      • or

        public INDArray or​(INDArray x,
                           INDArray y)
        Boolean OR operation: elementwise (x != 0) || (y != 0)
        If x and y arrays have equal shape, the output shape is the same as these inputs.
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
        Parameters:
        x - Input 1 (BOOL type)
        y - Input 2 (BOOL type)
        Returns:
        output INDArray with values 0 and 1 based on where the condition is satisfied (BOOL type)
      • pow

        public INDArray pow​(INDArray x,
                            double value)
        Element-wise power function: out = x^value
        Parameters:
        x - Input variable (NUMERIC type)
        value - Scalar value for op
        Returns:
        output Output variable (NUMERIC type)
      • pow

        public INDArray pow​(INDArray x,
                            INDArray y)
        Element-wise (broadcastable) power function: out = x[i]^y[i]
        Parameters:
        x - Input variable (NUMERIC type)
        y - Power (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • prod

        public INDArray prod​(INDArray in,
                             boolean keepDims,
                             int... dimensions)
        The max of an array along each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • prod

        public INDArray prod​(INDArray in,
                             int... dimensions)
        The max of an array along each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • prod

        public INDArray prod​(INDArray in,
                             INDArray dimensions,
                             boolean keepDims)
        The product of an array long each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • prod

        public INDArray prod​(INDArray in,
                             INDArray dimensions)
        The product of an array long each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • rationalTanh

        public INDArray rationalTanh​(INDArray x)
        Rational Tanh Approximation elementwise function, as described in the paper:
        Compact Convolutional Neural Network Cascade for Face Detection
        This is a faster Tanh approximation
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • rdiv

        public INDArray rdiv​(INDArray x,
                             INDArray y)
        Pairwise reverse division operation, out = y / x
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - Input variable (NUMERIC type)
        y - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • rdiv

        public INDArray rdiv​(INDArray x,
                             double value)
        Scalar reverse division operation, out = scalar / in
        Parameters:
        x - Input variable (NUMERIC type)
        value - Scalar value for op
        Returns:
        output Output variable (NUMERIC type)
      • reciprocal

        public INDArray reciprocal​(INDArray x)
        Element-wise reciprocal (inverse) function: out[i] = 1 / in[i]
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • rectifiedTanh

        public INDArray rectifiedTanh​(INDArray x)
        Rectified tanh operation: max(0, tanh(in))
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • reduceAMax

        public INDArray reduceAMax​(INDArray in,
                                   boolean keepDims,
                                   int... dimensions)
        Absolute max array reduction operation, optionally along specified dimensions: out = max(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceAMax

        public INDArray reduceAMax​(INDArray in,
                                   int... dimensions)
        Absolute max array reduction operation, optionally along specified dimensions: out = max(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceAMax

        public INDArray reduceAMax​(INDArray in,
                                   INDArray dimensions,
                                   boolean keepDims)
        Absolute max array reduction operation, optionally along specified dimensions: out = max(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceAMax

        public INDArray reduceAMax​(INDArray in,
                                   INDArray dimensions)
        Absolute max array reduction operation, optionally along specified dimensions: out = max(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceAmean

        public INDArray reduceAmean​(INDArray in,
                                    boolean keepDims,
                                    int... dimensions)
        Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceAmean

        public INDArray reduceAmean​(INDArray in,
                                    int... dimensions)
        Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceAmean

        public INDArray reduceAmean​(INDArray in,
                                    INDArray dimensions,
                                    boolean keepDims)
        Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceAmean

        public INDArray reduceAmean​(INDArray in,
                                    INDArray dimensions)
        Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceAmin

        public INDArray reduceAmin​(INDArray in,
                                   boolean keepDims,
                                   int... dimensions)
        Absolute min array reduction operation, optionally along specified dimensions: out = min(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceAmin

        public INDArray reduceAmin​(INDArray in,
                                   int... dimensions)
        Absolute min array reduction operation, optionally along specified dimensions: out = min(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceAmin

        public INDArray reduceAmin​(INDArray in,
                                   INDArray dimensions,
                                   boolean keepDims)
        Absolute min array reduction operation, optionally along specified dimensions: out = min(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceAmin

        public INDArray reduceAmin​(INDArray in,
                                   INDArray dimensions)
        Absolute min array reduction operation, optionally along specified dimensions: out = min(abs(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceMax

        public INDArray reduceMax​(INDArray in,
                                  boolean keepDims,
                                  int... dimensions)
        The max of an array along each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceMax

        public INDArray reduceMax​(INDArray in,
                                  int... dimensions)
        The max of an array along each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceMax

        public INDArray reduceMax​(INDArray in,
                                  INDArray dimensions,
                                  boolean keepDims)
        The max of an array long each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceMax

        public INDArray reduceMax​(INDArray in,
                                  INDArray dimensions)
        The max of an array long each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceMin

        public INDArray reduceMin​(INDArray in,
                                  boolean keepDims,
                                  int... dimensions)
        The minimum of an array along each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceMin

        public INDArray reduceMin​(INDArray in,
                                  int... dimensions)
        The minimum of an array along each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceMin

        public INDArray reduceMin​(INDArray in,
                                  INDArray dimensions,
                                  boolean keepDims)
        The minimum of an array long each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • reduceMin

        public INDArray reduceMin​(INDArray in,
                                  INDArray dimensions)
        The minimum of an array long each dimension
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • round

        public INDArray round​(INDArray x)
        Element-wise round function: out = round(x).
        Rounds (up or down depending on value) to the nearest integer value.
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • rsqrt

        public INDArray rsqrt​(INDArray x)
        Element-wise reciprocal (inverse) of square root: out = 1.0 / sqrt(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • rsub

        public INDArray rsub​(INDArray x,
                             INDArray y)
        Pairwise reverse subtraction operation, out = y - x
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - Input variable (NUMERIC type)
        y - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • rsub

        public INDArray rsub​(INDArray x,
                             double value)
        Scalar reverse subtraction operation, out = scalar - in
        Parameters:
        x - Input variable (NUMERIC type)
        value - Scalar value for op
        Returns:
        output Output variable (NUMERIC type)
      • setDiag

        public INDArray setDiag​(INDArray in,
                                INDArray diag)
        Set the diagonal value to the specified values
        If input is
        [ a, b, c]
        [ d, e, f]
        [ g, h, i]
        and diag = [ 1, 2, 3] then output is
        [ 1, b, c]
        [ d, 2, f]
        [ g, h, 3]
        Parameters:
        in - Input variable (NUMERIC type)
        diag - Diagonal (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • shannonEntropy

        public INDArray shannonEntropy​(INDArray in,
                                       boolean keepDims,
                                       int... dimensions)
        Shannon Entropy reduction: -sum(x * log2(x))
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • shannonEntropy

        public INDArray shannonEntropy​(INDArray in,
                                       int... dimensions)
        Shannon Entropy reduction: -sum(x * log2(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • shannonEntropy

        public INDArray shannonEntropy​(INDArray in,
                                       INDArray dimensions,
                                       boolean keepDims)
        Shannon Entropy reduction: -sum(x * log2(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • shannonEntropy

        public INDArray shannonEntropy​(INDArray in,
                                       INDArray dimensions)
        Shannon Entropy reduction: -sum(x * log2(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • sign

        public INDArray sign​(INDArray x)
        Element-wise sign (signum) function:
        out = -1 if in < 0
        out = 0 if in = 0
        out = 1 if in > 0
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • sin

        public INDArray sin​(INDArray x)
        Elementwise sine operation: out = sin(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • sinh

        public INDArray sinh​(INDArray x)
        Elementwise sinh (hyperbolic sine) operation: out = sinh(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • sqrt

        public INDArray sqrt​(INDArray x)
        Element-wise square root function: out = sqrt(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • square

        public INDArray square​(INDArray x)
        Element-wise square function: out = x^2
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • squaredDifference

        public INDArray squaredDifference​(INDArray x,
                                          INDArray y)
        Pairwise squared difference operation.
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - Input variable (NUMERIC type)
        y - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • squaredNorm

        public INDArray squaredNorm​(INDArray in,
                                    boolean keepDims,
                                    int... dimensions)
        Sum of squared differences.
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • squaredNorm

        public INDArray squaredNorm​(INDArray in,
                                    int... dimensions)
        Sum of squared differences.
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • squaredNorm

        public INDArray squaredNorm​(INDArray in,
                                    INDArray dimensions,
                                    boolean keepDims)
        Sum of squared differences.
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • squaredNorm

        public INDArray squaredNorm​(INDArray in,
                                    INDArray dimensions)
        Sum of squared differences.
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • standardize

        public INDArray standardize​(INDArray x,
                                    int... dimensions)
        Standardize input variable along given axis


        out = (x - mean) / stdev


        with mean and stdev being calculated along the given dimension.


        For example: given x as a mini batch of the shape [numExamples, exampleLength]:


        • use dimension 1 too use the statistics (mean, stdev) for each example

        • use dimension 0 if you want to use the statistics for each column across all examples

        • use dimensions 0,1 if you want to use the statistics across all columns and examples


        Parameters:
        x - Input variable (NUMERIC type)
        dimensions - (Size: AtLeast(min=1))
        Returns:
        output Output variable (NUMERIC type)
      • step

        public INDArray step​(INDArray x,
                             double value)
        Elementwise step function:
        out(x) = 1 if x >= cutoff
        out(x) = 0 otherwise
        Parameters:
        x - Input variable (NUMERIC type)
        value - Scalar value for op
        Returns:
        output Output variable (NUMERIC type)
      • sub

        public INDArray sub​(INDArray x,
                            INDArray y)
        Pairwise subtraction operation, out = x - y
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]
        Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html
        Parameters:
        x - Input variable (NUMERIC type)
        y - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • sub

        public INDArray sub​(INDArray x,
                            double value)
        Scalar subtraction operation, out = in - scalar
        Parameters:
        x - Input variable (NUMERIC type)
        value - Scalar value for op
        Returns:
        output Output variable (NUMERIC type)
      • sum

        public INDArray sum​(INDArray in,
                            boolean keepDims,
                            int... dimensions)
        Sum of an array, optionally along specified dimensions: out = sum(x))
        Parameters:
        in - Input variable (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • sum

        public INDArray sum​(INDArray in,
                            int... dimensions)
        Sum of an array, optionally along specified dimensions: out = sum(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • sum

        public INDArray sum​(INDArray in,
                            INDArray dimensions,
                            boolean keepDims)
        Sum of an array, optionally along specified dimensions: out = sum(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        keepDims - Whether to keep the original dimensions or produce a shrunk array with less dimensions
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • sum

        public INDArray sum​(INDArray in,
                            INDArray dimensions)
        Sum of an array, optionally along specified dimensions: out = sum(x))
        Parameters:
        in - Input variable (NUMERIC type)
        dimensions - Dimensions to reduce along (NUMERIC type)
        Returns:
        output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
      • tan

        public INDArray tan​(INDArray x)
        Elementwise tangent operation: out = tan(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • tanh

        public INDArray tanh​(INDArray x)
        Elementwise tanh (hyperbolic tangent) operation: out = tanh(x)
        Parameters:
        x - Input variable (NUMERIC type)
        Returns:
        output Output variable (NUMERIC type)
      • trace

        public INDArray trace​(INDArray in)
        Matrix trace operation
        For rank 2 matrices, the output is a scalar with the trace - i.e., sum of the main diagonal.
        For higher rank inputs, output[a,b,c] = trace(in[a,b,c,:,:])
        Parameters:
        in - Input variable (NUMERIC type)
        Returns:
        output Trace (NUMERIC type)
      • xor

        public INDArray xor​(INDArray x,
                            INDArray y)
        Boolean XOR (exclusive OR) operation: elementwise (x != 0) XOR (y != 0)
        If x and y arrays have equal shape, the output shape is the same as these inputs.
        Note: supports broadcasting if x and y have different shapes and are broadcastable.
        Returns an array with values 1 where condition is satisfied, or value 0 otherwise.
        Parameters:
        x - Input 1 (BOOL type)
        y - Input 2 (BOOL type)
        Returns:
        output INDArray with values 0 and 1 based on where the condition is satisfied (BOOL type)
      • zeroFraction

        public INDArray zeroFraction​(INDArray input)
        Full array zero fraction array reduction operation, optionally along specified dimensions: out = (count(x == 0) / length(x))
        Parameters:
        input - Input variable (NUMERIC type)
        Returns:
        output Reduced array of rank 0 (scalar) (NUMERIC type)