These ops are generally available directly on `SameDiff`

instances. Due to an oversight before the release, this ops aren't also available on `Nd4j`

. To use the `INDArray`

variants of these operations, you will have to instantiate a `NDBase`

instance.

INDArray all(INDArray x, int[] dimensions)SDVariable all(SDVariable x, int[] dimensions)SDVariable all(String name, SDVariable x, int[] dimensions)

Boolean and array reduction operation, optionally along specified dimensions

**x**(NDARRAY) - Input variable**dimensions**- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))

INDArray any(INDArray x, int[] dimensions)SDVariable any(SDVariable x, int[] dimensions)SDVariable any(String name, SDVariable x, int[] dimensions)

Boolean or array reduction operation, optionally along specified dimensions

**x**(NDARRAY) - Input variable**dimensions**- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))

INDArray argmax(INDArray in, boolean keepDims, int[] dimensions)INDArray argmax(INDArray in, int[] dimensions)SDVariable argmax(SDVariable in, boolean keepDims, int[] dimensions)SDVariable argmax(SDVariable in, int[] dimensions)SDVariable argmax(String name, SDVariable in, boolean keepDims, int[] dimensions)SDVariable argmax(String name, SDVariable in, int[] dimensions)

Argmax array reduction operation, optionally along specified dimensions.

Output values are the index of the maximum value of each slice along the specified dimension.

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]

**in**(NUMERIC) - Input variable**keepDims**- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions - default = false**dimensions**- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))

INDArray argmin(INDArray in, boolean keepDims, int[] dimensions)INDArray argmin(INDArray in, int[] dimensions)SDVariable argmin(SDVariable in, boolean keepDims, int[] dimensions)SDVariable argmin(SDVariable in, int[] dimensions)SDVariable argmin(String name, SDVariable in, boolean keepDims, int[] dimensions)SDVariable argmin(String name, SDVariable in, int[] dimensions)

Argmin array reduction operation, optionally along specified dimensions.

Output values are the index of the minimum value of each slice along the specified dimension.

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]

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

**in**(NUMERIC) - Input variable**keepDims**- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions - default = false**dimensions**- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))

INDArray batchMmul(INDArray inputsA, INDArray inputsB, boolean transposeA, boolean transposeB)INDArray batchMmul(INDArray inputsA, INDArray inputsB)SDVariable batchMmul(SDVariable inputsA, SDVariable inputsB, boolean transposeA, boolean transposeB)SDVariable batchMmul(SDVariable inputsA, SDVariable inputsB)SDVariable batchMmul(String name, SDVariable inputsA, SDVariable inputsB, boolean transposeA, boolean transposeB)SDVariable batchMmul(String name, SDVariable inputsA, SDVariable inputsB)

Matrix multiply a batch of matrices. matricesA and matricesB have to be arrays of same

length and each pair taken from these sets has to have dimensions (M, N) and (N, K),

respectively. If transposeA is true, matrices from matricesA will have shape (N, M) instead.

Likewise, if transposeB is true, matrices from matricesB will have shape (K, N).

The result of this operation will be a batch of multiplied matrices. The

result has the same length as both input batches and each output matrix is of shape (M, K).

**inputsA**(NUMERIC) - First array of input matrices, all of shape (M, N) or (N, M)**inputsB**(NUMERIC) - Second array of input matrices, all of shape (N, K) or (K, N)**transposeA**- Whether to transpose A arrays or not - default = false**transposeB**- Whether to transpose B arrays or not - default = false

INDArray castTo(INDArray arg, DataType datatype)SDVariable castTo(SDVariable arg, DataType datatype)SDVariable castTo(String name, SDVariable arg, DataType datatype)

Cast the array to a new datatype - for example, Integer -> Float

**arg**(NDARRAY) - Input variable to cast**datatype**- Datatype to cast to

INDArray concat(INDArray inputs, int dimension)SDVariable concat(SDVariable inputs, int dimension)SDVariable concat(String name, SDVariable inputs, int dimension)

Concatenate a set of inputs along the specified dimension.

Note that inputs must have identical rank and identical dimensions, other than the dimension to stack on.

For example, if 2 inputs have shape [a, x, c] and [a, y, c] and dimension = 1, then the output has shape [a, x+y, c]

**inputs**(NUMERIC) - Input variables**dimension**- Dimension to concatenate on

INDArray cumprod(INDArray in, boolean exclusive, boolean reverse, int[] axis)INDArray cumprod(INDArray in, int[] axis)SDVariable cumprod(SDVariable in, boolean exclusive, boolean reverse, int[] axis)SDVariable cumprod(SDVariable in, int[] axis)SDVariable cumprod(String name, SDVariable in, boolean exclusive, boolean reverse, int[] axis)SDVariable cumprod(String name, SDVariable in, int[] axis)

Cumulative product operation.

For input: [ a, b, c], output is:

exclusive=false, reverse=false: [a, a*b, a*b*c]

exclusive=true, reverse=false, [0, a, a*b]

exclusive=false, reverse=true: [a*b*c, b*c, c]

exclusive=true, reverse=true: [b*c, c, 0]

**in**(NUMERIC) - Input variable**exclusive**- If true: exclude the first value - default = false**reverse**- If true: reverse the direction of the accumulation - default = false**axis**- Scalar axis argument for dimension to perform cumululative sum operations along (Size: AtLeast(min=1))

