Comment on page
Math
INDArray ClipByAvgNorm(INDArray x, double clipValue, int[] dimensions)
SDVariable ClipByAvgNorm(SDVariable x, double clipValue, int[] dimensions)
SDVariable ClipByAvgNorm(String name, SDVariable x, double clipValue, int[] dimensions)
Clips tensor values to a maximum average L2-norm.
- x (NUMERIC) - Input variable
- clipValue - Value for clipping
- dimensions - Dimensions to reduce over (Size: AtLeast(min=0))
INDArray EmbeddingLookup(INDArray x, INDArray indices, PartitionMode PartitionMode)
SDVariable EmbeddingLookup(SDVariable x, SDVariable indices, PartitionMode PartitionMode)
SDVariable EmbeddingLookup(String name, SDVariable x, SDVariable indices, PartitionMode PartitionMode)
Looks up ids in a list of embedding tensors.
- x (NUMERIC) - Input tensor
- indices (INT) - A Tensor containing the ids to be looked up.
- PartitionMode - partition_mode == 0 - i.e. 'mod' , 1 - 'div'
INDArray MergeMaxIndex(INDArray x, DataType dataType)
INDArray MergeMaxIndex(INDArray x)
SDVariable MergeMaxIndex(SDVariable x, DataType dataType)
SDVariable MergeMaxIndex(SDVariable x)
SDVariable MergeMaxIndex(String name, SDVariable x, DataType dataType)
SDVariable MergeMaxIndex(String name, SDVariable x)
Return array of max elements indices with along tensor dimensions
- x (NUMERIC) - Input tensor
- dataType - Data type - default = DataType.INT
INDArray abs(INDArray x)
SDVariable abs(SDVariable x)
SDVariable abs(String name, SDVariable x)
Elementwise absolute value operation: out = abs(x)
- x (NUMERIC) - Input variable
INDArray acos(INDArray x)
SDVariable acos(SDVariable x)
SDVariable acos(String name, SDVariable x)
Elementwise acos (arccosine, inverse cosine) operation: out = arccos(x)
- x (NUMERIC) - Input variable
INDArray acosh(INDArray x)
SDVariable acosh(SDVariable x)
SDVariable acosh(String name, SDVariable x)
Elementwise acosh (inverse hyperbolic cosine) function: out = acosh(x)
- x (NUMERIC) - Input variable
INDArray add(INDArray x, INDArray y)
SDVariable add(SDVariable x, SDVariable y)
SDVariable add(String name, SDVariable x, SDVariable 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
- x (NUMERIC) - Input variable
- y (NUMERIC) - Input variable
INDArray add(INDArray x, double value)
SDVariable add(SDVariable x, double value)
SDVariable add(String name, SDVariable x, double value)
Scalar add operation, out = in + scalar
- x (NUMERIC) - Input variable
- value - Scalar value for op
INDArray amax(INDArray in, int[] dimensions)
SDVariable amax(SDVariable in, int[] dimensions)
SDVariable amax(String name, SDVariable in, int[] dimensions)
Absolute max array reduction operation, optionally along specified dimensions: out = max(abs(x))
- in (NUMERIC) - Input variable
- dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
INDArray amean(INDArray in, int[] dimensions)
SDVariable amean(SDVariable in, int[] dimensions)
SDVariable amean(String name, SDVariable in, int[] dimensions)
Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
- in (NUMERIC) - Input variable
- dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
INDArray amin(INDArray in, int[] dimensions)
SDVariable amin(SDVariable in, int[] dimensions)
SDVariable amin(String name, SDVariable in, int[] dimensions)
Absolute min array reduction operation, optionally along specified dimensions: out = min(abs(x))
- in (NUMERIC) - Input variable
- dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
INDArray and(INDArray x, INDArray y)
SDVariable and(SDVariable x, SDVariable y)
SDVariable and(String name, SDVariable x, SDVariable 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.
- x (BOOL) - Input 1
- y (BOOL) - Input 2
INDArray asin(INDArray x)
SDVariable asin(SDVariable x)
SDVariable asin(String name, SDVariable x)
Elementwise asin (arcsin, inverse sine) operation: out = arcsin(x)
- x (NUMERIC) - Input variable
INDArray asinh(INDArray x)
SDVariable asinh(SDVariable x)
SDVariable asinh(String name, SDVariable x)
Elementwise asinh (inverse hyperbolic sine) function: out = asinh(x)
- x (NUMERIC) - Input variable
INDArray asum(INDArray in, int[] dimensions)
SDVariable asum(SDVariable in, int[] dimensions)
SDVariable asum(String name, SDVariable in, int[] dimensions)
Absolute sum array reduction operation, optionally along specified dimensions: out = sum(abs(x))
- in (NUMERIC) - Input variable
- dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
INDArray atan(INDArray x)
SDVariable atan(SDVariable x)
SDVariable atan(String name, SDVariable x)
Elementwise atan (arctangent, inverse tangent) operation: out = arctangent(x)
- x (NUMERIC) - Input variable
INDArray atan2(INDArray y, INDArray x)
SDVariable atan2(SDVariable y, SDVariable x)
SDVariable atan2(String name, SDVariable y, SDVariable 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
- y (NUMERIC) - Input Y variable
- x (NUMERIC) - Input X variable
INDArray atanh(INDArray x)
SDVariable atanh(SDVariable x)
SDVariable atanh(String name, SDVariable x)
Elementwise atanh (inverse hyperbolic tangent) function: out = atanh(x)
- x (NUMERIC) - Input variable
INDArray bitShift(INDArray x, INDArray shift)
SDVariable bitShift(SDVariable x, SDVariable shift)
SDVariable bitShift(String name, SDVariable x, SDVariable shift)
Bit shift operation
- x (NUMERIC) - input
- shift (NUMERIC) - shift value
INDArray bitShiftRight(INDArray x, INDArray shift)
SDVariable bitShiftRight(SDVariable x, SDVariable shift)
SDVariable bitShiftRight(String name, SDVariable x, SDVariable shift)
Right bit shift operation
- x (NUMERIC) - Input tensor
- shift (NUMERIC) - shift argument
INDArray bitShiftRotl(INDArray x, INDArray shift)
SDVariable bitShiftRotl(SDVariable x, SDVariable shift)
SDVariable bitShiftRotl(String name, SDVariable x, SDVariable shift)
Cyclic bit shift operation
- x (NUMERIC) - Input tensor
- shift (NUMERIC) - shift argy=ument
INDArray bitShiftRotr(INDArray x, INDArray shift)
SDVariable bitShiftRotr(SDVariable x, SDVariable shift)
SDVariable bitShiftRotr(String name, SDVariable x, SDVariable shift)
Cyclic right shift operation
- x (NUMERIC) - Input tensor
- shift (NUMERIC) - Shift argument
INDArray ceil(INDArray x)
SDVariable ceil(SDVariable x)
SDVariable ceil(String name, SDVariable x)
Element-wise ceiling function: out = ceil(x).
Rounds each value up to the nearest integer value (if not already an integer)
- x (NUMERIC) - Input variable
INDArray clipByNorm(INDArray x, double clipValue, int[] dimensions)
SDVariable clipByNorm(SDVariable x, double clipValue, int[] dimensions)
SDVariable clipByNorm(String name, SDVariable 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
- x (NUMERIC) - Input variable
- 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))
INDArray clipByValue(INDArray x, double clipValueMin, double clipValueMax)
SDVariable clipByValue(SDVariable x, double clipValueMin, double clipValueMax)
SDVariable clipByValue(String name, SDVariable 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
- x (NUMERIC) - Input variable
- clipValueMin - Minimum value for clipping
- clipValueMax - Maximum value for clipping
INDArray confusionMatrix(INDArray labels, INDArray pred, DataType dataType)
SDVariable confusionMatrix(SDVariable labels, SDVariable pred, DataType dataType)
SDVariable confusionMatrix(String name, SDVariable labels, SDVariable 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]
- labels (NUMERIC) - Labels - 1D array of integer values representing label values
- pred (NUMERIC) - Predictions - 1D array of integer values representing predictions. Same length as labels
- dataType - Data type
INDArray confusionMatrix(INDArray labels, INDArray pred, int numClasses)
SDVariable confusionMatrix(SDVariable labels, SDVariable pred, int numClasses)
SDVariable confusionMatrix(String name, SDVariable labels, SDVariable 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]
- labels (NUMERIC) - Labels - 1D array of integer values representing label values
- pred (NUMERIC) - Predictions - 1D array of integer values representing predictions. Same length as labels
- numClasses - Number of classes
INDArray confusionMatrix(INDArray labels, INDArray pred, INDArray weights)
SDVariable confusionMatrix(SDVariable labels, SDVariable pred, SDVariable weights)
SDVariable confusionMatrix(String name, SDVariable labels, SDVariable pred, SDVariable 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]
- labels (NUMERIC) - Labels - 1D array of integer values representing label values
- pred (NUMERIC) - Predictions - 1D array of integer values representing predictions. Same length as labels
- weights (NUMERIC) - 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
INDArray confusionMatrix(INDArray labels, INDArray pred, INDArray weights, int numClasses)
SDVariable confusionMatrix(SDVariable labels, SDVariable pred, SDVariable weights, int numClasses)
SDVariable confusionMatrix(String name, SDVariable labels, SDVariable pred, SDVariable 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]
- labels (NUMERIC) - Labels - 1D array of integer values representing label values
- pred (NUMERIC) - Predictions - 1D array of integer values representing predictions. Same length as labels
- weights (NUMERIC) - 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
- numClasses -
INDArray cos(INDArray x)
SDVariable cos(SDVariable x)
SDVariable cos(String name, SDVariable x)
Elementwise cosine operation: out = cos(x)
- x (NUMERIC) - Input variable
INDArray cosh(INDArray x)
SDVariable cosh(SDVariable x)
SDVariable cosh(String name, SDVariable x)
Elementwise cosh (hyperbolic cosine) operation: out = cosh(x)
- x (NUMERIC) - Input variable
INDArray cosineDistance(INDArray x, INDArray y, int[] dimensions)
SDVariable cosineDistance(SDVariable x, SDVariable y, int[] dimensions)
SDVariable cosineDistance(String name, SDVariable x, SDVariable 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)
- x (NUMERIC) - Input variable x
- y (NUMERIC) - Input variable y
- dimensions - Dimensions to calculate cosineDistance over (Size: AtLeast(min=0))
INDArray cosineSimilarity(INDArray x, INDArray y, int[] dimensions)
SDVariable cosineSimilarity(SDVariable x, SDVariable y, int[] dimensions)
SDVariable cosineSimilarity(String name, SDVariable x, SDVariable 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)
- x (NUMERIC) - Input variable x
- y (NUMERIC) - Input variable y
- dimensions - Dimensions to calculate cosineSimilarity over (Size: AtLeast(min=0))
INDArray countNonZero(INDArray in, int[] dimensions)
SDVariable countNonZero(SDVariable in, int[] dimensions)
SDVariable countNonZero(String name, SDVariable in, int[] dimensions)
Count non zero array reduction operation, optionally along specified dimensions: out = count(x != 0)
- in (NUMERIC) - Input variable
- dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
INDArray countZero(INDArray in, int[] dimensions)
SDVariable countZero(SDVariable in, int[] dimensions)
SDVariable countZero(String name, SDVariable in, int[] dimensions)
Count zero array reduction operation, optionally along specified dimensions: out = count(x == 0)
- in (NUMERIC) - Input variable
- dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
INDArray cross(INDArray a, INDArray b)
SDVariable cross(SDVariable a, SDVariable b)
SDVariable cross(String name, SDVariable a, SDVariable 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
- a (NUMERIC) - First input
- b (NUMERIC) - Second input
INDArray cube(INDArray x)
SDVariable cube(SDVariable x)
SDVariable cube(String name, SDVariable x)
Element-wise cube function: out = x^3
- x (NUMERIC) - Input variable
INDArray diag(INDArray x)
SDVariable diag(SDVariable x)
SDVariable diag(String name, SDVariable 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
- x (NUMERIC) - Input variable
INDArray diagPart(INDArray x)
SDVariable diagPart(SDVariable x)
SDVariable diagPart(String name, SDVariable 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]
- x (NUMERIC) - Input variable
INDArray div(INDArray x, INDArray y)
SDVariable div(SDVariable x, SDVariable y)
SDVariable div(String name, SDVariable x, SDVariable 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
- x (NUMERIC) - Input variable
- y (NUMERIC) - Input variable
INDArray div(INDArray x, double value)
SDVariable div(SDVariable x, double value)
SDVariable div(String name, SDVariable x, double value)
Scalar division operation, out = in / scalar
- x (NUMERIC) - Input variable
- value - Scalar value for op
INDArray entropy(INDArray in, int[] dimensions)
SDVariable entropy(SDVariable in, int[] dimensions)
SDVariable entropy(String name, SDVariable in, int[] dimensions)
Entropy reduction: -sum(x * log(x))
- in (NUMERIC) - Input variable
- dimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))
INDArray erf(INDArray x)
SDVariable erf(SDVariable x)
SDVariable erf(String name, SDVariable x)
Element-wise Gaussian error function - out = erf(in)
- x (NUMERIC) - Input variable
INDArray erfc(INDArray x)
SDVariable erfc(SDVariable x)
SDVariable erfc(String name, SDVariable x)
Element-wise complementary Gaussian error function - out = erfc(in) = 1 - erf(in)
- x (NUMERIC) - Input variable
INDArray euclideanDistance(INDArray x, INDArray y, int[] dimensions)
SDVariable euclideanDistance(SDVariable x, SDVariable y, int[] dimensions)
SDVariable euclideanDistance(String name, SDVariable x, SDVariable 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 )
- x (NUMERIC) - Input variable x
- y (NUMERIC) - Input variable y
- dimensions - Dimensions to calculate euclideanDistance over (Size: AtLeast(min=0))
INDArray exp(INDArray x)
SDVariable exp(SDVariable x)
SDVariable exp(String name, SDVariable x)
Elementwise exponent function: out = exp(x) = 2.71828...^x
- x (NUMERIC) - Input variable
INDArray expm1(INDArray x)
SDVariable expm1(SDVariable x)
SDVariable expm1(String name, SDVariable x)
Elementwise 1.0 - exponent function: out = 1.0 - exp(x) = 1.0 - 2.71828...^x
- x (NUMERIC) - Input variable
INDArray eye(int rows)
SDVariable eye(int rows)
SDVariable eye(String name, int rows)
Generate an identity matrix with the specified number of rows and columns.
- rows - Number of rows
INDArray eye(int rows, int cols)
SDVariable eye(int rows, int cols)
SDVariable eye(String name, int rows, int cols)
As per eye(String, int, int, DataType) but with the default datatype, Eye.DEFAULT_DTYPE
- rows - Number of rows
- cols - Number of columns
INDArray eye(int rows, int cols, DataType dataType, int[] dimensions)
SDVariable eye(int rows, int cols, DataType dataType, int[] dimensions)
SDVariable eye(String name, 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)
eye:
[ 1, 0]
[ 0, 1]
[ 0, 0]`
- rows - Number of rows
- cols - Number of columns
- dataType - Data type
- dimensions - (Size: AtLeast(min=0))
INDArray eye(INDArray rows, INDArray cols)
SDVariable eye(SDVariable rows, SDVariable cols)
SDVariable eye(String name, SDVariable rows, SDVariable cols)
As per eye(int, int) bit with the number of rows/columns specified as scalar INDArrays
- rows (INT) - Number of rows