INDArray cumsum(INDArray in, boolean exclusive, boolean reverse, int[] axis)INDArray cumsum(INDArray in, int[] axis)SDVariable cumsum(SDVariable in, boolean exclusive, boolean reverse, int[] axis)SDVariable cumsum(SDVariable in, int[] axis)SDVariable cumsum(String name, SDVariable in, boolean exclusive, boolean reverse, int[] axis)SDVariable cumsum(String name, SDVariable in, int[] axis)

Cumulative sum operation.

For input: [ a, b, c], output is:

exclusive=false, reverse=false: [a, a+b, a+b+c]

exclusive=true, reverse=false, [0, a, a+b]

exclusive=false, reverse=true: [a+b+c, b+c, c]

exclusive=true, reverse=true: [b+c, c, 0]

**in**(NUMERIC) - Input variable**exclusive**- If true: exclude the first value - default = false**reverse**- If true: reverse the direction of the accumulation - default = false**axis**- Scalar axis argument for dimension to perform cumululative sum operations along (Size: AtLeast(min=1))

INDArray dot(INDArray x, INDArray y, int[] dimensions)SDVariable dot(SDVariable x, SDVariable y, int[] dimensions)SDVariable dot(String name, SDVariable x, SDVariable y, int[] dimensions)

Pairwise dot product reduction along dimension

output = sum(i=0 ... size(dim)-1) x[i] * y[i]

**x**(NUMERIC) - first input**y**(NUMERIC) - second input**dimensions**- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))

INDArray dynamicPartition(INDArray x, INDArray partitions, int numPartitions)SDVariable dynamicPartition(SDVariable x, SDVariable partitions, int numPartitions)SDVariable dynamicPartition(String name, SDVariable x, SDVariable partitions, int numPartitions)

Dynamically partition the input variable values into the specified number of paritions, using the indices.

Example:

input = [1,2,3,4,5]numPartitions = 2partitions = [1,0,0,1,0]out[0] = [2,3,5]out[1] = [1,4] `

**x**(NUMERIC) - Input variable**partitions**(INT) - 1D input with values 0 to numPartitions-1**numPartitions**- Number of partitions, >= 1

INDArray dynamicStitch(INDArray indices, INDArray x)SDVariable dynamicStitch(SDVariable indices, SDVariable x)SDVariable dynamicStitch(String name, SDVariable indices, SDVariable x)

Dynamically merge the specified input arrays into a single array, using the specified indices

**indices**(INT) - Indices to use when merging. Must be >= 1, same length as input variables**x**(NUMERIC) - Input variables.

INDArray eq(INDArray x, double y)SDVariable eq(SDVariable x, double y)SDVariable eq(String name, SDVariable x, double y)

Equals operation: elementwise x == y

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input array**y**- Double value argument to use in operation

INDArray eq(INDArray x, INDArray y)SDVariable eq(SDVariable x, SDVariable y)SDVariable eq(String name, SDVariable x, SDVariable y)

Equal to operation: elementwise x == y

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.

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

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input 1**y**(NUMERIC) - Input 2

INDArray expandDims(INDArray x, int axis)SDVariable expandDims(SDVariable x, int axis)SDVariable expandDims(String name, SDVariable x, int axis)

Reshape the input by adding a 1 at the specified location.

For example, if input has shape [a, b], then output shape is:

axis = 0: [1, a, b]

axis = 1: [a, 1, b]

axis = 2: [a, b, 1]

**x**(NDARRAY) - Input variable**axis**- Axis to expand

INDArray fill(INDArray shape, DataType dataType, double value)SDVariable fill(SDVariable shape, DataType dataType, double value)SDVariable fill(String name, SDVariable shape, DataType dataType, double value)

Generate an output variable with the specified (dynamic) shape with all elements set to the specified value

**shape**(INT) - Shape: must be a 1D array/variable**dataType**- Datatype of the output array**value**- Value to set all elements to

INDArray gather(INDArray df, int[] indices, int axis)SDVariable gather(SDVariable df, int[] indices, int axis)SDVariable gather(String name, SDVariable df, int[] indices, int axis)

Gather slices from the input variable where the indices are specified as fixed int[] values.

Output shape is same as input shape, except for axis dimension, which has size equal to indices.length.

**df**(NUMERIC) - Input variable**indices**- Indices to get (Size: AtLeast(min=1))**axis**- Axis that the indices refer to

INDArray gather(INDArray df, INDArray indices, int axis)SDVariable gather(SDVariable df, SDVariable indices, int axis)SDVariable gather(String name, SDVariable df, SDVariable indices, int axis)

Gather slices from the input variable where the indices are specified as dynamic array values.

Output shape is same as input shape, except for axis dimension, which has size equal to indices.length.

**df**(NUMERIC) - Input variable**indices**(INT) - Indices to get slices for. Rank 0 or 1 input**axis**- Axis that the indices refer to

INDArray gatherNd(INDArray df, INDArray indices)SDVariable gatherNd(SDVariable df, SDVariable indices)SDVariable gatherNd(String name, SDVariable df, SDVariable indices)

Gather slices from df with shape specified by indices.

**df**(NUMERIC) -**indices**(NUMERIC) -

INDArray gt(INDArray x, double y)SDVariable gt(SDVariable x, double y)SDVariable gt(String name, SDVariable x, double y)

Greater than operation: elementwise x > y

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input array**y**- Double value argument to use in operation

INDArray gt(INDArray x, INDArray y)SDVariable gt(SDVariable x, SDVariable y)SDVariable gt(String name, SDVariable x, SDVariable y)

Greater than operation: elementwise x > y

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.

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

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input 1**y**(NUMERIC) - Input 2

INDArray gte(INDArray x, double y)SDVariable gte(SDVariable x, double y)SDVariable gte(String name, SDVariable x, double y)

Greater than or equals operation: elementwise x >= y

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input array**y**- Double value argument to use in operation

INDArray gte(INDArray x, INDArray y)SDVariable gte(SDVariable x, SDVariable y)SDVariable gte(String name, SDVariable x, SDVariable y)

Greater than or equal to operation: elementwise x >= y

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.

For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input 1**y**(NUMERIC) - Input 2

INDArray identity(INDArray input)SDVariable identity(SDVariable input)SDVariable identity(String name, SDVariable input)

Elementwise identity operation: out = x

**input**(NUMERIC) - Input variable

INDArray invertPermutation(INDArray input)SDVariable invertPermutation(SDVariable input)SDVariable invertPermutation(String name, SDVariable input)

Compute the inverse permutation indices for a permutation operation

Example: if input is [2, 0, 1] then output is [1, 2, 0]

The idea is that x.permute(input).permute(invertPermutation(input)) == x

**input**(INT) - 1D indices for permutation

INDArray isNumericTensor(INDArray x)SDVariable isNumericTensor(SDVariable x)SDVariable isNumericTensor(String name, SDVariable x)

Is the director a numeric tensor? In the current version of ND4J/SameDiff, this always returns true/1

**x**(NUMERIC) - Input variable

INDArray linspace(DataType dataType, double start, double stop, long number)SDVariable linspace(DataType dataType, double start, double stop, long number)SDVariable linspace(String name, DataType dataType, double start, double stop, long number)

Create a new 1d array with values evenly spaced between values 'start' and 'stop'

For example, linspace(start=3.0, stop=4.0, number=3) will generate [3.0, 3.5, 4.0]

**dataType**- Data type of the output array**start**- Start value**stop**- Stop value**number**- Number of values to generate

INDArray linspace(INDArray start, INDArray stop, INDArray number, DataType dataType)SDVariable linspace(SDVariable start, SDVariable stop, SDVariable number, DataType dataType)SDVariable linspace(String name, SDVariable start, SDVariable stop, SDVariable number, DataType dataType)

Create a new 1d array with values evenly spaced between values 'start' and 'stop'

For example, linspace(start=3.0, stop=4.0, number=3) will generate [3.0, 3.5, 4.0]

**start**(NUMERIC) - Start value**stop**(NUMERIC) - Stop value**number**(LONG) - Number of values to generate**dataType**- Data type of the output array

INDArray lt(INDArray x, double y)SDVariable lt(SDVariable x, double y)SDVariable lt(String name, SDVariable x, double y)

Less than operation: elementwise x < y

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input array**y**- Double value argument to use in operation

INDArray lt(INDArray x, INDArray y)SDVariable lt(SDVariable x, SDVariable y)SDVariable lt(String name, SDVariable x, SDVariable y)

Less than operation: elementwise x < y

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.

For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input 1**y**(NUMERIC) - Input 2

INDArray lte(INDArray x, double y)SDVariable lte(SDVariable x, double y)SDVariable lte(String name, SDVariable x, double y)

Less than or equals operation: elementwise x <= y

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input array**y**- Double value argument to use in operation

INDArray lte(INDArray x, INDArray y)SDVariable lte(SDVariable x, SDVariable y)SDVariable lte(String name, SDVariable x, SDVariable y)

Less than or equal to operation: elementwise x <= y

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.

For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input 1**y**(NUMERIC) - Input 2

INDArray matchCondition(INDArray in, Condition condition)SDVariable matchCondition(SDVariable in, Condition condition)SDVariable matchCondition(String name, SDVariable in, Condition condition)

Returns a boolean mask of equal shape to the input, where the condition is satisfied - value 1 where satisfied, 0 otherwise

**in**(NUMERIC) - Input**condition**- Condition

INDArray matchConditionCount(INDArray in, Condition condition)SDVariable matchConditionCount(SDVariable in, Condition condition)SDVariable matchConditionCount(String name, SDVariable in, Condition condition)

Returns a count of the number of elements that satisfy the condition

**in**(NUMERIC) - Input**condition**- Condition

INDArray matchConditionCount(INDArray in, Condition condition, boolean keepDim, int[] dimensions)INDArray matchConditionCount(INDArray in, Condition condition, int[] dimensions)SDVariable matchConditionCount(SDVariable in, Condition condition, boolean keepDim, int[] dimensions)SDVariable matchConditionCount(SDVariable in, Condition condition, int[] dimensions)SDVariable matchConditionCount(String name, SDVariable in, Condition condition, boolean keepDim, int[] dimensions)SDVariable matchConditionCount(String name, SDVariable in, Condition condition, int[] dimensions)

Returns a count of the number of elements that satisfy the 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]

**in**(NUMERIC) - Input variable**condition**- Condition**keepDim**- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions - default = false**dimensions**- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))

INDArray max(INDArray x, boolean keepDims, int[] dimensions)INDArray max(INDArray x, int[] dimensions)SDVariable max(SDVariable x, boolean keepDims, int[] dimensions)SDVariable max(SDVariable x, int[] dimensions)SDVariable max(String name, SDVariable x, boolean keepDims, int[] dimensions)SDVariable max(String name, SDVariable x, int[] dimensions)

Max array reduction operation, optionally along specified dimensions

Note that if keepDims = true, the output variable has the same rank as the input variable,

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]

**x**(NUMERIC) - Input variable**keepDims**- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions - default = false**dimensions**- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))

INDArray max(INDArray first, INDArray second)SDVariable max(SDVariable first, SDVariable second)SDVariable max(String name, SDVariable first, SDVariable second)

Element-wise maximum operation: out[i] = max(first[i], second[i])

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]

**first**(NUMERIC) - First input array**second**(NUMERIC) - Second input array

INDArray mean(INDArray x, boolean keepDims, int[] dimensions)INDArray mean(INDArray x, int[] dimensions)SDVariable mean(SDVariable x, boolean keepDims, int[] dimensions)SDVariable mean(SDVariable x, int[] dimensions)SDVariable mean(String name, SDVariable x, boolean keepDims, int[] dimensions)SDVariable mean(String name, SDVariable x, int[] dimensions)

Mean (average) array reduction operation, optionally along specified dimensions

Note that if keepDims = true, the output variable has the same rank as the input variable,

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]

**x**(NUMERIC) - Input variable**keepDims**- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions - default = false**dimensions**- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))

INDArray merge(INDArray x, INDArray y)SDVariable merge(SDVariable x, SDVariable y)SDVariable merge(String name, SDVariable x, SDVariable y)

The merge operation is a control operation that forwards the either of the inputs to the output, when

the first of them becomes available. If both are available, the output is undefined (either input could

be forwarded to the output)

**x**(NUMERIC) - Input variable**y**(NUMERIC) - Input variable

INDArray min(INDArray x, boolean keepDims, int[] dimensions)INDArray min(INDArray x, int[] dimensions)SDVariable min(SDVariable x, boolean keepDims, int[] dimensions)SDVariable min(SDVariable x, int[] dimensions)SDVariable min(String name, SDVariable x, boolean keepDims, int[] dimensions)SDVariable min(String name, SDVariable x, int[] dimensions)

Minimum array reduction operation, optionally along specified dimensions. out = min(in)

Note that if keepDims = true, the output variable has the same rank as the input variable,

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]

**x**(NUMERIC) - Input variable**keepDims**- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions - default = false**dimensions**- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))

INDArray min(INDArray first, INDArray second)SDVariable min(SDVariable first, SDVariable second)SDVariable min(String name, SDVariable first, SDVariable second)

Element-wise minimum operation: out[i] = min(first[i], second[i])

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]

**first**(NUMERIC) - First input array**second**(NUMERIC) - Second input array

INDArray mmul(INDArray x, INDArray y, boolean transposeX, boolean transposeY, boolean transposeZ)INDArray mmul(INDArray x, INDArray y)SDVariable mmul(SDVariable x, SDVariable y, boolean transposeX, boolean transposeY, boolean transposeZ)SDVariable mmul(SDVariable x, SDVariable y)SDVariable mmul(String name, SDVariable x, SDVariable y, boolean transposeX, boolean transposeY, boolean transposeZ)SDVariable mmul(String name, SDVariable x, SDVariable y)

Matrix multiplication: out = mmul(x,y)

Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.

**x**(NUMERIC) - First input variable**y**(NUMERIC) - Second input variable**transposeX**- Transpose x (first argument) - default = false**transposeY**- Transpose y (second argument) - default = false**transposeZ**- Transpose result array - default = false

INDArray neq(INDArray x, double y)SDVariable neq(SDVariable x, double y)SDVariable neq(String name, SDVariable x, double y)

Not equals operation: elementwise x != y

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input array**y**- Double value argument to use in operation

INDArray neq(INDArray x, INDArray y)SDVariable neq(SDVariable x, SDVariable y)SDVariable neq(String name, SDVariable x, SDVariable y)

Not equal to operation: elementwise x != y

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.

For example, if X has shape [1,10] and Y has shape [5,10] then op(X,Y) has output shape [5,10]

Return boolean array with values true where satisfied, or false otherwise.

**x**(NUMERIC) - Input 1**y**(NUMERIC) - Input 2

INDArray norm1(INDArray x, boolean keepDims, int[] dimensions)INDArray norm1(INDArray x, int[] dimensions)SDVariable norm1(SDVariable x, boolean keepDims, int[] dimensions)SDVariable norm1(SDVariable x, int[] dimensions)SDVariable norm1(String name, SDVariable x, boolean keepDims, int[] dimensions)SDVariable norm1(String name, SDVariable x, int[] dimensions)

Norm1 (L1 norm) reduction operation: The output contains the L1 norm for each tensor/subset along the specified dimensions:

out = sum_i abs(x[i])

Note that if keepDims = true, the output variable has the same rank as the input variable,

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]

**x**(NUMERIC) - Input variable**keepDims**- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions - default = false**dimensions**- dimensions to reduce over (Size: AtLeast(min=0))

INDArray norm2(INDArray x, boolean keepDims, int[] dimensions)INDArray norm2(INDArray x, int[] dimensions)SDVariable norm2(SDVariable x, boolean keepDims, int[] dimensions)SDVariable norm2(SDVariable x, int[] dimensions)SDVariable norm2(String name, SDVariable x, boolean keepDims, int[] dimensions)SDVariable norm2(String name, SDVariable x, int[] dimensions)

Norm2 (L2 norm) reduction operation: The output contains the L2 norm for each tensor/subset along the specified dimensions:

out = sqrt(sum_i x[i]^2)

Note that if keepDims = true, the output variable has the same rank as the input variable,

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]

**x**(NUMERIC) - Input variable**keepDims**- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions - default = false**dimensions**- dimensions dimensions to reduce over (Size: AtLeast(min=0))

INDArray normmax(INDArray x, boolean keepDims, int[] dimensions)INDArray normmax(INDArray x, int[] dimensions)SDVariable normmax(SDVariable x, boolean keepDims, int[] dimensions)SDVariable normmax(SDVariable x, int[] dimensions)SDVariable normmax(String name, SDVariable x, boolean keepDims, int[] dimensions)SDVariable normmax(String name, SDVariable x, int[] dimensions)

Max norm (infinity norm) reduction operation: The output contains the max norm for each tensor/subset along the

specified dimensions:

out = max(abs(x[i]))

Note that if keepDims = true, the output variable has the same rank as the input variable,

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]

**x**(NUMERIC) - Input variable**keepDims**- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions - default = false**dimensions**- dimensions to reduce over (Size: AtLeast(min=0))

INDArray oneHot(INDArray indices, int depth, int axis, double on, double off, DataType dataType)INDArray oneHot(INDArray indices, int depth, int axis, double on, double off)SDVariable oneHot(SDVariable indices, int depth, int axis, double on, double off, DataType dataType)SDVariable oneHot(SDVariable indices, int depth, int axis, double on, double off)SDVariable oneHot(String name, SDVariable indices, int depth, int axis, double on, double off, DataType dataType)SDVariable oneHot(String name, SDVariable indices, int depth, int axis, double on, double off)

Convert the array to a one-hot array with walues and for each entry

If input has shape [ a, ..., n] then output has shape [ a, ..., n, depth],

with {out[i, ..., j, in[i,...,j]] with other values being set to

**indices**(NUMERIC) - Indices - value 0 to depth-1**depth**- Number of classes**axis**-**on**-**off**-**dataType**- Output data type - default = DataType.FLOAT

INDArray oneHot(INDArray indices, int depth)SDVariable oneHot(SDVariable indices, int depth)SDVariable oneHot(String name, SDVariable indices, int depth)

Convert the array to a one-hot array with walues 0 and 1 for each entry

If input has shape [ a, ..., n] then output has shape [ a, ..., n, depth],

with out[i, ..., j, in[i,...,j]] = 1 with other values being set to 0

see oneHot(SDVariable, int, int, double, double)

**indices**(NUMERIC) - Indices - value 0 to depth-1**depth**- Number of classes

INDArray onesLike(INDArray input)SDVariable onesLike(SDVariable input)SDVariable onesLike(String name, SDVariable input)

Return a variable of all 1s, with the same shape as the input variable. Note that this is dynamic:

if the input shape changes in later execution, the returned variable's shape will also be updated

**input**(NUMERIC) - Input INDArray

INDArray onesLike(INDArray input, DataType dataType)SDVariable onesLike(SDVariable input, DataType dataType)SDVariable onesLike(String name, SDVariable input, DataType dataType)

As per onesLike(String, SDVariable) but the output datatype may be specified

**input**(NUMERIC) -**dataType**-

INDArray permute(INDArray x, INDArray dimensions)SDVariable permute(SDVariable x, SDVariable dimensions)SDVariable permute(String name, SDVariable x, SDVariable dimensions)

Array permutation operation: permute the dimensions according to the specified permutation indices.

Example: if input has shape [a,b,c] and dimensions = [2,0,1] the output has shape [c,a,b]

**x**(NUMERIC) - Input variable**dimensions**(INT) - Permute dimensions

INDArray permute(INDArray x, int[] dimensions)SDVariable permute(SDVariable x, int[] dimensions)SDVariable permute(String name, SDVariable x, int[] dimensions)

Array permutation operation: permute the dimensions according to the specified permutation indices.

Example: if input has shape [a,b,c] and dimensions = [2,0,1] the output has shape [c,a,b]

**x**(NUMERIC) - Input variable**dimensions**- (Size: AtLeast(min=0))

INDArray prod(INDArray x, boolean keepDims, int[] dimensions)INDArray prod(INDArray x, int[] dimensions)SDVariable prod(SDVariable x, boolean keepDims, int[] dimensions)SDVariable prod(SDVariable x, int[] dimensions)SDVariable prod(String name, SDVariable x, boolean keepDims, int[] dimensions)SDVariable prod(String name, SDVariable x, int[] dimensions)

Product array reduction operation, optionally along specified dimensions

Note that if keepDims = true, the output variable has the same rank as the input variable,

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]

**x**(NUMERIC) - Input variable**keepDims**- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions - default = false**dimensions**- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))

INDArray range(double from, double to, double step, DataType dataType)SDVariable range(double from, double to, double step, DataType dataType)SDVariable range(String name, double from, double to, double step, DataType dataType)

Create a new variable with a 1d array, where the values start at from and increment by step

up to (but not including) limit.

For example, range(1.0, 3.0, 0.5) will return [1.0, 1.5, 2.0, 2.5]

**from**- Initial/smallest value**to**- Largest value (exclusive)**step**- Step size**dataType**-

INDArray range(INDArray from, INDArray to, INDArray step, DataType dataType)SDVariable range(SDVariable from, SDVariable to, SDVariable step, DataType dataType)SDVariable range(String name, SDVariable from, SDVariable to, SDVariable step, DataType dataType)

Create a new variable with a 1d array, where the values start at from and increment by step

up to (but not including) limit.

For example, range(1.0, 3.0, 0.5) will return [1.0, 1.5, 2.0, 2.5]

**from**(NUMERIC) - Initial/smallest value**to**(NUMERIC) - Largest value (exclusive)**step**(NUMERIC) - Step size**dataType**-

INDArray rank(INDArray in)SDVariable rank(SDVariable in)SDVariable rank(String name, SDVariable in)

Returns the rank (number of dimensions, i.e., length(shape)) of the specified INDArray as a 0D scalar variable

**in**(NUMERIC) - Input variable

INDArray replaceWhere(INDArray update, INDArray from, Condition condition)SDVariable replaceWhere(SDVariable update, SDVariable from, Condition condition)SDVariable replaceWhere(String name, SDVariable update, SDVariable from, Condition condition)

Element-wise replace where condition:

out[i] = from[i] if condition(update[i]) is satisfied, or

out[i] = update[i] if condition(update[i]) is NOT satisfied

**update**(NUMERIC) - Source array**from**(NUMERIC) - Replacement values array (used conditionally). Must be same shape as 'update' array**condition**- Condition to check on update array elements

INDArray replaceWhere(INDArray update, double value, Condition condition)SDVariable replaceWhere(SDVariable update, double value, Condition condition)SDVariable replaceWhere(String name, SDVariable update, double value, Condition condition)

Element-wise replace where condition:

out[i] = value if condition(update[i]) is satisfied, or

out[i] = update[i] if condition(update[i]) is NOT satisfied

**update**(NUMERIC) - Source array**value**- Value to set at the output, if the condition is satisfied**condition**- Condition to check on update array elements

INDArray reshape(INDArray x, INDArray shape)SDVariable reshape(SDVariable x, SDVariable shape)SDVariable reshape(String name, SDVariable x, SDVariable shape)

Reshape the input variable to the specified (fixed) shape. The output variable will have the same values as the

input, but with the specified shape.

Note that prod(shape) must match length(input) == prod(input.shape)

**x**(NUMERIC) - Input variable**shape**(NUMERIC) - New shape for variable

INDArray reshape(INDArray x, long[] shape)SDVariable reshape(SDVariable x, long[] shape)SDVariable reshape(String name, SDVariable x, long[] shape)

Reshape the input variable to the specified (fixed) shape. The output variable will have the same values as the

input, but with the specified shape.

Note that prod(shape) must match length(input) == prod(input.shape)

**x**(NUMERIC) - Input variable**shape**- New shape for variable (Size: AtLeast(min=0))

INDArray reverse(INDArray x, int[] dimensions)SDVariable reverse(SDVariable x, int[] dimensions)SDVariable reverse(String name, SDVariable x, int[] dimensions)

Reverse the values of an array for the specified dimensions

If input is:

[ 1, 2, 3]

[ 4, 5, 6]

then

reverse(in, 0):

[3, 2, 1]

[6, 5, 4]

reverse(in, 1):

[4, 5, 6]

[1, 2 3]

**x**(NUMERIC) - Input variable**dimensions**- Input variable (Size: AtLeast(min=0))

INDArray reverseSequence(INDArray x, INDArray seq_lengths, int seqDim, int batchDim)INDArray reverseSequence(INDArray x, INDArray seq_lengths)SDVariable reverseSequence(SDVariable x, SDVariable seq_lengths, int seqDim, int batchDim)SDVariable reverseSequence(SDVariable x, SDVariable seq_lengths)SDVariable reverseSequence(String name, SDVariable x, SDVariable seq_lengths, int seqDim, int batchDim)SDVariable reverseSequence(String name, SDVariable x, SDVariable seq_lengths)

Reverse sequence op: for each slice along dimension seqDimension, the first seqLength values are reversed

**x**(NUMERIC) - Input variable**seq_lengths**(INT) - Length of the sequences**seqDim**- Sequence dimension - default = -1**batchDim**- Batch dimension - default = 0

INDArray scalarFloorMod(INDArray in, double value)SDVariable scalarFloorMod(SDVariable in, double value)SDVariable scalarFloorMod(String name, SDVariable in, double value)

Element-wise scalar floor modulus operation: out = floorMod(in, value).

i.e., returns the remainder after division by 'value'

**in**(NUMERIC) - Input variable**value**- Scalar value to compare

INDArray scalarMax(INDArray in, double value)SDVariable scalarMax(SDVariable in, double value)SDVariable scalarMax(String name, SDVariable in, double value)

Element-wise scalar maximum operation: out = max(in, value)

**in**(NUMERIC) - Input variable**value**- Scalar value to compare

INDArray scalarMin(INDArray in, double value)SDVariable scalarMin(SDVariable in, double value)SDVariable scalarMin(String name, SDVariable in, double value)

Element-wise scalar minimum operation: out = min(in, value)

**in**(NUMERIC) - Input variable**value**- Scalar value to compare

INDArray scalarSet(INDArray in, double set)SDVariable scalarSet(SDVariable in, double set)SDVariable scalarSet(String name, SDVariable in, double set)

Return a variable with equal shape to the input, but all elements set to value 'set'

**in**(NUMERIC) - Input variable**set**- Value to set

INDArray scatterAdd(INDArray ref, INDArray indices, INDArray updates)SDVariable scatterAdd(SDVariable ref, SDVariable indices, SDVariable updates)SDVariable scatterAdd(String name, SDVariable ref, SDVariable indices, SDVariable updates)

Scatter addition operation.

If indices is rank 0 (a scalar), then out[index, ...] = out[index, ...] + op(updates[...])

If indices is rank 1 (a vector), then for each position i, out[indices[i], ...] = out[indices[i], ...] + op(updates[i, ...])

If indices is rank 2+, then for each position (i,...,k), out[indices[i], ..., indices[k], ...] = out[indices[i], ..., indices[k], ...] + op(updates[i, ..., k, ...])

Note that if multiple indices refer to the same location, the contributions from each is handled correctly.

**ref**(NUMERIC) - Initial/source variable**indices**(NUMERIC) - Indices array**updates**(NUMERIC) - Updates to add to the initial/source array

INDArray scatterDiv(INDArray ref, INDArray indices, INDArray updates)SDVariable scatterDiv(SDVariable ref, SDVariable indices, SDVariable updates)SDVariable scatterDiv(String name, SDVariable ref, SDVariable indices, SDVariable updates)

Scatter division operation.

If indices is rank 0 (a scalar), then out[index, ...] = out[index, ...] + op(updates[...])

If indices is rank 1 (a vector), then for each position i, out[indices[i], ...] = out[indices[i], ...] + op(updates[i, ...])

If indices is rank 2+, then for each position (i,...,k), out[indices[i], ..., indices[k], ...] = out[indices[i], ..., indices[k], ...] + op(updates[i, ..., k, ...])

Note that if multiple indices refer to the same location, the contributions from each is handled correctly.

**ref**(NUMERIC) - Initial/source variable**indices**(NUMERIC) - Indices array**updates**(NUMERIC) - Updates to add to the initial/source array

INDArray scatterMax(INDArray ref, INDArray indices, INDArray updates)SDVariable scatterMax(SDVariable ref, SDVariable indices, SDVariable updates)SDVariable scatterMax(String name, SDVariable ref, SDVariable indices, SDVariable updates)

Scatter max operation.

If indices is rank 0 (a scalar), then out[index, ...] = out[index, ...] + op(updates[...])

If indices is rank 1 (a vector), then for each position i, out[indices[i], ...] = out[indices[i], ...] + op(updates[i, ...])

If indices is rank 2+, then for each position (i,...,k), out[indices[i], ..., indices[k], ...] = out[indices[i], ..., indices[k], ...] + op(updates[i, ..., k, ...])

Note that if multiple indices refer to the same location, the contributions from each is handled correctly.

**ref**(NUMERIC) - Initial/source variable**indices**(NUMERIC) - Indices array**updates**(NUMERIC) - Updates to add to the initial/source array

INDArray scatterMin(INDArray ref, INDArray indices, INDArray updates)SDVariable scatterMin(SDVariable ref, SDVariable indices, SDVariable updates)SDVariable scatterMin(String name, SDVariable ref, SDVariable indices, SDVariable updates)

Scatter min operation.

If indices is rank 0 (a scalar), then out[index, ...] = out[index, ...] + op(updates[...])

**ref**(NUMERIC) - Initial/source variable**indices**(NUMERIC) - Indices array**updates**(NUMERIC) - Updates to add to the initial/source array

INDArray scatterMul(INDArray ref, INDArray indices, INDArray updates)SDVariable scatterMul(SDVariable ref, SDVariable indices, SDVariable updates)SDVariable scatterMul(String name, SDVariable ref, SDVariable indices, SDVariable updates)

Scatter multiplication operation.

If indices is rank 0 (a scalar), then out[index, ...] = out[index, ...] + op(updates[...])

**ref**(NUMERIC) - Initial/source variable**indices**(NUMERIC) - Indices array**updates**(NUMERIC) - Updates to add to the initial/source array

INDArray scatterSub(INDArray ref, INDArray indices, INDArray updates)SDVariable scatterSub(SDVariable ref, SDVariable indices, SDVariable updates)SDVariable scatterSub(String name, SDVariable ref, SDVariable indices, SDVariable updates)

Scatter subtraction operation.

If indices is rank 0 (a scalar), then out[index, ...] = out[index, ...] + op(updates[...])

**ref**(NUMERIC) - Initial/source variable**indices**(NUMERIC) - Indices array**updates**(NUMERIC) - Updates to add to the initial/source array

INDArray scatterUpdate(INDArray ref, INDArray indices, INDArray updates)SDVariable scatterUpdate(SDVariable ref, SDVariable indices, SDVariable updates)SDVariable scatterUpdate(String name, SDVariable ref, SDVariable indices, SDVariable updates)

Scatter update operation.

If indices is rank 0 (a scalar), then out[index, ...] = out[index, ...] + op(updates[...])

**ref**(NUMERIC) - Initial/source variable**indices**(NUMERIC) - Indices array**updates**(NUMERIC) - Updates to add to the initial/source array

INDArray segmentMax(INDArray data, INDArray segmentIds)SDVariable segmentMax(SDVariable data, SDVariable segmentIds)SDVariable segmentMax(String name, SDVariable data, SDVariable segmentIds)

Segment max operation.

If data = [3, 6, 1, 4, 9, 2, 8]

segmentIds = [0, 0, 1, 1, 1, 2, 2]

then output = [6, 9, 8] = [op(3,6), op(1,4,9), op(2,8)]

Note that the segment IDs must be sorted from smallest to largest segment.

See {unsortedSegment (String, SDVariable, SDVariable, int) ops

for the same op without this sorted requirement

**data**(NDARRAY) - Data to perform segment max on**segmentIds**(NUMERIC) - Variable for the segment IDs

INDArray segmentMean(INDArray data, INDArray segmentIds)SDVariable segmentMean(SDVariable data, SDVariable segmentIds)SDVariable segmentMean(String name, SDVariable data, SDVariable segmentIds)

Segment mean operation.

If data = [3, 6, 1, 4, 9, 2, 8]

segmentIds = [0, 0, 1, 1, 1, 2, 2]

then output = [6, 9, 8] = [op(3,6), op(1,4,9), op(2,8)]

Note that the segment IDs must be sorted from smallest to largest segment.

See {unsortedSegment (String, SDVariable, SDVariable, int) ops

for the same op without this sorted requirement

**data**(NDARRAY) - Data to perform segment max on**segmentIds**(NUMERIC) - Variable for the segment IDs

INDArray segmentMin(INDArray data, INDArray segmentIds)SDVariable segmentMin(SDVariable data, SDVariable segmentIds)SDVariable segmentMin(String name, SDVariable data, SDVariable segmentIds)

Segment min operation.

If data = [3, 6, 1, 4, 9, 2, 8]

segmentIds = [0, 0, 1, 1, 1, 2, 2]

then output = [6, 9, 8] = [op(3,6), op(1,4,9), op(2,8)]

Note that the segment IDs must be sorted from smallest to largest segment.

See {unsortedSegment (String, SDVariable, SDVariable, int) ops

for the same op without this sorted requirement

**data**(NDARRAY) - Data to perform segment max on**segmentIds**(NUMERIC) - Variable for the segment IDs

INDArray segmentProd(INDArray data, INDArray segmentIds)SDVariable segmentProd(SDVariable data, SDVariable segmentIds)SDVariable segmentProd(String name, SDVariable data, SDVariable segmentIds)

Segment product operation.

If data = [3, 6, 1, 4, 9, 2, 8]

segmentIds = [0, 0, 1, 1, 1, 2, 2]

then output = [6, 9, 8] = [op(3,6), op(1,4,9), op(2,8)]

Note that the segment IDs must be sorted from smallest to largest segment.

See {unsortedSegment (String, SDVariable, SDVariable, int) ops

for the same op without this sorted requirement

**data**(NDARRAY) - Data to perform segment max on**segmentIds**(NUMERIC) - Variable for the segment IDs

INDArray segmentSum(INDArray data, INDArray segmentIds)SDVariable segmentSum(SDVariable data, SDVariable segmentIds)SDVariable segmentSum(String name, SDVariable data, SDVariable segmentIds)

Segment sum operation.

If data = [3, 6, 1, 4, 9, 2, 8]

segmentIds = [0, 0, 1, 1, 1, 2, 2]

then output = [6, 9, 8] = [op(3,6), op(1,4,9), op(2,8)]

Note that the segment IDs must be sorted from smallest to largest segment.

See {unsortedSegment (String, SDVariable, SDVariable, int) ops

for the same op without this sorted requirement

**data**(NDARRAY) - Data to perform segment max on**segmentIds**(NUMERIC) - Variable for the segment IDs

INDArray sequenceMask(INDArray lengths, int maxLen, DataType dataType)SDVariable sequenceMask(SDVariable lengths, int maxLen, DataType dataType)SDVariable sequenceMask(String name, SDVariable lengths, int maxLen, DataType dataType)

Generate a sequence mask (with values 0 or 1) based on the specified lengths

Specifically, out[i, ..., k, j] = (j < lengths[i, ..., k] ? 1.0 : 0.0)

**lengths**(NUMERIC) - Lengths of the sequences**maxLen**- Maximum sequence length**dataType**-

INDArray sequenceMask(INDArray lengths, INDArray maxLen, DataType dataType)SDVariable sequenceMask(SDVariable lengths, SDVariable maxLen, DataType dataType)SDVariable sequenceMask(String name, SDVariable lengths, SDVariable maxLen, DataType dataType)

Generate a sequence mask (with values 0 or 1) based on the specified lengths

Specifically, out[i, ..., k, j] = (j < lengths[i, ..., k] ? 1.0 : 0.0)

**lengths**(NUMERIC) - Lengths of the sequences**maxLen**(INT) - Maximum sequence length**dataType**-

INDArray sequenceMask(INDArray lengths, DataType dataType)SDVariable sequenceMask(SDVariable lengths, DataType dataType)SDVariable sequenceMask(String name, SDVariable lengths, DataType dataType)

see sequenceMask(String, SDVariable, SDVariable, DataType)

**lengths**(NUMERIC) -**dataType**-

INDArray shape(INDArray input)SDVariable shape(SDVariable input)SDVariable shape(String name, SDVariable input)

Returns the shape of the specified INDArray as a 1D INDArray

**input**(NUMERIC) - Input variable

INDArray size(INDArray in)SDVariable size(SDVariable in)SDVariable size(String name, SDVariable in)

Returns the size (number of elements, i.e., prod(shape)) of the specified INDArray as a 0D scalar variable

**in**(NUMERIC) - Input variable

INDArray sizeAt(INDArray in, int dimension)SDVariable sizeAt(SDVariable in, int dimension)SDVariable sizeAt(String name, SDVariable in, int dimension)

Returns a rank 0 (scalar) variable for the size of the specified dimension.

For example, if X has shape [10,20,30] then sizeAt(X,1)=20. Similarly, sizeAt(X,-1)=30

**in**(NUMERIC) - Input variable**dimension**- Dimension to get size of

INDArray slice(INDArray input, int[] begin, int[] size)SDVariable slice(SDVariable input, int[] begin, int[] size)SDVariable slice(String name, SDVariable input