Package org.nd4j.autodiff.samediff.ops
Class SDBaseOps
- java.lang.Object
-
- org.nd4j.autodiff.samediff.ops.SDBaseOps
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SDVariable
all(String name, SDVariable x, int... dimensions)
Boolean and array reduction operation, optionally along specified dimensionsSDVariable
all(SDVariable x, int... dimensions)
Boolean and array reduction operation, optionally along specified dimensionsSDVariable
any(String name, SDVariable x, int... dimensions)
Boolean or array reduction operation, optionally along specified dimensionsSDVariable
any(SDVariable x, int... dimensions)
Boolean or array reduction operation, optionally along specified dimensionsSDVariable
argmax(String name, SDVariable in, boolean keepDims, 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.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.SDVariable
argmax(SDVariable in, boolean keepDims, 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.SDVariable
argmax(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.SDVariable
argmin(String name, SDVariable in, boolean keepDims, 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.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.SDVariable
argmin(SDVariable in, boolean keepDims, 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.SDVariable
argmin(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.SDVariable
assign(String name, SDVariable x, SDVariable y)
Assign the contents of y to x.
Y must be broadcastable to x or the same shape.SDVariable
assign(SDVariable x, SDVariable y)
Assign the contents of y to x.
Y must be broadcastable to x or the same shape.SDVariable[]
batchMmul(String[] names, SDVariable[] inputsA, SDVariable... inputsB)
Matrix multiply a batch of matrices.SDVariable[]
batchMmul(String[] names, SDVariable[] inputsA, SDVariable[] inputsB, boolean transposeA, boolean transposeB)
Matrix multiply a batch of matrices.SDVariable[]
batchMmul(SDVariable[] inputsA, SDVariable... inputsB)
Matrix multiply a batch of matrices.SDVariable[]
batchMmul(SDVariable[] inputsA, SDVariable[] inputsB, boolean transposeA, boolean transposeB)
Matrix multiply a batch of matrices.SDVariable
castTo(String name, SDVariable arg, DataType datatype)
Cast the array to a new datatype - for example, Integer -> FloatSDVariable
castTo(SDVariable arg, DataType datatype)
Cast the array to a new datatype - for example, Integer -> FloatSDVariable
clipByNorm(String name, SDVariable x, double clipValue)
Returns a clipped ndarray such that the input is normalized so that its L2 norm
is <= the specified value.SDVariable
clipByNorm(String name, SDVariable x, SDVariable clipValue, SDVariable dimensions)
Returns a clipped ndarray such that the input is normalized so that its L2 norm
is <= the specified value.SDVariable
clipByNorm(SDVariable x, double clipValue)
Returns a clipped ndarray such that the input is normalized so that its L2 norm
is <= the specified value.SDVariable
clipByNorm(SDVariable x, SDVariable clipValue, SDVariable dimensions)
Returns a clipped ndarray such that the input is normalized so that its L2 norm
is <= the specified value.SDVariable
clipByValue(String name, SDVariable x, double clipValueMin, double clipValueMax)
Return the clipped ndarray containing values no smaller or larger than the given min and max.SDVariable
clipByValue(String name, SDVariable x, SDVariable clipValueMin, SDVariable clipValueMax)
Return the clipped ndarray containing values no smaller or larger than the given min and max.SDVariable
clipByValue(SDVariable x, double clipValueMin, double clipValueMax)
Return the clipped ndarray containing values no smaller or larger than the given min and max.SDVariable
clipByValue(SDVariable x, SDVariable clipValueMin, SDVariable clipValueMax)
Return the clipped ndarray containing values no smaller or larger than the given min and max.SDVariable
concat(int dimension, SDVariable... inputs)
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 must satisfy the following constraints:
Input arrays must all be the same datatype: isSameType(inputs)SDVariable
concat(String name, int dimension, SDVariable... inputs)
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 must satisfy the following constraints:
Input arrays must all be the same datatype: isSameType(inputs)SDVariable
create(String name, SDVariable shape, DataType dataType)
Return a newly created variable, with the specified shape and data type.SDVariable
create(String name, SDVariable shape, DataType dataType, String order, boolean initialize)
Return a newly created variable, with the specified shape and data type.SDVariable
create(SDVariable shape, DataType dataType)
Return a newly created variable, with the specified shape and data type.SDVariable
create(SDVariable shape, DataType dataType, String order, boolean initialize)
Return a newly created variable, with the specified shape and data type.SDVariable
createView(String name, SDVariable input, SDVariable... indices)
Return a newly created variable, with the specified shape and data type.SDVariable
createView(SDVariable input, SDVariable... indices)
Return a newly created variable, with the specified shape and data type.SDVariable
cumprod(String name, SDVariable in, boolean exclusive, boolean reverse, 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]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]SDVariable
cumprod(SDVariable in, boolean exclusive, boolean reverse, 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]SDVariable
cumprod(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]SDVariable
cumsum(String name, SDVariable in, boolean exclusive, boolean reverse, 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]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]SDVariable
cumsum(SDVariable in, boolean exclusive, boolean reverse, 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]SDVariable
cumsum(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]SDVariable
dot(String name, SDVariable x, SDVariable y, int... dimensions)
Pairwise dot product reduction along dimension
output = sum(i=0 ...SDVariable
dot(SDVariable x, SDVariable y, int... dimensions)
Pairwise dot product reduction along dimension
output = sum(i=0 ...SDVariable[]
dynamicPartition(String[] names, SDVariable x, SDVariable partitions, int numPartitions)
Dynamically partition the input variable values into the specified number of paritions, using the indices.
Example:SDVariable[]
dynamicPartition(SDVariable x, SDVariable partitions, int numPartitions)
Dynamically partition the input variable values into the specified number of paritions, using the indices.
Example:SDVariable
dynamicStitch(String name, SDVariable[] indices, SDVariable... x)
Dynamically merge the specified input arrays into a single array, using the specified indicesSDVariable
dynamicStitch(SDVariable[] indices, SDVariable... x)
Dynamically merge the specified input arrays into a single array, using the specified indicesSDVariable
eq(String name, SDVariable x, double y)
Equals operation: elementwise x == y
Return boolean array with values true where satisfied, or false otherwise.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.SDVariable
eq(SDVariable x, double y)
Equals operation: elementwise x == y
Return boolean array with values true where satisfied, or false otherwise.SDVariable
eq(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.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]SDVariable
expandDims(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]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 valueSDVariable
fill(SDVariable shape, DataType dataType, double value)
Generate an output variable with the specified (dynamic) shape with all elements set to the specified valueSDVariable
flatten(String name, SDVariable... inputs)
Return a flattened variable with the specified orderingSDVariable
flatten(String name, SDVariable[] inputs, String order)
Return a flattened variable with the specified orderingSDVariable
flatten(SDVariable... inputs)
Return a flattened variable with the specified orderingSDVariable
flatten(SDVariable[] inputs, String order)
Return a flattened variable with the specified orderingSDVariable
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.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.SDVariable
gather(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.SDVariable
gather(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.SDVariable
gatherNd(String name, SDVariable df, SDVariable indices)
Gather slices from df with shape specified by indices.SDVariable
gatherNd(SDVariable df, SDVariable indices)
Gather slices from df with shape specified by indices.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.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.SDVariable
gt(SDVariable x, double y)
Greater than operation: elementwise x > y
Return boolean array with values true where satisfied, or false otherwise.SDVariable
gt(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.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.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]
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.SDVariable
gte(SDVariable x, double y)
Greater than or equals operation: elementwise x >= y
Return boolean array with values true where satisfied, or false otherwise.SDVariable
gte(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]
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.SDVariable
identity(String name, SDVariable input)
Elementwise identity operation: out = xSDVariable
identity(SDVariable input)
Elementwise identity operation: out = xSDVariable
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)) == xSDVariable
invertPermutation(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)) == xSDVariable
isNumericTensor(String name, SDVariable x)
Is the director a numeric tensor? In the current version of ND4J/SameDiff, this always returns true/1SDVariable
isNumericTensor(SDVariable x)
Is the director a numeric tensor? In the current version of ND4J/SameDiff, this always returns true/1SDVariable
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]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]SDVariable
linspace(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]SDVariable
linspace(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]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.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]
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.SDVariable
lt(SDVariable x, double y)
Less than operation: elementwise x < y
Return boolean array with values true where satisfied, or false otherwise.SDVariable
lt(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]
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.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.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]
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.SDVariable
lte(SDVariable x, double y)
Less than or equals operation: elementwise x <= y
Return boolean array with values true where satisfied, or false otherwise.SDVariable
lte(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]
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.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 otherwiseSDVariable
matchCondition(SDVariable in, Condition condition)
Returns a boolean mask of equal shape to the input, where the condition is satisfied - value 1 where satisfied, 0 otherwiseSDVariable
matchConditionCount(String name, SDVariable in, Condition condition)
Returns a count of the number of elements that satisfy the conditionSDVariable
matchConditionCount(String name, SDVariable in, Condition condition, boolean keepDim, 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.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.SDVariable
matchConditionCount(SDVariable in, Condition condition)
Returns a count of the number of elements that satisfy the conditionSDVariable
matchConditionCount(SDVariable in, Condition condition, boolean keepDim, 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.SDVariable
matchConditionCount(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.SDVariable
max(String name, SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.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,
with the reduced dimensions having size 1.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]
Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.htmlSDVariable
max(SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.SDVariable
max(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,
with the reduced dimensions having size 1.SDVariable
max(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]
Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.htmlSDVariable
mean(String name, SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.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,
with the reduced dimensions having size 1.SDVariable
mean(String name, SDVariable x, SDVariable 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,
with the reduced dimensions having size 1.SDVariable
mean(String name, SDVariable x, SDVariable dimensions, boolean keepDims)
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,
with the reduced dimensions having size 1.SDVariable
mean(SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.SDVariable
mean(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,
with the reduced dimensions having size 1.SDVariable
mean(SDVariable x, SDVariable 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,
with the reduced dimensions having size 1.SDVariable
mean(SDVariable x, SDVariable dimensions, boolean keepDims)
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,
with the reduced dimensions having size 1.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.SDVariable
merge(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.SDVariable
min(String name, SDVariable x, boolean keepDims, int... dimensions)
Minimum array reduction operation, optionally along specified dimensions.SDVariable
min(String name, SDVariable x, int... dimensions)
Minimum array reduction operation, optionally along specified dimensions.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]
Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.htmlSDVariable
min(SDVariable x, boolean keepDims, int... dimensions)
Minimum array reduction operation, optionally along specified dimensions.SDVariable
min(SDVariable x, int... dimensions)
Minimum array reduction operation, optionally along specified dimensions.SDVariable
min(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]
Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.htmlSDVariable
minMax(int datatype, int minOrMax)
Return a scalar array reflecting the min or max value for a given data type.SDVariable
minMax(String name, int datatype, int minOrMax)
Return a scalar array reflecting the min or max value for a given data type.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.SDVariable
mmul(String name, SDVariable x, SDVariable y, boolean transposeX, boolean transposeY, boolean transposeZ)
Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.SDVariable
mmul(SDVariable x, SDVariable y)
Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.SDVariable
mmul(SDVariable x, SDVariable y, boolean transposeX, boolean transposeY, boolean transposeZ)
Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.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.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]
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.SDVariable
neq(SDVariable x, double y)
Not equals operation: elementwise x != y
Return boolean array with values true where satisfied, or false otherwise.SDVariable
neq(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]
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.SDVariable
norm1(String name, SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.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,
with the reduced dimensions having size 1.SDVariable
norm1(SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.SDVariable
norm1(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,
with the reduced dimensions having size 1.SDVariable
norm2(String name, SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.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,
with the reduced dimensions having size 1.SDVariable
norm2(SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.SDVariable
norm2(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,
with the reduced dimensions having size 1.SDVariable
normmax(String name, SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.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,
with the reduced dimensions having size 1.SDVariable
normmax(SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.SDVariable
normmax(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,
with the reduced dimensions having size 1.SDVariable
oneHot(String name, SDVariable indices, int depth)
Convert the array to a one-hot array with values 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)SDVariable
oneHot(String name, SDVariable indices, int depth, int axis, double on, double off)
Convert the array to a one-hot array with values 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 toSDVariable
oneHot(String name, SDVariable indices, int depth, int axis, double on, double off, DataType dataType)
Convert the array to a one-hot array with values 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 toSDVariable
oneHot(SDVariable indices, int depth)
Convert the array to a one-hot array with values 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)SDVariable
oneHot(SDVariable indices, int depth, int axis, double on, double off)
Convert the array to a one-hot array with values 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 toSDVariable
oneHot(SDVariable indices, int depth, int axis, double on, double off, DataType dataType)
Convert the array to a one-hot array with values 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 toSDVariable
onesLike(String name, SDVariable input)
Return a variable of all 1s, with the same shape as the input variable.SDVariable
onesLike(String name, SDVariable input, DataType dataType)
As per onesLike(String, SDVariable) but the output datatype may be specifiedSDVariable
onesLike(SDVariable input)
Return a variable of all 1s, with the same shape as the input variable.SDVariable
onesLike(SDVariable input, DataType dataType)
As per onesLike(String, SDVariable) but the output datatype may be specifiedSDVariable
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]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]SDVariable
permute(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]SDVariable
permute(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]SDVariable
prod(String name, SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.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,
with the reduced dimensions having size 1.SDVariable
prod(String name, SDVariable x, SDVariable 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,
with the reduced dimensions having size 1.SDVariable
prod(String name, SDVariable x, SDVariable dimensions, boolean keepDims)
Product array reduction operation, optionally along 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.SDVariable
prod(SDVariable x, boolean keepDims, 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,
with the reduced dimensions having size 1.SDVariable
prod(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,
with the reduced dimensions having size 1.SDVariable
prod(SDVariable x, SDVariable 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,
with the reduced dimensions having size 1.SDVariable
prod(SDVariable x, SDVariable dimensions, boolean keepDims)
Product array reduction operation, optionally along 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.SDVariable
range(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]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]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]SDVariable
range(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]SDVariable
rank(String name, SDVariable in)
Returns the rank (number of dimensions, i.e., length(shape)) of the specified INDArray as a 0D scalar variableSDVariable
rank(SDVariable in)
Returns the rank (number of dimensions, i.e., length(shape)) of the specified INDArray as a 0D scalar variableSDVariable
repeat(String name, SDVariable input, SDVariable repeats, int axis)
A tensor with the shape of input minus the specified axis with elements repeated along the specified axis.SDVariable
repeat(SDVariable input, SDVariable repeats, int axis)
A tensor with the shape of input minus the specified axis with elements repeated along the specified axis.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 satisfiedSDVariable
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 satisfiedSDVariable
replaceWhere(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 satisfiedSDVariable
replaceWhere(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 satisfiedSDVariable
reshape(String name, SDVariable x, long... shape)
Reshape the input variable to the specified (fixed) shape.SDVariable
reshape(String name, SDVariable x, SDVariable shape)
Reshape the input variable to the specified (fixed) shape.SDVariable
reshape(SDVariable x, long... shape)
Reshape the input variable to the specified (fixed) shape.SDVariable
reshape(SDVariable x, SDVariable shape)
Reshape the input variable to the specified (fixed) shape.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]SDVariable
reverse(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]SDVariable
reverseSequence(String name, SDVariable x, SDVariable seq_lengths)
Reverse sequence op: for each slice along dimension seqDimension, the first seqLength values are reversedSDVariable
reverseSequence(String name, SDVariable x, SDVariable seq_lengths, int seqDim, int batchDim)
Reverse sequence op: for each slice along dimension seqDimension, the first seqLength values are reversedSDVariable
reverseSequence(SDVariable x, SDVariable seq_lengths)
Reverse sequence op: for each slice along dimension seqDimension, the first seqLength values are reversedSDVariable
reverseSequence(SDVariable x, SDVariable seq_lengths, int seqDim, int batchDim)
Reverse sequence op: for each slice along dimension seqDimension, the first seqLength values are reversedSDVariable
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'SDVariable
scalarFloorMod(SDVariable in, double value)
Element-wise scalar floor modulus operation: out = floorMod(in, value).
i.e., returns the remainder after division by 'value'SDVariable
scalarMax(String name, SDVariable in, double value)
Element-wise scalar maximum operation: out = max(in, value)SDVariable
scalarMax(SDVariable in, double value)
Element-wise scalar maximum operation: out = max(in, value)SDVariable
scalarMin(String name, SDVariable in, double value)
Element-wise scalar minimum operation: out = min(in, value)SDVariable
scalarMin(SDVariable in, double value)
Element-wise scalar minimum operation: out = min(in, value)SDVariable
scalarSet(String name, SDVariable in, double set)
Return a variable with equal shape to the input, but all elements set to value 'set'SDVariable
scalarSet(SDVariable in, double set)
Return a variable with equal shape to the input, but all elements set to value 'set'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.SDVariable
scatterAdd(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.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.SDVariable
scatterDiv(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.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.SDVariable
scatterMax(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.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[...])
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.SDVariable
scatterMin(SDVariable ref, SDVariable indices, SDVariable updates)
Scatter min 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.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[...])
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.SDVariable
scatterMul(SDVariable ref, SDVariable indices, SDVariable updates)
Scatter multiplication 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.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[...])
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.SDVariable
scatterSub(SDVariable ref, SDVariable indices, SDVariable updates)
Scatter subtraction 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.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[...])
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.SDVariable
scatterUpdate(SDVariable ref, SDVariable indices, SDVariable updates)
Scatter update 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.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 requirementSDVariable
segmentMax(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 requirementSDVariable
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 requirementSDVariable
segmentMean(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 requirementSDVariable
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 requirementSDVariable
segmentMin(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 requirementSDVariable
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 requirementSDVariable
segmentProd(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 requirementSDVariable
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 requirementSDVariable
segmentSum(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 requirementSDVariable
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)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)SDVariable
sequenceMask(String name, SDVariable lengths, DataType dataType)
see sequenceMask(String, SDVariable, SDVariable, DataType)SDVariable
sequenceMask(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)SDVariable
sequenceMask(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)SDVariable
sequenceMask(SDVariable lengths, DataType dataType)
see sequenceMask(String, SDVariable, SDVariable, DataType)SDVariable[]
setShape(String[] names, SDVariable input, SDVariable shape)
Sets an inplace shape on the passed in input.SDVariable[]
setShape(SDVariable input, SDVariable shape)
Sets an inplace shape on the passed in input.SDVariable
shape(String name, SDVariable input)
Returns the shape of the specified INDArray as a 1D INDArraySDVariable
shape(SDVariable input)
Returns the shape of the specified INDArray as a 1D INDArraySDVariable
size(String name, SDVariable in)
Returns the size (number of elements, i.e., prod(shape)) of the specified INDArray as a 0D scalar variableSDVariable
size(SDVariable in)
Returns the size (number of elements, i.e., prod(shape)) of the specified INDArray as a 0D scalar variableSDVariable
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.SDVariable
sizeAt(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.SDVariable
slice(String name, SDVariable input, int[] begin, int... size)
Get a subset of the specified input, by specifying the first element and the size of the array.
For example, if input is:
[a, b, c]
[d, e, f]
then slice(input, begin=[0,1], size=[2,1] will return:
[b]
[e]
Note that for each dimension i, begin[i] + size[i] <= input.size(i)SDVariable
slice(String name, SDVariable input, SDVariable begin, SDVariable size)
Get a subset of the specified input, by specifying the first element and the size of the array.
For example, if input is:
[a, b, c]
[d, e, f]
then slice(input, begin=[0,1], size=[2,1] will return:
[b]
[e]
Note that for each dimension i, begin[i] + size[i] <= input.size(i)SDVariable
slice(SDVariable input, int[] begin, int... size)
Get a subset of the specified input, by specifying the first element and the size of the array.
For example, if input is:
[a, b, c]
[d, e, f]
then slice(input, begin=[0,1], size=[2,1] will return:
[b]
[e]
Note that for each dimension i, begin[i] + size[i] <= input.size(i)SDVariable
slice(SDVariable input, SDVariable begin, SDVariable size)
Get a subset of the specified input, by specifying the first element and the size of the array.
For example, if input is:
[a, b, c]
[d, e, f]
then slice(input, begin=[0,1], size=[2,1] will return:
[b]
[e]
Note that for each dimension i, begin[i] + size[i] <= input.size(i)SDVariable
sparseToDense(String name, SDVariable indices, SDVariable shape, SDVariable values)
Create a dense matrix equivalent of a sparse matrix based on the given input.SDVariable
sparseToDense(String name, SDVariable indices, SDVariable shape, SDVariable values, SDVariable defaultValue)
Create a dense matrix equivalent of a sparse matrix based on the given input.SDVariable
sparseToDense(SDVariable indices, SDVariable shape, SDVariable values)
Create a dense matrix equivalent of a sparse matrix based on the given input.SDVariable
sparseToDense(SDVariable indices, SDVariable shape, SDVariable values, SDVariable defaultValue)
Create a dense matrix equivalent of a sparse matrix based on the given input.SDVariable[]
split(String[] names, SDVariable input, int numSplit, int splitDim)
Split a value in to a list of ndarrays.SDVariable[]
split(String[] names, SDVariable input, SDVariable numSplit, int splitDim)
Split a value in to a list of ndarrays.SDVariable[]
split(SDVariable input, int numSplit, int splitDim)
Split a value in to a list of ndarrays.SDVariable[]
split(SDVariable input, SDVariable numSplit, int splitDim)
Split a value in to a list of ndarrays.SDVariable[]
splitV(String[] names, SDVariable input, SDVariable sizes, int numSplit, int splitDim)
Split a value in to a list of ndarrays with varying sizes
according to the sizes parameter.SDVariable[]
splitV(SDVariable input, SDVariable sizes, int numSplit, int splitDim)
Split a value in to a list of ndarrays with varying sizes
according to the sizes parameter.SDVariable
squaredNorm(String name, SDVariable x, boolean keepDims, int... dimensions)
Squared L2 norm: see norm2(String, SDVariable, boolean, int...)
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
squaredNorm(String name, SDVariable x, int... dimensions)
Squared L2 norm: see norm2(String, SDVariable, boolean, int...)
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
squaredNorm(SDVariable x, boolean keepDims, int... dimensions)
Squared L2 norm: see norm2(String, SDVariable, boolean, int...)
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
squaredNorm(SDVariable x, int... dimensions)
Squared L2 norm: see norm2(String, SDVariable, boolean, int...)
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
squeeze(String name, SDVariable x, int axis)
Remove a single dimension of size 1.
For example, if input has shape [a,b,1,c] then squeeze(input, 2) returns an array of shape [a,b,c]SDVariable
squeeze(SDVariable x, int axis)
Remove a single dimension of size 1.
For example, if input has shape [a,b,1,c] then squeeze(input, 2) returns an array of shape [a,b,c]SDVariable
stack(int axis, SDVariable... values)
Stack a set of N INDArray of rank X into one rank X+1 variable.
If inputs have shape [a,b,c] then output has shape:
axis = 0: [N,a,b,c]
axis = 1: [a,N,b,c]
axis = 2: [a,b,N,c]
axis = 3: [a,b,c,N]
see unstack(String[], SDVariable, int, int)SDVariable
stack(String name, int axis, SDVariable... values)
Stack a set of N INDArray of rank X into one rank X+1 variable.
If inputs have shape [a,b,c] then output has shape:
axis = 0: [N,a,b,c]
axis = 1: [a,N,b,c]
axis = 2: [a,b,N,c]
axis = 3: [a,b,c,N]
see unstack(String[], SDVariable, int, int)SDVariable
standardDeviation(String name, SDVariable x, boolean biasCorrected, boolean keepDims, int... dimensions)
Standard deviation array reduction operation, optionally along 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.SDVariable
standardDeviation(String name, SDVariable x, boolean biasCorrected, int... dimensions)
Standard deviation array reduction operation, optionally along 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.SDVariable
standardDeviation(SDVariable x, boolean biasCorrected, boolean keepDims, int... dimensions)
Standard deviation array reduction operation, optionally along 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.SDVariable
standardDeviation(SDVariable x, boolean biasCorrected, int... dimensions)
Standard deviation array reduction operation, optionally along 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.SDVariable
stridedSlice(String name, SDVariable in, long[] begin, long[] end, long... strides)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]SDVariable
stridedSlice(String name, SDVariable in, long[] begin, long[] end, long[] strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]SDVariable
stridedSlice(String name, SDVariable in, SDVariable begin, SDVariable end, SDVariable strides)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]SDVariable
stridedSlice(String name, SDVariable in, SDVariable begin, SDVariable end, SDVariable strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]SDVariable
stridedSlice(SDVariable in, long[] begin, long[] end, long... strides)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]SDVariable
stridedSlice(SDVariable in, long[] begin, long[] end, long[] strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]SDVariable
stridedSlice(SDVariable in, SDVariable begin, SDVariable end, SDVariable strides)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]SDVariable
stridedSlice(SDVariable in, SDVariable begin, SDVariable end, SDVariable strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]SDVariable
sum(String name, SDVariable x, boolean keepDims, int... dimensions)
Sum array reduction operation, optionally along 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.SDVariable
sum(String name, SDVariable x, int... dimensions)
Sum array reduction operation, optionally along 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.SDVariable
sum(SDVariable x, boolean keepDims, int... dimensions)
Sum array reduction operation, optionally along 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.SDVariable
sum(SDVariable x, int... dimensions)
Sum array reduction operation, optionally along 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.SDVariable[]
switchOp(String[] names, SDVariable x, SDVariable predicate)
Switch operation
Predicate - if false, values are output to left (first) branch/output; if true, to right (second) branch/outputSDVariable[]
switchOp(SDVariable x, SDVariable predicate)
Switch operation
Predicate - if false, values are output to left (first) branch/output; if true, to right (second) branch/outputSDVariable
tensorMmul(String name, SDVariable x, SDVariable y, int[] dimensionsX, int... dimensionsY)
//TODO: Ops must be documented.SDVariable
tensorMmul(String name, SDVariable x, SDVariable y, int[] dimensionsX, int[] dimensionsY, boolean transposeX, boolean transposeY, boolean transposeZ)
//TODO: Ops must be documented.SDVariable
tensorMmul(SDVariable x, SDVariable y, int[] dimensionsX, int... dimensionsY)
//TODO: Ops must be documented.SDVariable
tensorMmul(SDVariable x, SDVariable y, int[] dimensionsX, int[] dimensionsY, boolean transposeX, boolean transposeY, boolean transposeZ)
//TODO: Ops must be documented.SDVariable
tile(String name, SDVariable x, int... repeat)
see tile(String, SDVariable, int...)SDVariable
tile(String name, SDVariable x, SDVariable repeat)
Repeat (tile) the input tensor the specified number of times.
For example, if input is
[1, 2]
[3, 4]
and repeat is [2, 3]
then output is
[1, 2, 1, 2, 1, 2]
[3, 4, 3, 4, 3, 4]
[1, 2, 1, 2, 1, 2]
[3, 4, 3, 4, 3, 4]SDVariable
tile(SDVariable x, int... repeat)
see tile(String, SDVariable, int...)SDVariable
tile(SDVariable x, SDVariable repeat)
Repeat (tile) the input tensor the specified number of times.
For example, if input is
[1, 2]
[3, 4]
and repeat is [2, 3]
then output is
[1, 2, 1, 2, 1, 2]
[3, 4, 3, 4, 3, 4]
[1, 2, 1, 2, 1, 2]
[3, 4, 3, 4, 3, 4]SDVariable
transpose(String name, SDVariable x)
Matrix transpose operation: If input has shape [a,b] output has shape [b,a]SDVariable
transpose(SDVariable x)
Matrix transpose operation: If input has shape [a,b] output has shape [b,a]SDVariable
unsortedSegmentMax(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment max operation.SDVariable
unsortedSegmentMax(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment max operation.SDVariable
unsortedSegmentMax(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment max operation.SDVariable
unsortedSegmentMax(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment max operation.SDVariable
unsortedSegmentMean(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment mean operation.SDVariable
unsortedSegmentMean(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment mean operation.SDVariable
unsortedSegmentMean(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment mean operation.SDVariable
unsortedSegmentMean(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment mean operation.SDVariable
unsortedSegmentMin(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment min operation.SDVariable
unsortedSegmentMin(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment min operation.SDVariable
unsortedSegmentMin(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment min operation.SDVariable
unsortedSegmentMin(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment min operation.SDVariable
unsortedSegmentProd(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment product operation.SDVariable
unsortedSegmentProd(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment product operation.SDVariable
unsortedSegmentProd(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment product operation.SDVariable
unsortedSegmentProd(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment product operation.SDVariable
unsortedSegmentSqrtN(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment sqrtN operation.SDVariable
unsortedSegmentSqrtN(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment sqrtN operation.SDVariable
unsortedSegmentSqrtN(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment sqrtN operation.SDVariable
unsortedSegmentSqrtN(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment sqrtN operation.SDVariable
unsortedSegmentSum(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment sum operation.SDVariable
unsortedSegmentSum(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment sum operation.SDVariable
unsortedSegmentSum(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment sum operation.SDVariable
unsortedSegmentSum(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment sum operation.SDVariable[]
unstack(String[] names, SDVariable value, int axis, int num)
Unstack a variable of rank X into N rank X-1 variables by taking slices along the specified axis.
If input has shape [a,b,c] then output has shape:
axis = 0: [b,c]
axis = 1: [a,c]
axis = 2: [a,b]SDVariable[]
unstack(SDVariable value, int axis, int num)
Unstack a variable of rank X into N rank X-1 variables by taking slices along the specified axis.
If input has shape [a,b,c] then output has shape:
axis = 0: [b,c]
axis = 1: [a,c]
axis = 2: [a,b]SDVariable
variance(String name, SDVariable x, boolean biasCorrected, boolean keepDims, int... dimensions)
Variance array reduction operation, optionally along 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.SDVariable
variance(String name, SDVariable x, boolean biasCorrected, int... dimensions)
Variance array reduction operation, optionally along 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.SDVariable
variance(SDVariable x, boolean biasCorrected, boolean keepDims, int... dimensions)
Variance array reduction operation, optionally along 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.SDVariable
variance(SDVariable x, boolean biasCorrected, int... dimensions)
Variance array reduction operation, optionally along 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.SDVariable
where(String name, SDVariable condition)
Returns elements that are true from the given condition array
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
where(String name, SDVariable x, SDVariable condition)
Similar to numpy where, takes elements from x or y depending on whether the condition at a given element is true or false
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
where(String name, SDVariable x, SDVariable y, SDVariable condition)
Similar to numpy where, takes elements from x or y depending on whether the condition at a given element is true or false
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
where(SDVariable condition)
Returns elements that are true from the given condition array
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
where(SDVariable x, SDVariable condition)
Similar to numpy where, takes elements from x or y depending on whether the condition at a given element is true or false
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
where(SDVariable x, SDVariable y, SDVariable condition)
Similar to numpy where, takes elements from x or y depending on whether the condition at a given element is true or false
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
whereNumpy(String name, SDVariable x, SDVariable y, SDVariable condition)
As implemented in numpy, Return elements chosen from x or y depending on condition.
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
whereNumpy(SDVariable x, SDVariable y, SDVariable condition)
As implemented in numpy, Return elements chosen from x or y depending on condition.
Note that if keepDims = true, the output variable has the same rank as the input variable,
with the reduced dimensions having size 1.SDVariable
zerosLike(String name, SDVariable input)
Return a variable of all 0s, with the same shape as the input variable.SDVariable
zerosLike(SDVariable input)
Return a variable of all 0s, with the same shape as the input variable.
-
-
-
Field Detail
-
sd
protected SameDiff sd
-
-
Constructor Detail
-
SDBaseOps
public SDBaseOps(SameDiff sameDiff)
-
-
Method Detail
-
all
public SDVariable all(SDVariable x, int... dimensions)
Boolean and array reduction operation, optionally along specified dimensions- Parameters:
x
- Input variable (NDARRAY 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) (BOOL type)
-
all
public SDVariable all(String name, SDVariable x, int... dimensions)
Boolean and array reduction operation, optionally along specified dimensions- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY 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) (BOOL type)
-
any
public SDVariable any(SDVariable x, int... dimensions)
Boolean or array reduction operation, optionally along specified dimensions- Parameters:
x
- Input variable (NDARRAY 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) (BOOL type)
-
any
public SDVariable any(String name, SDVariable x, int... dimensions)
Boolean or array reduction operation, optionally along specified dimensions- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY 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) (BOOL type)
-
argmax
public SDVariable argmax(SDVariable in, boolean keepDims, 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]- Parameters:
in
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
argmax
public SDVariable argmax(String name, SDVariable in, boolean keepDims, 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]- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
argmax
public SDVariable argmax(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]- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
argmax
public 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]- Parameters:
name
- name May be null. Name for the output variablein
- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
argmin
public SDVariable argmin(SDVariable in, boolean keepDims, 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- Parameters:
in
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
argmin
public SDVariable argmin(String name, SDVariable in, boolean keepDims, 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- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
argmin
public SDVariable argmin(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- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
argmin
public 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- Parameters:
name
- name May be null. Name for the output variablein
- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
assign
public SDVariable assign(SDVariable x, SDVariable y)
Assign the contents of y to x.
Y must be broadcastable to x or the same shape.- Parameters:
x
- The variable to assign to (NDARRAY type)y
- The variable to assign (NDARRAY type)- Returns:
- output The newly assigned output (NUMERIC type)
-
assign
public SDVariable assign(String name, SDVariable x, SDVariable y)
Assign the contents of y to x.
Y must be broadcastable to x or the same shape.- Parameters:
name
- name May be null. Name for the output variablex
- The variable to assign to (NDARRAY type)y
- The variable to assign (NDARRAY type)- Returns:
- output The newly assigned output (NUMERIC type)
-
batchMmul
public SDVariable[] batchMmul(SDVariable[] inputsA, SDVariable[] inputsB, boolean transposeA, boolean transposeB)
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).- Parameters:
inputsA
- First array of input matrices, all of shape (M, N) or (N, M) (NUMERIC type)inputsB
- Second array of input matrices, all of shape (N, K) or (K, N) (NUMERIC type)transposeA
- Whether to transpose A arrays or nottransposeB
- Whether to transpose B arrays or not
-
batchMmul
public SDVariable[] batchMmul(String[] names, SDVariable[] inputsA, SDVariable[] inputsB, boolean transposeA, boolean transposeB)
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).- Parameters:
names
- names May be null. Arrays of names for the output variables.inputsA
- First array of input matrices, all of shape (M, N) or (N, M) (NUMERIC type)inputsB
- Second array of input matrices, all of shape (N, K) or (K, N) (NUMERIC type)transposeA
- Whether to transpose A arrays or nottransposeB
- Whether to transpose B arrays or not
-
batchMmul
public SDVariable[] batchMmul(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).- Parameters:
inputsA
- First array of input matrices, all of shape (M, N) or (N, M) (NUMERIC type)inputsB
- Second array of input matrices, all of shape (N, K) or (K, N) (NUMERIC type)
-
batchMmul
public SDVariable[] batchMmul(String[] names, 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).- Parameters:
names
- names May be null. Arrays of names for the output variables.inputsA
- First array of input matrices, all of shape (M, N) or (N, M) (NUMERIC type)inputsB
- Second array of input matrices, all of shape (N, K) or (K, N) (NUMERIC type)
-
castTo
public SDVariable castTo(SDVariable arg, DataType datatype)
Cast the array to a new datatype - for example, Integer -> Float- Parameters:
arg
- Input variable to cast (NDARRAY type)datatype
- Datatype to cast to- Returns:
- output Output array (after casting) (NDARRAY type)
-
castTo
public SDVariable castTo(String name, SDVariable arg, DataType datatype)
Cast the array to a new datatype - for example, Integer -> Float- Parameters:
name
- name May be null. Name for the output variablearg
- Input variable to cast (NDARRAY type)datatype
- Datatype to cast to- Returns:
- output Output array (after casting) (NDARRAY type)
-
clipByNorm
public SDVariable clipByNorm(SDVariable x, double clipValue)
Returns a clipped ndarray such that the input is normalized so that its L2 norm
is <= the specified value.- Parameters:
x
- Input variable to clip (NUMERIC type)clipValue
- The value max for clipping- Returns:
- output The clipped value (NUMERIC type)
-
clipByNorm
public SDVariable clipByNorm(String name, SDVariable x, double clipValue)
Returns a clipped ndarray such that the input is normalized so that its L2 norm
is <= the specified value.- Parameters:
name
- name May be null. Name for the output variablex
- Input variable to clip (NUMERIC type)clipValue
- The value max for clipping- Returns:
- output The clipped value (NUMERIC type)
-
clipByNorm
public SDVariable clipByNorm(SDVariable x, SDVariable clipValue, SDVariable dimensions)
Returns a clipped ndarray such that the input is normalized so that its L2 norm
is <= the specified value.- Parameters:
x
- Input variable to clip (NUMERIC type)clipValue
- The value max value for clipping (NUMERIC type)dimensions
- The dimensions to clip (NUMERIC type)- Returns:
- output The clipped value (NUMERIC type)
-
clipByNorm
public SDVariable clipByNorm(String name, SDVariable x, SDVariable clipValue, SDVariable dimensions)
Returns a clipped ndarray such that the input is normalized so that its L2 norm
is <= the specified value.- Parameters:
name
- name May be null. Name for the output variablex
- Input variable to clip (NUMERIC type)clipValue
- The value max value for clipping (NUMERIC type)dimensions
- The dimensions to clip (NUMERIC type)- Returns:
- output The clipped value (NUMERIC type)
-
clipByValue
public SDVariable clipByValue(SDVariable x, double clipValueMin, double clipValueMax)
Return the clipped ndarray containing values no smaller or larger than the given min and max.- Parameters:
x
- Input variable to cip (NUMERIC type)clipValueMin
- The value min for clippingclipValueMax
- The max value to clip to- Returns:
- output The clipped value (NUMERIC type)
-
clipByValue
public SDVariable clipByValue(String name, SDVariable x, double clipValueMin, double clipValueMax)
Return the clipped ndarray containing values no smaller or larger than the given min and max.- Parameters:
name
- name May be null. Name for the output variablex
- Input variable to cip (NUMERIC type)clipValueMin
- The value min for clippingclipValueMax
- The max value to clip to- Returns:
- output The clipped value (NUMERIC type)
-
clipByValue
public SDVariable clipByValue(SDVariable x, SDVariable clipValueMin, SDVariable clipValueMax)
Return the clipped ndarray containing values no smaller or larger than the given min and max.- Parameters:
x
- Input variable to cip (NUMERIC type)clipValueMin
- The value min for clipping (NUMERIC type)clipValueMax
- The max value to clip to (NUMERIC type)- Returns:
- output The clipped value (NUMERIC type)
-
clipByValue
public SDVariable clipByValue(String name, SDVariable x, SDVariable clipValueMin, SDVariable clipValueMax)
Return the clipped ndarray containing values no smaller or larger than the given min and max.- Parameters:
name
- name May be null. Name for the output variablex
- Input variable to cip (NUMERIC type)clipValueMin
- The value min for clipping (NUMERIC type)clipValueMax
- The max value to clip to (NUMERIC type)- Returns:
- output The clipped value (NUMERIC type)
-
concat
public SDVariable concat(int dimension, SDVariable... inputs)
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 must satisfy the following constraints:
Input arrays must all be the same datatype: isSameType(inputs)- Parameters:
inputs
- Input variables (NUMERIC type)dimension
- Dimension to concatenate on- Returns:
- output (NUMERIC type)
-
concat
public SDVariable concat(String name, int dimension, SDVariable... inputs)
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 must satisfy the following constraints:
Input arrays must all be the same datatype: isSameType(inputs)- Parameters:
name
- name May be null. Name for the output variabledimension
- Dimension to concatenate oninputs
- Input variables (NUMERIC type)- Returns:
- output (NUMERIC type)
-
create
public SDVariable create(SDVariable shape, DataType dataType, String order, boolean initialize)
Return a newly created variable, with the specified shape and data type.- Parameters:
shape
- Input INDArray (NUMERIC type)dataType
- Data type of arrayorder
- Order of arrayinitialize
- Whether to initialize the array or not- Returns:
- output A new INDArray with the same (dynamic) shape as the input (NUMERIC type)
-
create
public SDVariable create(String name, SDVariable shape, DataType dataType, String order, boolean initialize)
Return a newly created variable, with the specified shape and data type.- Parameters:
name
- name May be null. Name for the output variableshape
- Input INDArray (NUMERIC type)dataType
- Data type of arrayorder
- Order of arrayinitialize
- Whether to initialize the array or not- Returns:
- output A new INDArray with the same (dynamic) shape as the input (NUMERIC type)
-
create
public SDVariable create(SDVariable shape, DataType dataType)
Return a newly created variable, with the specified shape and data type.- Parameters:
shape
- Input INDArray (NUMERIC type)dataType
- Data type of array- Returns:
- output A new INDArray with the same (dynamic) shape as the input (NUMERIC type)
-
create
public SDVariable create(String name, SDVariable shape, DataType dataType)
Return a newly created variable, with the specified shape and data type.- Parameters:
name
- name May be null. Name for the output variableshape
- Input INDArray (NUMERIC type)dataType
- Data type of array- Returns:
- output A new INDArray with the same (dynamic) shape as the input (NUMERIC type)
-
createView
public SDVariable createView(SDVariable input, SDVariable... indices)
Return a newly created variable, with the specified shape and data type.- Parameters:
input
- Input INDArray (NDARRAY type)indices
- (NDARRAY type)- Returns:
- output A new INDArray with the same (dynamic) shape as the input (NUMERIC type)
-
createView
public SDVariable createView(String name, SDVariable input, SDVariable... indices)
Return a newly created variable, with the specified shape and data type.- Parameters:
name
- name May be null. Name for the output variableinput
- Input INDArray (NDARRAY type)indices
- (NDARRAY type)- Returns:
- output A new INDArray with the same (dynamic) shape as the input (NUMERIC type)
-
cumprod
public SDVariable cumprod(SDVariable in, boolean exclusive, boolean reverse, 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]- Parameters:
in
- Input variable (NUMERIC type)exclusive
- If true: exclude the first valuereverse
- If true: reverse the direction of the accumulationaxis
- Scalar axis argument for dimension to perform cumululative sum operations along (Size: AtLeast(min=1))- Returns:
- output Output variable (NUMERIC type)
-
cumprod
public SDVariable cumprod(String name, SDVariable in, boolean exclusive, boolean reverse, 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]- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)exclusive
- If true: exclude the first valuereverse
- If true: reverse the direction of the accumulationaxis
- Scalar axis argument for dimension to perform cumululative sum operations along (Size: AtLeast(min=1))- Returns:
- output Output variable (NUMERIC type)
-
cumprod
public SDVariable cumprod(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]- Parameters:
in
- Input variable (NUMERIC type)axis
- Scalar axis argument for dimension to perform cumululative sum operations along (Size: AtLeast(min=1))- Returns:
- output Output variable (NUMERIC type)
-
cumprod
public 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]- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)axis
- Scalar axis argument for dimension to perform cumululative sum operations along (Size: AtLeast(min=1))- Returns:
- output Output variable (NUMERIC type)
-
cumsum
public SDVariable cumsum(SDVariable in, boolean exclusive, boolean reverse, 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]- Parameters:
in
- Input variable (NUMERIC type)exclusive
- If true: exclude the first valuereverse
- If true: reverse the direction of the accumulationaxis
- Scalar axis argument for dimension to perform cumululative sum operations along (Size: AtLeast(min=1))- Returns:
- output (NUMERIC type)
-
cumsum
public SDVariable cumsum(String name, SDVariable in, boolean exclusive, boolean reverse, 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]- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)exclusive
- If true: exclude the first valuereverse
- If true: reverse the direction of the accumulationaxis
- Scalar axis argument for dimension to perform cumululative sum operations along (Size: AtLeast(min=1))- Returns:
- output (NUMERIC type)
-
cumsum
public SDVariable cumsum(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]- Parameters:
in
- Input variable (NUMERIC type)axis
- Scalar axis argument for dimension to perform cumululative sum operations along (Size: AtLeast(min=1))- Returns:
- output (NUMERIC type)
-
cumsum
public 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]- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)axis
- Scalar axis argument for dimension to perform cumululative sum operations along (Size: AtLeast(min=1))- Returns:
- output (NUMERIC type)
-
dot
public SDVariable dot(SDVariable x, SDVariable y, int... dimensions)
Pairwise dot product reduction along dimension
output = sum(i=0 ... size(dim)-1) x[i] * y[i]- Parameters:
x
- first input (NUMERIC type)y
- second input (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)
-
dot
public 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]- Parameters:
name
- name May be null. Name for the output variablex
- first input (NUMERIC type)y
- second input (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)
-
dynamicPartition
public SDVariable[] dynamicPartition(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 = 2
partitions = [1,0,0,1,0]
out[0] = [2,3,5]
out[1] = [1,4] }
- Parameters:
x
- Input variable (NUMERIC type)partitions
- 1D input with values 0 to numPartitions-1 (INT type)numPartitions
- Number of partitions, >= 1
-
dynamicPartition
public SDVariable[] dynamicPartition(String[] names, 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 = 2
partitions = [1,0,0,1,0]
out[0] = [2,3,5]
out[1] = [1,4] }
- Parameters:
names
- names May be null. Arrays of names for the output variables.x
- Input variable (NUMERIC type)partitions
- 1D input with values 0 to numPartitions-1 (INT type)numPartitions
- Number of partitions, >= 1
-
dynamicStitch
public SDVariable dynamicStitch(SDVariable[] indices, SDVariable... x)
Dynamically merge the specified input arrays into a single array, using the specified indices- Parameters:
indices
- Indices to use when merging. Must be >= 1, same length as input variables (INT type)x
- Input variables. (NUMERIC type)- Returns:
- output Merged output variable (NUMERIC type)
-
dynamicStitch
public SDVariable dynamicStitch(String name, SDVariable[] indices, SDVariable... x)
Dynamically merge the specified input arrays into a single array, using the specified indices- Parameters:
name
- name May be null. Name for the output variableindices
- Indices to use when merging. Must be >= 1, same length as input variables (INT type)x
- Input variables. (NUMERIC type)- Returns:
- output Merged output variable (NUMERIC type)
-
eq
public SDVariable eq(SDVariable x, double y)
Equals operation: elementwise x == y
Return boolean array with values true where satisfied, or false otherwise.- Parameters:
x
- Input array (NUMERIC type)y
- Double value argument to use in operation- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
eq
public SDVariable eq(String name, SDVariable x, double y)
Equals operation: elementwise x == y
Return boolean array with values true where satisfied, or false otherwise.- Parameters:
name
- name May be null. Name for the output variablex
- Input array (NUMERIC type)y
- Double value argument to use in operation- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
eq
public SDVariable eq(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.- Parameters:
x
- Input 1 (NDARRAY type)y
- Input 2 (NDARRAY type)- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
eq
public 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.- Parameters:
name
- name May be null. Name for the output variablex
- Input 1 (NDARRAY type)y
- Input 2 (NDARRAY type)- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
expandDims
public SDVariable expandDims(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]- Parameters:
x
- Input variable (NDARRAY type)axis
- Axis to expand- Returns:
- output Output variable (NUMERIC type)
-
expandDims
public 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]- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY type)axis
- Axis to expand- Returns:
- output Output variable (NUMERIC type)
-
fill
public SDVariable fill(SDVariable shape, DataType dataType, double value)
Generate an output variable with the specified (dynamic) shape with all elements set to the specified value- Parameters:
shape
- Shape: must be a 1D array/variable (INT type)dataType
- Datatype of the output arrayvalue
- Value to set all elements to- Returns:
- output Output variable (NUMERIC type)
-
fill
public 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- Parameters:
name
- name May be null. Name for the output variableshape
- Shape: must be a 1D array/variable (INT type)dataType
- Datatype of the output arrayvalue
- Value to set all elements to- Returns:
- output Output variable (NUMERIC type)
-
flatten
public SDVariable flatten(SDVariable[] inputs, String order)
Return a flattened variable with the specified ordering- Parameters:
inputs
- Input variables (NDARRAY type)order
- ordering for the variable- Returns:
- output Output variable (NUMERIC type)
-
flatten
public SDVariable flatten(String name, SDVariable[] inputs, String order)
Return a flattened variable with the specified ordering- Parameters:
name
- name May be null. Name for the output variableinputs
- Input variables (NDARRAY type)order
- ordering for the variable- Returns:
- output Output variable (NUMERIC type)
-
flatten
public SDVariable flatten(SDVariable... inputs)
Return a flattened variable with the specified ordering- Parameters:
inputs
- Input variables (NDARRAY type)- Returns:
- output Output variable (NUMERIC type)
-
flatten
public SDVariable flatten(String name, SDVariable... inputs)
Return a flattened variable with the specified ordering- Parameters:
name
- name May be null. Name for the output variableinputs
- Input variables (NDARRAY type)- Returns:
- output Output variable (NUMERIC type)
-
gather
public SDVariable gather(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.- Parameters:
df
- Input variable (NDARRAY type)indices
- Indices to get (Size: AtLeast(min=1))axis
- Axis that the indices refer to- Returns:
- output Output variable with slices pulled from the specified axis (NDARRAY type)
-
gather
public 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.- Parameters:
name
- name May be null. Name for the output variabledf
- Input variable (NDARRAY type)indices
- Indices to get (Size: AtLeast(min=1))axis
- Axis that the indices refer to- Returns:
- output Output variable with slices pulled from the specified axis (NDARRAY type)
-
gather
public SDVariable gather(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.- Parameters:
df
- Input variable (NDARRAY type)indices
- Indices to get slices for. Rank 0 or 1 input (INT type)axis
- Axis that the indices refer to- Returns:
- output Output variable with slices pulled from the specified axis (NDARRAY type)
-
gather
public 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.- Parameters:
name
- name May be null. Name for the output variabledf
- Input variable (NDARRAY type)indices
- Indices to get slices for. Rank 0 or 1 input (INT type)axis
- Axis that the indices refer to- Returns:
- output Output variable with slices pulled from the specified axis (NDARRAY type)
-
gatherNd
public SDVariable gatherNd(SDVariable df, SDVariable indices)
Gather slices from df with shape specified by indices.- Parameters:
df
- (NDARRAY type)indices
- (NUMERIC type)- Returns:
- output (NDARRAY type)
-
gatherNd
public SDVariable gatherNd(String name, SDVariable df, SDVariable indices)
Gather slices from df with shape specified by indices.- Parameters:
name
- name May be null. Name for the output variabledf
- (NDARRAY type)indices
- (NUMERIC type)- Returns:
- output (NDARRAY type)
-
gt
public SDVariable gt(SDVariable x, double y)
Greater than operation: elementwise x > y
Return boolean array with values true where satisfied, or false otherwise.- Parameters:
x
- Input array (NDARRAY type)y
- Double value argument to use in operation- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
gt
public 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.- Parameters:
name
- name May be null. Name for the output variablex
- Input array (NDARRAY type)y
- Double value argument to use in operation- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
gt
public SDVariable gt(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.- Parameters:
x
- Input 1 (NDARRAY type)y
- Input 2 (NDARRAY type)- Returns:
- output Output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
gt
public 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.- Parameters:
name
- name May be null. Name for the output variablex
- Input 1 (NDARRAY type)y
- Input 2 (NDARRAY type)- Returns:
- output Output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
gte
public SDVariable gte(SDVariable x, double y)
Greater than or equals operation: elementwise x >= y
Return boolean array with values true where satisfied, or false otherwise.- Parameters:
x
- Input array (NDARRAY type)y
- Double value argument to use in operation- Returns:
- output Output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
gte
public 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.- Parameters:
name
- name May be null. Name for the output variablex
- Input array (NDARRAY type)y
- Double value argument to use in operation- Returns:
- output Output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
gte
public SDVariable gte(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]
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.- Parameters:
x
- Input 1 (NDARRAY type)y
- Input 2 (NDARRAY type)- Returns:
- output (NDARRAY type)
-
gte
public 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]
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.- Parameters:
name
- name May be null. Name for the output variablex
- Input 1 (NDARRAY type)y
- Input 2 (NDARRAY type)- Returns:
- output (NDARRAY type)
-
identity
public SDVariable identity(SDVariable input)
Elementwise identity operation: out = x- Parameters:
input
- Input variable (NDARRAY type)- Returns:
- output Output variable (NDARRAY type)
-
identity
public SDVariable identity(String name, SDVariable input)
Elementwise identity operation: out = x- Parameters:
name
- name May be null. Name for the output variableinput
- Input variable (NDARRAY type)- Returns:
- output Output variable (NDARRAY type)
-
invertPermutation
public SDVariable invertPermutation(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- Parameters:
input
- 1D indices for permutation (INT type)- Returns:
- output 1D inverted permutation (INT type)
-
invertPermutation
public 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- Parameters:
name
- name May be null. Name for the output variableinput
- 1D indices for permutation (INT type)- Returns:
- output 1D inverted permutation (INT type)
-
isNumericTensor
public SDVariable isNumericTensor(SDVariable x)
Is the director a numeric tensor? In the current version of ND4J/SameDiff, this always returns true/1- Parameters:
x
- Input variable (NUMERIC type)- Returns:
- output scalar boolean with value true or false (NDARRAY type)
-
isNumericTensor
public SDVariable isNumericTensor(String name, SDVariable x)
Is the director a numeric tensor? In the current version of ND4J/SameDiff, this always returns true/1- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)- Returns:
- output scalar boolean with value true or false (NDARRAY type)
-
linspace
public SDVariable linspace(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]- Parameters:
dataType
- Data type of the output arraystart
- Start valuestop
- Stop valuenumber
- Number of values to generate- Returns:
- output INDArray with linearly spaced elements (NUMERIC type)
-
linspace
public 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]- Parameters:
name
- name May be null. Name for the output variabledataType
- Data type of the output arraystart
- Start valuestop
- Stop valuenumber
- Number of values to generate- Returns:
- output INDArray with linearly spaced elements (NUMERIC type)
-
linspace
public SDVariable linspace(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]- Parameters:
start
- Start value (NUMERIC type)stop
- Stop value (NUMERIC type)number
- Number of values to generate (LONG type)dataType
- Data type of the output array- Returns:
- output INDArray with linearly spaced elements (NUMERIC type)
-
linspace
public 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]- Parameters:
name
- name May be null. Name for the output variablestart
- Start value (NUMERIC type)stop
- Stop value (NUMERIC type)number
- Number of values to generate (LONG type)dataType
- Data type of the output array- Returns:
- output INDArray with linearly spaced elements (NUMERIC type)
-
lt
public SDVariable lt(SDVariable x, double y)
Less than operation: elementwise x < y
Return boolean array with values true where satisfied, or false otherwise.- Parameters:
x
- Input array (NDARRAY type)y
- Double value argument to use in operation- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
lt
public 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.- Parameters:
name
- name May be null. Name for the output variablex
- Input array (NDARRAY type)y
- Double value argument to use in operation- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
lt
public SDVariable lt(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]
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.- Parameters:
x
- Input 1 (NDARRAY type)y
- Input 2 (NDARRAY type)- Returns:
- output Output Boolean array out, with values true/false based on where the condition is satisfied (NDARRAY type)
-
lt
public 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]
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.- Parameters:
name
- name May be null. Name for the output variablex
- Input 1 (NDARRAY type)y
- Input 2 (NDARRAY type)- Returns:
- output Output Boolean array out, with values true/false based on where the condition is satisfied (NDARRAY type)
-
lte
public SDVariable lte(SDVariable x, double y)
Less than or equals operation: elementwise x <= y
Return boolean array with values true where satisfied, or false otherwise.- Parameters:
x
- Input array (NDARRAY type)y
- Double value argument to use in operation- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
lte
public 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.- Parameters:
name
- name May be null. Name for the output variablex
- Input array (NDARRAY type)y
- Double value argument to use in operation- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
lte
public SDVariable lte(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]
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.- Parameters:
x
- Input 1 (NUMERIC type)y
- Input 2 (NUMERIC type)- Returns:
- output Output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
lte
public 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]
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.- Parameters:
name
- name May be null. Name for the output variablex
- Input 1 (NUMERIC type)y
- Input 2 (NUMERIC type)- Returns:
- output Output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
matchCondition
public SDVariable matchCondition(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- Parameters:
in
- Input (NUMERIC type)condition
- Condition- Returns:
- output Boolean mask (NUMERIC type)
-
matchCondition
public 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- Parameters:
name
- name May be null. Name for the output variablein
- Input (NUMERIC type)condition
- Condition- Returns:
- output Boolean mask (NUMERIC type)
-
matchConditionCount
public SDVariable matchConditionCount(SDVariable in, Condition condition)
Returns a count of the number of elements that satisfy the condition- Parameters:
in
- Input (NUMERIC type)condition
- Condition- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
matchConditionCount
public SDVariable matchConditionCount(String name, SDVariable in, Condition condition)
Returns a count of the number of elements that satisfy the condition- Parameters:
name
- name May be null. Name for the output variablein
- Input (NUMERIC type)condition
- Condition- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
matchConditionCount
public SDVariable matchConditionCount(SDVariable in, Condition condition, boolean keepDim, 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]- Parameters:
in
- Input variable (NUMERIC type)condition
- ConditionkeepDim
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
matchConditionCount
public SDVariable matchConditionCount(String name, SDVariable in, Condition condition, boolean keepDim, 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]- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)condition
- ConditionkeepDim
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
matchConditionCount
public SDVariable matchConditionCount(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]- Parameters:
in
- Input variable (NUMERIC type)condition
- Conditiondimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
matchConditionCount
public 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]- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)condition
- Conditiondimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
max
public SDVariable max(SDVariable x, boolean keepDims, 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,
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:
x
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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)
-
max
public SDVariable max(String name, SDVariable x, boolean keepDims, 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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)
-
max
public SDVariable max(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,
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:
x
- 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)
-
max
public 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,
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:
name
- name May be null. Name for the output variablex
- 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)
-
max
public SDVariable max(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]
Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html- Parameters:
first
- First input array (NUMERIC type)second
- Second input array (NUMERIC type)- Returns:
- output Output variable (NUMERIC type)
-
max
public 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]
Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html- Parameters:
name
- name May be null. Name for the output variablefirst
- First input array (NUMERIC type)second
- Second input array (NUMERIC type)- Returns:
- output Output variable (NUMERIC type)
-
mean
public SDVariable mean(SDVariable x, boolean keepDims, 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,
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:
x
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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 SDVariable mean(String name, SDVariable x, boolean keepDims, 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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 SDVariable mean(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,
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:
x
- 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 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,
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:
name
- name May be null. Name for the output variablex
- 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 SDVariable mean(SDVariable x, SDVariable dimensions, boolean keepDims)
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,
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:
x
- Input variable (NUMERIC type)dimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (INT type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions- Returns:
- output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
-
mean
public SDVariable mean(String name, SDVariable x, SDVariable dimensions, boolean keepDims)
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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)dimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (INT type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions- Returns:
- output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
-
mean
public SDVariable mean(SDVariable x, SDVariable 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,
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:
x
- Input variable (NUMERIC type)dimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (INT type)- Returns:
- output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
-
mean
public SDVariable mean(String name, SDVariable x, SDVariable 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)dimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (INT type)- Returns:
- output Reduced array of rank (input rank - num dimensions) (NUMERIC type)
-
merge
public SDVariable merge(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)- Parameters:
x
- Input variable (NDARRAY type)y
- Input variable (NDARRAY type)- Returns:
- output Output (NDARRAY type)
-
merge
public 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)- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY type)y
- Input variable (NDARRAY type)- Returns:
- output Output (NDARRAY type)
-
min
public SDVariable min(SDVariable x, boolean keepDims, 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,
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:
x
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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)
-
min
public SDVariable min(String name, SDVariable x, boolean keepDims, 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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)
-
min
public SDVariable min(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,
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:
x
- 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)
-
min
public 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,
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:
name
- name May be null. Name for the output variablex
- 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)
-
min
public SDVariable min(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]
Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html- Parameters:
first
- First input array (NUMERIC type)second
- Second input array (NUMERIC type)- Returns:
- output Second input array (NUMERIC type)
-
min
public 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]
Broadcast rules are the same as NumPy: https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html- Parameters:
name
- name May be null. Name for the output variablefirst
- First input array (NUMERIC type)second
- Second input array (NUMERIC type)- Returns:
- output Second input array (NUMERIC type)
-
minMax
public SDVariable minMax(int datatype, int minOrMax)
Return a scalar array reflecting the min or max value for a given data type.- Parameters:
datatype
- The input target data type represented as an intminOrMax
- The min or max (0 or 1) value to return- Returns:
- output Output array (after casting) (NDARRAY type)
-
minMax
public SDVariable minMax(String name, int datatype, int minOrMax)
Return a scalar array reflecting the min or max value for a given data type.- Parameters:
name
- name May be null. Name for the output variabledatatype
- The input target data type represented as an intminOrMax
- The min or max (0 or 1) value to return- Returns:
- output Output array (after casting) (NDARRAY type)
-
mmul
public SDVariable mmul(SDVariable x, SDVariable y, boolean transposeX, boolean transposeY, boolean transposeZ)
Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.- Parameters:
x
- First input variable (NUMERIC type)y
- Second input variable (NUMERIC type)transposeX
- Transpose x (first argument)transposeY
- Transpose y (second argument)transposeZ
- Transpose result array- Returns:
- output (NUMERIC type)
-
mmul
public SDVariable mmul(String name, SDVariable x, SDVariable y, boolean transposeX, boolean transposeY, boolean transposeZ)
Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.- Parameters:
name
- name May be null. Name for the output variablex
- First input variable (NUMERIC type)y
- Second input variable (NUMERIC type)transposeX
- Transpose x (first argument)transposeY
- Transpose y (second argument)transposeZ
- Transpose result array- Returns:
- output (NUMERIC type)
-
mmul
public SDVariable mmul(SDVariable x, SDVariable y)
Matrix multiplication: out = mmul(x,y)
Supports specifying transpose argument to perform operation such as mmul(a^T, b), etc.- Parameters:
x
- First input variable (NUMERIC type)y
- Second input variable (NUMERIC type)- Returns:
- output (NUMERIC type)
-
mmul
public 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.- Parameters:
name
- name May be null. Name for the output variablex
- First input variable (NUMERIC type)y
- Second input variable (NUMERIC type)- Returns:
- output (NUMERIC type)
-
neq
public SDVariable neq(SDVariable x, double y)
Not equals operation: elementwise x != y
Return boolean array with values true where satisfied, or false otherwise.- Parameters:
x
- Input array (NDARRAY type)y
- Double value argument to use in operation- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
neq
public 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.- Parameters:
name
- name May be null. Name for the output variablex
- Input array (NDARRAY type)y
- Double value argument to use in operation- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NUMERIC type)
-
neq
public SDVariable neq(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]
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.- Parameters:
x
- Input 1 (NDARRAY type)y
- Input 2 (NDARRAY type)- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NDARRAY type)
-
neq
public 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]
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.- Parameters:
name
- name May be null. Name for the output variablex
- Input 1 (NDARRAY type)y
- Input 2 (NDARRAY type)- Returns:
- output Boolean array out, with values true/false based on where the condition is satisfied (NDARRAY type)
-
norm1
public SDVariable norm1(SDVariable x, boolean keepDims, 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,
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:
x
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
norm1
public SDVariable norm1(String name, SDVariable x, boolean keepDims, 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
norm1
public SDVariable norm1(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,
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:
x
- Input variable (NUMERIC type)dimensions
- dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
norm1
public 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)dimensions
- dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
norm2
public SDVariable norm2(SDVariable x, boolean keepDims, 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,
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:
x
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
norm2
public SDVariable norm2(String name, SDVariable x, boolean keepDims, 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
norm2
public SDVariable norm2(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,
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:
x
- Input variable (NUMERIC type)dimensions
- dimensions dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
norm2
public 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)dimensions
- dimensions dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
normmax
public SDVariable normmax(SDVariable x, boolean keepDims, 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,
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:
x
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
normmax
public SDVariable normmax(String name, SDVariable x, boolean keepDims, 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
normmax
public SDVariable normmax(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,
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:
x
- Input variable (NUMERIC type)dimensions
- dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
normmax
public 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)dimensions
- dimensions to reduce over (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
oneHot
public SDVariable oneHot(SDVariable indices, int depth, int axis, double on, double off, DataType dataType)
Convert the array to a one-hot array with values 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- Parameters:
indices
- Indices - value 0 to depth-1 (NUMERIC type)depth
- Number of classesaxis
-on
-off
-dataType
- Output data type- Returns:
- output Output variable (NUMERIC type)
-
oneHot
public SDVariable oneHot(String name, SDVariable indices, int depth, int axis, double on, double off, DataType dataType)
Convert the array to a one-hot array with values 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- Parameters:
name
- name May be null. Name for the output variableindices
- Indices - value 0 to depth-1 (NUMERIC type)depth
- Number of classesaxis
-on
-off
-dataType
- Output data type- Returns:
- output Output variable (NUMERIC type)
-
oneHot
public SDVariable oneHot(SDVariable indices, int depth, int axis, double on, double off)
Convert the array to a one-hot array with values 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- Parameters:
indices
- Indices - value 0 to depth-1 (NUMERIC type)depth
- Number of classesaxis
-on
-off
-- Returns:
- output Output variable (NUMERIC type)
-
oneHot
public SDVariable oneHot(String name, SDVariable indices, int depth, int axis, double on, double off)
Convert the array to a one-hot array with values 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- Parameters:
name
- name May be null. Name for the output variableindices
- Indices - value 0 to depth-1 (NUMERIC type)depth
- Number of classesaxis
-on
-off
-- Returns:
- output Output variable (NUMERIC type)
-
oneHot
public SDVariable oneHot(SDVariable indices, int depth)
Convert the array to a one-hot array with values 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)- Parameters:
indices
- Indices - value 0 to depth-1 (NUMERIC type)depth
- Number of classes- Returns:
- output Output variable (NUMERIC type)
-
oneHot
public SDVariable oneHot(String name, SDVariable indices, int depth)
Convert the array to a one-hot array with values 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)- Parameters:
name
- name May be null. Name for the output variableindices
- Indices - value 0 to depth-1 (NUMERIC type)depth
- Number of classes- Returns:
- output Output variable (NUMERIC type)
-
onesLike
public SDVariable onesLike(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- Parameters:
input
- Input INDArray (NDARRAY type)- Returns:
- output A new INDArray with the same (dynamic) shape as the input (NUMERIC type)
-
onesLike
public 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- Parameters:
name
- name May be null. Name for the output variableinput
- Input INDArray (NDARRAY type)- Returns:
- output A new INDArray with the same (dynamic) shape as the input (NUMERIC type)
-
onesLike
public SDVariable onesLike(SDVariable input, DataType dataType)
As per onesLike(String, SDVariable) but the output datatype may be specified- Parameters:
input
- (NDARRAY type)dataType
-- Returns:
- output (NUMERIC type)
-
onesLike
public SDVariable onesLike(String name, SDVariable input, DataType dataType)
As per onesLike(String, SDVariable) but the output datatype may be specified- Parameters:
name
- name May be null. Name for the output variableinput
- (NDARRAY type)dataType
-- Returns:
- output (NUMERIC type)
-
permute
public SDVariable permute(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]- Parameters:
x
- Input variable (NDARRAY type)dimensions
- Permute dimensions (INT type)- Returns:
- output Output variable (permuted input) (NUMERIC type)
-
permute
public 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]- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY type)dimensions
- Permute dimensions (INT type)- Returns:
- output Output variable (permuted input) (NUMERIC type)
-
permute
public SDVariable permute(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]- Parameters:
x
- Input variable (NDARRAY type)dimensions
- (Size: AtLeast(min=0))- Returns:
- output Output variable (permuted input) (NUMERIC type)
-
permute
public 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]- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY type)dimensions
- (Size: AtLeast(min=0))- Returns:
- output Output variable (permuted input) (NUMERIC type)
-
prod
public SDVariable prod(SDVariable x, boolean keepDims, 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,
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:
x
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))- Returns:
- output (NUMERIC type)
-
prod
public SDVariable prod(String name, SDVariable x, boolean keepDims, 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (Size: AtLeast(min=0))- Returns:
- output (NUMERIC type)
-
prod
public SDVariable prod(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,
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:
x
- 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 (NUMERIC type)
-
prod
public 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,
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:
name
- name May be null. Name for the output variablex
- 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 (NUMERIC type)
-
prod
public SDVariable prod(SDVariable x, SDVariable dimensions, boolean keepDims)
Product array reduction operation, optionally along 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:
x
- Input variable (NUMERIC type)dimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (INT type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions- Returns:
- output (NUMERIC type)
-
prod
public SDVariable prod(String name, SDVariable x, SDVariable dimensions, boolean keepDims)
Product array reduction operation, optionally along 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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)dimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (INT type)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensions- Returns:
- output (NUMERIC type)
-
prod
public SDVariable prod(SDVariable x, SDVariable 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,
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:
x
- Input variable (NUMERIC type)dimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (INT type)- Returns:
- output (NUMERIC type)
-
prod
public SDVariable prod(String name, SDVariable x, SDVariable 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,
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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)dimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performed (INT type)- Returns:
- output (NUMERIC type)
-
range
public SDVariable range(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]- Parameters:
from
- Initial/smallest valueto
- Largest value (exclusive)step
- Step sizedataType
-- Returns:
- output INDArray with the specified values (NUMERIC type)
-
range
public 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]- Parameters:
name
- name May be null. Name for the output variablefrom
- Initial/smallest valueto
- Largest value (exclusive)step
- Step sizedataType
-- Returns:
- output INDArray with the specified values (NUMERIC type)
-
range
public SDVariable range(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]- Parameters:
from
- Initial/smallest value (NUMERIC type)to
- Largest value (exclusive) (NUMERIC type)step
- Step size (NUMERIC type)dataType
-- Returns:
- output INDArray with the specified values (NUMERIC type)
-
range
public 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]- Parameters:
name
- name May be null. Name for the output variablefrom
- Initial/smallest value (NUMERIC type)to
- Largest value (exclusive) (NUMERIC type)step
- Step size (NUMERIC type)dataType
-- Returns:
- output INDArray with the specified values (NUMERIC type)
-
rank
public SDVariable rank(SDVariable in)
Returns the rank (number of dimensions, i.e., length(shape)) of the specified INDArray as a 0D scalar variable- Parameters:
in
- Input variable (NDARRAY type)- Returns:
- output (scalar) output variable with value equal to the rank of the input variable (NUMERIC type)
-
rank
public 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- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NDARRAY type)- Returns:
- output (scalar) output variable with value equal to the rank of the input variable (NUMERIC type)
-
repeat
public SDVariable repeat(SDVariable input, SDVariable repeats, int axis)
A tensor with the shape of input minus the specified axis with elements repeated along the specified axis.- Parameters:
input
- Input value to repeat (NUMERIC type)repeats
- A 1d input representing the number of inputs of repeats for each element. (NUMERIC type)axis
- Data type of the output array- Returns:
- output A tensor with the shape of input minus the specified axis (NUMERIC type)
-
repeat
public SDVariable repeat(String name, SDVariable input, SDVariable repeats, int axis)
A tensor with the shape of input minus the specified axis with elements repeated along the specified axis.- Parameters:
name
- name May be null. Name for the output variableinput
- Input value to repeat (NUMERIC type)repeats
- A 1d input representing the number of inputs of repeats for each element. (NUMERIC type)axis
- Data type of the output array- Returns:
- output A tensor with the shape of input minus the specified axis (NUMERIC type)
-
replaceWhere
public SDVariable replaceWhere(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- Parameters:
update
- Source array (NUMERIC type)from
- Replacement values array (used conditionally). Must be same shape as 'update' array (NUMERIC type)condition
- Condition to check on update array elements- Returns:
- output New array with values replaced where condition is satisfied (NUMERIC type)
-
replaceWhere
public 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- Parameters:
name
- name May be null. Name for the output variableupdate
- Source array (NUMERIC type)from
- Replacement values array (used conditionally). Must be same shape as 'update' array (NUMERIC type)condition
- Condition to check on update array elements- Returns:
- output New array with values replaced where condition is satisfied (NUMERIC type)
-
replaceWhere
public SDVariable replaceWhere(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- Parameters:
update
- Source array (NUMERIC type)value
- Value to set at the output, if the condition is satisfiedcondition
- Condition to check on update array elements- Returns:
- output New array with values replaced where condition is satisfied (NUMERIC type)
-
replaceWhere
public 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- Parameters:
name
- name May be null. Name for the output variableupdate
- Source array (NUMERIC type)value
- Value to set at the output, if the condition is satisfiedcondition
- Condition to check on update array elements- Returns:
- output New array with values replaced where condition is satisfied (NUMERIC type)
-
reshape
public SDVariable reshape(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)- Parameters:
x
- Input variable (NDARRAY type)shape
- New shape for variable (NUMERIC type)- Returns:
- output Output variable (NUMERIC type)
-
reshape
public 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)- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY type)shape
- New shape for variable (NUMERIC type)- Returns:
- output Output variable (NUMERIC type)
-
reshape
public SDVariable reshape(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)- Parameters:
x
- Input variable (NDARRAY type)shape
- New shape for variable (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
reshape
public 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)- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY type)shape
- New shape for variable (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
reverse
public SDVariable reverse(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]- Parameters:
x
- Input variable (NDARRAY type)dimensions
- Input variable (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
reverse
public 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]- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY type)dimensions
- Input variable (Size: AtLeast(min=0))- Returns:
- output Output variable (NUMERIC type)
-
reverseSequence
public SDVariable reverseSequence(SDVariable x, SDVariable seq_lengths, int seqDim, int batchDim)
Reverse sequence op: for each slice along dimension seqDimension, the first seqLength values are reversed- Parameters:
x
- Input variable (NDARRAY type)seq_lengths
- Length of the sequences (INT type)seqDim
- Sequence dimensionbatchDim
- Batch dimension- Returns:
- output Reversed sequences (NUMERIC type)
-
reverseSequence
public SDVariable reverseSequence(String name, SDVariable x, SDVariable seq_lengths, int seqDim, int batchDim)
Reverse sequence op: for each slice along dimension seqDimension, the first seqLength values are reversed- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY type)seq_lengths
- Length of the sequences (INT type)seqDim
- Sequence dimensionbatchDim
- Batch dimension- Returns:
- output Reversed sequences (NUMERIC type)
-
reverseSequence
public SDVariable reverseSequence(SDVariable x, SDVariable seq_lengths)
Reverse sequence op: for each slice along dimension seqDimension, the first seqLength values are reversed- Parameters:
x
- Input variable (NDARRAY type)seq_lengths
- Length of the sequences (INT type)- Returns:
- output Reversed sequences (NUMERIC type)
-
reverseSequence
public SDVariable reverseSequence(String name, SDVariable x, SDVariable seq_lengths)
Reverse sequence op: for each slice along dimension seqDimension, the first seqLength values are reversed- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY type)seq_lengths
- Length of the sequences (INT type)- Returns:
- output Reversed sequences (NUMERIC type)
-
scalarFloorMod
public SDVariable scalarFloorMod(SDVariable in, double value)
Element-wise scalar floor modulus operation: out = floorMod(in, value).
i.e., returns the remainder after division by 'value'- Parameters:
in
- Input variable (NUMERIC type)value
- Scalar value to compare- Returns:
- output Output variable (NUMERIC type)
-
scalarFloorMod
public 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'- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)value
- Scalar value to compare- Returns:
- output Output variable (NUMERIC type)
-
scalarMax
public SDVariable scalarMax(SDVariable in, double value)
Element-wise scalar maximum operation: out = max(in, value)- Parameters:
in
- Input variable (NUMERIC type)value
- Scalar value to compare- Returns:
- output Scalar value to compare (NUMERIC type)
-
scalarMax
public SDVariable scalarMax(String name, SDVariable in, double value)
Element-wise scalar maximum operation: out = max(in, value)- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)value
- Scalar value to compare- Returns:
- output Scalar value to compare (NUMERIC type)
-
scalarMin
public SDVariable scalarMin(SDVariable in, double value)
Element-wise scalar minimum operation: out = min(in, value)- Parameters:
in
- Input variable (NUMERIC type)value
- Scalar value to compare- Returns:
- output Output variable (NUMERIC type)
-
scalarMin
public SDVariable scalarMin(String name, SDVariable in, double value)
Element-wise scalar minimum operation: out = min(in, value)- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)value
- Scalar value to compare- Returns:
- output Output variable (NUMERIC type)
-
scalarSet
public SDVariable scalarSet(SDVariable in, double set)
Return a variable with equal shape to the input, but all elements set to value 'set'- Parameters:
in
- Input variable (NUMERIC type)set
- Value to set- Returns:
- output Output variable (NUMERIC type)
-
scalarSet
public SDVariable scalarSet(String name, SDVariable in, double set)
Return a variable with equal shape to the input, but all elements set to value 'set'- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NUMERIC type)set
- Value to set- Returns:
- output Output variable (NUMERIC type)
-
scatterAdd
public SDVariable scatterAdd(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.- Parameters:
ref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterAdd
public 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.- Parameters:
name
- name May be null. Name for the output variableref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterDiv
public SDVariable scatterDiv(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.- Parameters:
ref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterDiv
public 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.- Parameters:
name
- name May be null. Name for the output variableref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterMax
public SDVariable scatterMax(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.- Parameters:
ref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterMax
public 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.- Parameters:
name
- name May be null. Name for the output variableref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterMin
public SDVariable scatterMin(SDVariable ref, SDVariable indices, SDVariable updates)
Scatter min 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.- Parameters:
ref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterMin
public 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[...])
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.- Parameters:
name
- name May be null. Name for the output variableref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterMul
public SDVariable scatterMul(SDVariable ref, SDVariable indices, SDVariable updates)
Scatter multiplication 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.- Parameters:
ref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterMul
public 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[...])
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.- Parameters:
name
- name May be null. Name for the output variableref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterSub
public SDVariable scatterSub(SDVariable ref, SDVariable indices, SDVariable updates)
Scatter subtraction 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.- Parameters:
ref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterSub
public 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[...])
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.- Parameters:
name
- name May be null. Name for the output variableref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterUpdate
public SDVariable scatterUpdate(SDVariable ref, SDVariable indices, SDVariable updates)
Scatter update 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.- Parameters:
ref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
scatterUpdate
public 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[...])
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.- Parameters:
name
- name May be null. Name for the output variableref
- Initial/source variable (NUMERIC type)indices
- Indices array (NUMERIC type)updates
- Updates to add to the initial/source array (NUMERIC type)- Returns:
- output The updated variable (NUMERIC type)
-
segmentMax
public SDVariable segmentMax(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- Parameters:
data
- Data to perform segment max on (NDARRAY type)segmentIds
- Variable for the segment IDs (NUMERIC type)- Returns:
- output Segment output (NUMERIC type)
-
segmentMax
public 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- Parameters:
name
- name May be null. Name for the output variabledata
- Data to perform segment max on (NDARRAY type)segmentIds
- Variable for the segment IDs (NUMERIC type)- Returns:
- output Segment output (NUMERIC type)
-
segmentMean
public SDVariable segmentMean(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- Parameters:
data
- Data to perform segment max on (NDARRAY type)segmentIds
- Variable for the segment IDs (NUMERIC type)- Returns:
- output Segment output (NUMERIC type)
-
segmentMean
public 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- Parameters:
name
- name May be null. Name for the output variabledata
- Data to perform segment max on (NDARRAY type)segmentIds
- Variable for the segment IDs (NUMERIC type)- Returns:
- output Segment output (NUMERIC type)
-
segmentMin
public SDVariable segmentMin(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- Parameters:
data
- Data to perform segment max on (NDARRAY type)segmentIds
- Variable for the segment IDs (NUMERIC type)- Returns:
- output Segment output (NUMERIC type)
-
segmentMin
public 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- Parameters:
name
- name May be null. Name for the output variabledata
- Data to perform segment max on (NDARRAY type)segmentIds
- Variable for the segment IDs (NUMERIC type)- Returns:
- output Segment output (NUMERIC type)
-
segmentProd
public SDVariable segmentProd(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- Parameters:
data
- Data to perform segment max on (NDARRAY type)segmentIds
- Variable for the segment IDs (NUMERIC type)- Returns:
- output Segment output (NUMERIC type)
-
segmentProd
public 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- Parameters:
name
- name May be null. Name for the output variabledata
- Data to perform segment max on (NDARRAY type)segmentIds
- Variable for the segment IDs (NUMERIC type)- Returns:
- output Segment output (NUMERIC type)
-
segmentSum
public SDVariable segmentSum(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- Parameters:
data
- Data to perform segment max on (NDARRAY type)segmentIds
- Variable for the segment IDs (NUMERIC type)- Returns:
- output Segment output (NUMERIC type)
-
segmentSum
public 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- Parameters:
name
- name May be null. Name for the output variabledata
- Data to perform segment max on (NDARRAY type)segmentIds
- Variable for the segment IDs (NUMERIC type)- Returns:
- output Segment output (NUMERIC type)
-
sequenceMask
public SDVariable sequenceMask(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)- Parameters:
lengths
- Lengths of the sequences (NUMERIC type)maxLen
- Maximum sequence lengthdataType
-- Returns:
- output Output variable (NUMERIC type)
-
sequenceMask
public 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)- Parameters:
name
- name May be null. Name for the output variablelengths
- Lengths of the sequences (NUMERIC type)maxLen
- Maximum sequence lengthdataType
-- Returns:
- output Output variable (NUMERIC type)
-
sequenceMask
public SDVariable sequenceMask(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)- Parameters:
lengths
- Lengths of the sequences (NUMERIC type)maxLen
- Maximum sequence length (INT type)dataType
-- Returns:
- output Output variable (NUMERIC type)
-
sequenceMask
public 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)- Parameters:
name
- name May be null. Name for the output variablelengths
- Lengths of the sequences (NUMERIC type)maxLen
- Maximum sequence length (INT type)dataType
-- Returns:
- output Output variable (NUMERIC type)
-
sequenceMask
public SDVariable sequenceMask(SDVariable lengths, DataType dataType)
see sequenceMask(String, SDVariable, SDVariable, DataType)- Parameters:
lengths
- (NUMERIC type)dataType
-- Returns:
- output (NUMERIC type)
-
sequenceMask
public SDVariable sequenceMask(String name, SDVariable lengths, DataType dataType)
see sequenceMask(String, SDVariable, SDVariable, DataType)- Parameters:
name
- name May be null. Name for the output variablelengths
- (NUMERIC type)dataType
-- Returns:
- output (NUMERIC type)
-
setShape
public SDVariable[] setShape(SDVariable input, SDVariable shape)
Sets an inplace shape on the passed in input.- Parameters:
input
- The input to set the shape of (NUMERIC type)shape
- The shape to set the input to (NUMERIC type)
-
setShape
public SDVariable[] setShape(String[] names, SDVariable input, SDVariable shape)
Sets an inplace shape on the passed in input.- Parameters:
names
- names May be null. Arrays of names for the output variables.input
- The input to set the shape of (NUMERIC type)shape
- The shape to set the input to (NUMERIC type)
-
shape
public SDVariable shape(SDVariable input)
Returns the shape of the specified INDArray as a 1D INDArray- Parameters:
input
- Input variable (NDARRAY type)- Returns:
- output 1D output variable with contents equal to the shape of the input (NUMERIC type)
-
shape
public SDVariable shape(String name, SDVariable input)
Returns the shape of the specified INDArray as a 1D INDArray- Parameters:
name
- name May be null. Name for the output variableinput
- Input variable (NDARRAY type)- Returns:
- output 1D output variable with contents equal to the shape of the input (NUMERIC type)
-
size
public SDVariable size(SDVariable in)
Returns the size (number of elements, i.e., prod(shape)) of the specified INDArray as a 0D scalar variable- Parameters:
in
- Input variable (NDARRAY type)- Returns:
- output 0D (scalar) output variable with value equal to the number of elements in the specified array (NUMERIC type)
-
size
public 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- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NDARRAY type)- Returns:
- output 0D (scalar) output variable with value equal to the number of elements in the specified array (NUMERIC type)
-
sizeAt
public SDVariable sizeAt(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- Parameters:
in
- Input variable (NDARRAY type)dimension
- Dimension to get size of- Returns:
- output Scalar INDArray for size at specified variable (NUMERIC type)
-
sizeAt
public 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- Parameters:
name
- name May be null. Name for the output variablein
- Input variable (NDARRAY type)dimension
- Dimension to get size of- Returns:
- output Scalar INDArray for size at specified variable (NUMERIC type)
-
slice
public SDVariable slice(SDVariable input, int[] begin, int... size)
Get a subset of the specified input, by specifying the first element and the size of the array.
For example, if input is:
[a, b, c]
[d, e, f]
then slice(input, begin=[0,1], size=[2,1] will return:
[b]
[e]
Note that for each dimension i, begin[i] + size[i] <= input.size(i)- Parameters:
input
- input Variable to get subset of (NDARRAY type)begin
- Beginning index. Must be same length as rank of input array (Size: AtLeast(min=1))size
- Size of the output array. Must be same length as rank of input array (Size: AtLeast(min=1))- Returns:
- output Subset of the input (NUMERIC type)
-
slice
public SDVariable slice(String name, SDVariable input, int[] begin, int... size)
Get a subset of the specified input, by specifying the first element and the size of the array.
For example, if input is:
[a, b, c]
[d, e, f]
then slice(input, begin=[0,1], size=[2,1] will return:
[b]
[e]
Note that for each dimension i, begin[i] + size[i] <= input.size(i)- Parameters:
name
- name May be null. Name for the output variableinput
- input Variable to get subset of (NDARRAY type)begin
- Beginning index. Must be same length as rank of input array (Size: AtLeast(min=1))size
- Size of the output array. Must be same length as rank of input array (Size: AtLeast(min=1))- Returns:
- output Subset of the input (NUMERIC type)
-
slice
public SDVariable slice(SDVariable input, SDVariable begin, SDVariable size)
Get a subset of the specified input, by specifying the first element and the size of the array.
For example, if input is:
[a, b, c]
[d, e, f]
then slice(input, begin=[0,1], size=[2,1] will return:
[b]
[e]
Note that for each dimension i, begin[i] + size[i] <= input.size(i)- Parameters:
input
- input Variable to get subset of (NDARRAY type)begin
- Beginning index. Must be same length as rank of input array (INT type)size
- Size of the output array. Must be same length as rank of input array (INT type)- Returns:
- output Subset of the input (NUMERIC type)
-
slice
public SDVariable slice(String name, SDVariable input, SDVariable begin, SDVariable size)
Get a subset of the specified input, by specifying the first element and the size of the array.
For example, if input is:
[a, b, c]
[d, e, f]
then slice(input, begin=[0,1], size=[2,1] will return:
[b]
[e]
Note that for each dimension i, begin[i] + size[i] <= input.size(i)- Parameters:
name
- name May be null. Name for the output variableinput
- input Variable to get subset of (NDARRAY type)begin
- Beginning index. Must be same length as rank of input array (INT type)size
- Size of the output array. Must be same length as rank of input array (INT type)- Returns:
- output Subset of the input (NUMERIC type)
-
sparseToDense
public SDVariable sparseToDense(SDVariable indices, SDVariable shape, SDVariable values)
Create a dense matrix equivalent of a sparse matrix based on the given input.- Parameters:
indices
- The indices of the sparse matrix (NUMERIC type)shape
- The output shape (NUMERIC type)values
- The values for the array (NUMERIC type)- Returns:
- output Populated dense INDArray with given values and indices (NUMERIC type)
-
sparseToDense
public SDVariable sparseToDense(String name, SDVariable indices, SDVariable shape, SDVariable values)
Create a dense matrix equivalent of a sparse matrix based on the given input.- Parameters:
name
- name May be null. Name for the output variableindices
- The indices of the sparse matrix (NUMERIC type)shape
- The output shape (NUMERIC type)values
- The values for the array (NUMERIC type)- Returns:
- output Populated dense INDArray with given values and indices (NUMERIC type)
-
sparseToDense
public SDVariable sparseToDense(SDVariable indices, SDVariable shape, SDVariable values, SDVariable defaultValue)
Create a dense matrix equivalent of a sparse matrix based on the given input.- Parameters:
indices
- The indices of the sparse matrix (NUMERIC type)shape
- The output shape (NUMERIC type)values
- The values for the array (NUMERIC type)defaultValue
- Default value (NUMERIC type)- Returns:
- output Populated dense INDArray with given values and indices (NUMERIC type)
-
sparseToDense
public SDVariable sparseToDense(String name, SDVariable indices, SDVariable shape, SDVariable values, SDVariable defaultValue)
Create a dense matrix equivalent of a sparse matrix based on the given input.- Parameters:
name
- name May be null. Name for the output variableindices
- The indices of the sparse matrix (NUMERIC type)shape
- The output shape (NUMERIC type)values
- The values for the array (NUMERIC type)defaultValue
- Default value (NUMERIC type)- Returns:
- output Populated dense INDArray with given values and indices (NUMERIC type)
-
split
public SDVariable[] split(SDVariable input, int numSplit, int splitDim)
Split a value in to a list of ndarrays.- Parameters:
input
- Input to split (NDARRAY type)numSplit
- Number of splitssplitDim
- The dimension to split on
-
split
public SDVariable[] split(String[] names, SDVariable input, int numSplit, int splitDim)
Split a value in to a list of ndarrays.- Parameters:
names
- names May be null. Arrays of names for the output variables.input
- Input to split (NDARRAY type)numSplit
- Number of splitssplitDim
- The dimension to split on
-
split
public SDVariable[] split(SDVariable input, SDVariable numSplit, int splitDim)
Split a value in to a list of ndarrays.- Parameters:
input
- Input to split (NUMERIC type)numSplit
- Number of splits (NUMERIC type)splitDim
- The dimension to split on
-
split
public SDVariable[] split(String[] names, SDVariable input, SDVariable numSplit, int splitDim)
Split a value in to a list of ndarrays.- Parameters:
names
- names May be null. Arrays of names for the output variables.input
- Input to split (NUMERIC type)numSplit
- Number of splits (NUMERIC type)splitDim
- The dimension to split on
-
splitV
public SDVariable[] splitV(SDVariable input, SDVariable sizes, int numSplit, int splitDim)
Split a value in to a list of ndarrays with varying sizes
according to the sizes parameter.- Parameters:
input
- Input to split (NDARRAY type)sizes
- The sizes to split by (NDARRAY type)numSplit
- Number of splitssplitDim
- The dimension to split on
-
splitV
public SDVariable[] splitV(String[] names, SDVariable input, SDVariable sizes, int numSplit, int splitDim)
Split a value in to a list of ndarrays with varying sizes
according to the sizes parameter.- Parameters:
names
- names May be null. Arrays of names for the output variables.input
- Input to split (NDARRAY type)sizes
- The sizes to split by (NDARRAY type)numSplit
- Number of splitssplitDim
- The dimension to split on
-
squaredNorm
public SDVariable squaredNorm(SDVariable x, boolean keepDims, int... dimensions)
Squared L2 norm: see norm2(String, SDVariable, boolean, int...)
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:
x
- (NUMERIC type)keepDims
-dimensions
- (Size: AtLeast(min=0))- Returns:
- output (NUMERIC type)
-
squaredNorm
public SDVariable squaredNorm(String name, SDVariable x, boolean keepDims, int... dimensions)
Squared L2 norm: see norm2(String, SDVariable, boolean, int...)
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:
name
- name May be null. Name for the output variablex
- (NUMERIC type)keepDims
-dimensions
- (Size: AtLeast(min=0))- Returns:
- output (NUMERIC type)
-
squaredNorm
public SDVariable squaredNorm(SDVariable x, int... dimensions)
Squared L2 norm: see norm2(String, SDVariable, boolean, int...)
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:
x
- (NUMERIC type)dimensions
- (Size: AtLeast(min=0))- Returns:
- output (NUMERIC type)
-
squaredNorm
public SDVariable squaredNorm(String name, SDVariable x, int... dimensions)
Squared L2 norm: see norm2(String, SDVariable, boolean, int...)
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:
name
- name May be null. Name for the output variablex
- (NUMERIC type)dimensions
- (Size: AtLeast(min=0))- Returns:
- output (NUMERIC type)
-
squeeze
public SDVariable squeeze(SDVariable x, int axis)
Remove a single dimension of size 1.
For example, if input has shape [a,b,1,c] then squeeze(input, 2) returns an array of shape [a,b,c]- Parameters:
x
- Input variable (NUMERIC type)axis
- Size 1 dimension to remove- Returns:
- output Output variable (NUMERIC type)
-
squeeze
public SDVariable squeeze(String name, SDVariable x, int axis)
Remove a single dimension of size 1.
For example, if input has shape [a,b,1,c] then squeeze(input, 2) returns an array of shape [a,b,c]- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)axis
- Size 1 dimension to remove- Returns:
- output Output variable (NUMERIC type)
-
stack
public SDVariable stack(int axis, SDVariable... values)
Stack a set of N INDArray of rank X into one rank X+1 variable.
If inputs have shape [a,b,c] then output has shape:
axis = 0: [N,a,b,c]
axis = 1: [a,N,b,c]
axis = 2: [a,b,N,c]
axis = 3: [a,b,c,N]
see unstack(String[], SDVariable, int, int)- Parameters:
values
- Input variables to stack. Must have the same shape for all inputs (NDARRAY type)axis
- Axis to stack on- Returns:
- output Output variable (NDARRAY type)
-
stack
public SDVariable stack(String name, int axis, SDVariable... values)
Stack a set of N INDArray of rank X into one rank X+1 variable.
If inputs have shape [a,b,c] then output has shape:
axis = 0: [N,a,b,c]
axis = 1: [a,N,b,c]
axis = 2: [a,b,N,c]
axis = 3: [a,b,c,N]
see unstack(String[], SDVariable, int, int)- Parameters:
name
- name May be null. Name for the output variableaxis
- Axis to stack onvalues
- Input variables to stack. Must have the same shape for all inputs (NDARRAY type)- Returns:
- output Output variable (NDARRAY type)
-
standardDeviation
public SDVariable standardDeviation(SDVariable x, boolean biasCorrected, boolean keepDims, int... dimensions)
Standard deviation array reduction operation, optionally along 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:
x
- Input variable (NUMERIC type)biasCorrected
- If true: divide by (N-1) (i.e., sample stdev). If false: divide by N (population stdev)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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)
-
standardDeviation
public SDVariable standardDeviation(String name, SDVariable x, boolean biasCorrected, boolean keepDims, int... dimensions)
Standard deviation array reduction operation, optionally along 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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)biasCorrected
- If true: divide by (N-1) (i.e., sample stdev). If false: divide by N (population stdev)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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)
-
standardDeviation
public SDVariable standardDeviation(SDVariable x, boolean biasCorrected, int... dimensions)
Standard deviation array reduction operation, optionally along 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:
x
- Input variable (NUMERIC type)biasCorrected
- If true: divide by (N-1) (i.e., sample stdev). If false: divide by N (population stdev)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)
-
standardDeviation
public SDVariable standardDeviation(String name, SDVariable x, boolean biasCorrected, int... dimensions)
Standard deviation array reduction operation, optionally along 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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)biasCorrected
- If true: divide by (N-1) (i.e., sample stdev). If false: divide by N (population stdev)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)
-
stridedSlice
public SDVariable stridedSlice(SDVariable in, long[] begin, long[] end, long[] strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]- Parameters:
in
- Variable to get subset of (NDARRAY type)begin
- Beginning index (Size: AtLeast(min=1))end
- End index (Size: AtLeast(min=1))strides
- Stride ("step size") for each dimension. For example, stride of 2 means take every second element. (Size: AtLeast(min=1))beginMask
- Bit mask: If the ith bit is set to 1, then the value in the begin long[] is ignored, and a value of 0 is used instead for the beginning index for that dimensionendMask
- Bit mask: If the ith bit is set to 1, then the value in the end long[] is ignored, and a value of size(i)-1 is used instead for the end index for that dimensionellipsisMask
- Bit mask: only one non-zero value is allowed here. If a non-zero value is set, then other dimensions are inserted as required at the specified positionnewAxisMask
- Bit mask: if the ith bit is set to 1, then the begin/end/stride values are ignored, and a size 1 dimension is inserted at this pointshrinkAxisMask
- Bit mask: if the ith bit is set to 1, then the begin/end/stride values are ignored, and a size 1 dimension is removed at this point. Note that begin/end/stride values must result in a size 1 output for these dimensions- Returns:
- output A subset of the input array (NUMERIC type)
-
stridedSlice
public SDVariable stridedSlice(String name, SDVariable in, long[] begin, long[] end, long[] strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]- Parameters:
name
- name May be null. Name for the output variablein
- Variable to get subset of (NDARRAY type)begin
- Beginning index (Size: AtLeast(min=1))end
- End index (Size: AtLeast(min=1))strides
- Stride ("step size") for each dimension. For example, stride of 2 means take every second element. (Size: AtLeast(min=1))beginMask
- Bit mask: If the ith bit is set to 1, then the value in the begin long[] is ignored, and a value of 0 is used instead for the beginning index for that dimensionendMask
- Bit mask: If the ith bit is set to 1, then the value in the end long[] is ignored, and a value of size(i)-1 is used instead for the end index for that dimensionellipsisMask
- Bit mask: only one non-zero value is allowed here. If a non-zero value is set, then other dimensions are inserted as required at the specified positionnewAxisMask
- Bit mask: if the ith bit is set to 1, then the begin/end/stride values are ignored, and a size 1 dimension is inserted at this pointshrinkAxisMask
- Bit mask: if the ith bit is set to 1, then the begin/end/stride values are ignored, and a size 1 dimension is removed at this point. Note that begin/end/stride values must result in a size 1 output for these dimensions- Returns:
- output A subset of the input array (NUMERIC type)
-
stridedSlice
public SDVariable stridedSlice(SDVariable in, long[] begin, long[] end, long... strides)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]- Parameters:
in
- Variable to get subset of (NDARRAY type)begin
- Beginning index (Size: AtLeast(min=1))end
- End index (Size: AtLeast(min=1))strides
- Stride ("step size") for each dimension. For example, stride of 2 means take every second element. (Size: AtLeast(min=1))- Returns:
- output A subset of the input array (NUMERIC type)
-
stridedSlice
public SDVariable stridedSlice(String name, SDVariable in, long[] begin, long[] end, long... strides)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]- Parameters:
name
- name May be null. Name for the output variablein
- Variable to get subset of (NDARRAY type)begin
- Beginning index (Size: AtLeast(min=1))end
- End index (Size: AtLeast(min=1))strides
- Stride ("step size") for each dimension. For example, stride of 2 means take every second element. (Size: AtLeast(min=1))- Returns:
- output A subset of the input array (NUMERIC type)
-
stridedSlice
public SDVariable stridedSlice(SDVariable in, SDVariable begin, SDVariable end, SDVariable strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]- Parameters:
in
- Variable to get subset of (NDARRAY type)begin
- The beginning indices for the slice (NUMERIC type)end
- The ending indicesof the slice (NUMERIC type)strides
- The strides for each dimension (NUMERIC type)beginMask
- Bit mask: If the ith bit is set to 1, then the value in the begin long[] is ignored, and a value of 0 is used instead for the beginning index for that dimensionendMask
- Bit mask: If the ith bit is set to 1, then the value in the end long[] is ignored, and a value of size(i)-1 is used instead for the end index for that dimensionellipsisMask
- Bit mask: only one non-zero value is allowed here. If a non-zero value is set, then other dimensions are inserted as required at the specified positionnewAxisMask
- Bit mask: if the ith bit is set to 1, then the begin/end/stride values are ignored, and a size 1 dimension is inserted at this pointshrinkAxisMask
- Bit mask: if the ith bit is set to 1, then the begin/end/stride values are ignored, and a size 1 dimension is removed at this point. Note that begin/end/stride values must result in a size 1 output for these dimensions- Returns:
- output A subset of the input array (NUMERIC type)
-
stridedSlice
public SDVariable stridedSlice(String name, SDVariable in, SDVariable begin, SDVariable end, SDVariable strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]- Parameters:
name
- name May be null. Name for the output variablein
- Variable to get subset of (NDARRAY type)begin
- The beginning indices for the slice (NUMERIC type)end
- The ending indicesof the slice (NUMERIC type)strides
- The strides for each dimension (NUMERIC type)beginMask
- Bit mask: If the ith bit is set to 1, then the value in the begin long[] is ignored, and a value of 0 is used instead for the beginning index for that dimensionendMask
- Bit mask: If the ith bit is set to 1, then the value in the end long[] is ignored, and a value of size(i)-1 is used instead for the end index for that dimensionellipsisMask
- Bit mask: only one non-zero value is allowed here. If a non-zero value is set, then other dimensions are inserted as required at the specified positionnewAxisMask
- Bit mask: if the ith bit is set to 1, then the begin/end/stride values are ignored, and a size 1 dimension is inserted at this pointshrinkAxisMask
- Bit mask: if the ith bit is set to 1, then the begin/end/stride values are ignored, and a size 1 dimension is removed at this point. Note that begin/end/stride values must result in a size 1 output for these dimensions- Returns:
- output A subset of the input array (NUMERIC type)
-
stridedSlice
public SDVariable stridedSlice(SDVariable in, SDVariable begin, SDVariable end, SDVariable strides)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]- Parameters:
in
- Variable to get subset of (NDARRAY type)begin
- The beginning indices for the slice (NUMERIC type)end
- The ending indicesof the slice (NUMERIC type)strides
- The strides for each dimension (NUMERIC type)- Returns:
- output A subset of the input array (NUMERIC type)
-
stridedSlice
public SDVariable stridedSlice(String name, SDVariable in, SDVariable begin, SDVariable end, SDVariable strides)
Get a subset of the specified input, by specifying the first element, last element, and the strides.
For example, if input is:
[a, b, c]
[d, e, f]
[g, h, i]
then stridedSlice(input, begin=[0,1], end=[2,2], strides=[2,1], all masks = 0) will return:
[b, c]
[h, i]- Parameters:
name
- name May be null. Name for the output variablein
- Variable to get subset of (NDARRAY type)begin
- The beginning indices for the slice (NUMERIC type)end
- The ending indicesof the slice (NUMERIC type)strides
- The strides for each dimension (NUMERIC type)- Returns:
- output A subset of the input array (NUMERIC type)
-
sum
public SDVariable sum(SDVariable x, boolean keepDims, int... dimensions)
Sum array reduction operation, optionally along 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:
x
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as length 1). False: remove the reduction dimensionsdimensions
- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
sum
public SDVariable sum(String name, SDVariable x, boolean keepDims, int... dimensions)
Sum array reduction operation, optionally along 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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)keepDims
- If true: keep the dimensions that are reduced on (as length 1). False: remove the reduction dimensionsdimensions
- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
sum
public SDVariable sum(SDVariable x, int... dimensions)
Sum array reduction operation, optionally along 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:
x
- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
sum
public SDVariable sum(String name, SDVariable x, int... dimensions)
Sum array reduction operation, optionally along 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:
name
- name May be null. Name for the output variablex
- 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) if keepDims = false, or of rank (input rank) if keepdims = true (NUMERIC type)
-
switchOp
public SDVariable[] switchOp(SDVariable x, SDVariable predicate)
Switch operation
Predicate - if false, values are output to left (first) branch/output; if true, to right (second) branch/output- Parameters:
x
- Input variable (NDARRAY type)predicate
- Predictate - if false, values are output to left (first) branch/output; if true, to right (second) branch/output (BOOL type)
-
switchOp
public SDVariable[] switchOp(String[] names, SDVariable x, SDVariable predicate)
Switch operation
Predicate - if false, values are output to left (first) branch/output; if true, to right (second) branch/output- Parameters:
names
- names May be null. Arrays of names for the output variables.x
- Input variable (NDARRAY type)predicate
- Predictate - if false, values are output to left (first) branch/output; if true, to right (second) branch/output (BOOL type)
-
tensorMmul
public SDVariable tensorMmul(SDVariable x, SDVariable y, int[] dimensionsX, int[] dimensionsY, boolean transposeX, boolean transposeY, boolean transposeZ)
//TODO: Ops must be documented.- Parameters:
x
- Input variable x (NUMERIC type)y
- Input variable y (NUMERIC type)dimensionsX
- dimensions for first input array (x) (Size: AtLeast(min=1))dimensionsY
- dimensions for second input array (y) (Size: AtLeast(min=1))transposeX
- Transpose x (first argument)transposeY
- Transpose y (second argument)transposeZ
- Transpose result array- Returns:
- output Output variable (NUMERIC type)
-
tensorMmul
public SDVariable tensorMmul(String name, SDVariable x, SDVariable y, int[] dimensionsX, int[] dimensionsY, boolean transposeX, boolean transposeY, boolean transposeZ)
//TODO: Ops must be documented.- Parameters:
name
- name May be null. Name for the output variablex
- Input variable x (NUMERIC type)y
- Input variable y (NUMERIC type)dimensionsX
- dimensions for first input array (x) (Size: AtLeast(min=1))dimensionsY
- dimensions for second input array (y) (Size: AtLeast(min=1))transposeX
- Transpose x (first argument)transposeY
- Transpose y (second argument)transposeZ
- Transpose result array- Returns:
- output Output variable (NUMERIC type)
-
tensorMmul
public SDVariable tensorMmul(SDVariable x, SDVariable y, int[] dimensionsX, int... dimensionsY)
//TODO: Ops must be documented.- Parameters:
x
- Input variable x (NUMERIC type)y
- Input variable y (NUMERIC type)dimensionsX
- dimensions for first input array (x) (Size: AtLeast(min=1))dimensionsY
- dimensions for second input array (y) (Size: AtLeast(min=1))- Returns:
- output Output variable (NUMERIC type)
-
tensorMmul
public SDVariable tensorMmul(String name, SDVariable x, SDVariable y, int[] dimensionsX, int... dimensionsY)
//TODO: Ops must be documented.- Parameters:
name
- name May be null. Name for the output variablex
- Input variable x (NUMERIC type)y
- Input variable y (NUMERIC type)dimensionsX
- dimensions for first input array (x) (Size: AtLeast(min=1))dimensionsY
- dimensions for second input array (y) (Size: AtLeast(min=1))- Returns:
- output Output variable (NUMERIC type)
-
tile
public SDVariable tile(SDVariable x, SDVariable repeat)
Repeat (tile) the input tensor the specified number of times.
For example, if input is
[1, 2]
[3, 4]
and repeat is [2, 3]
then output is
[1, 2, 1, 2, 1, 2]
[3, 4, 3, 4, 3, 4]
[1, 2, 1, 2, 1, 2]
[3, 4, 3, 4, 3, 4]- Parameters:
x
- Input variable (NDARRAY type)repeat
- Number of times to repeat in each axis. Must have length equal to the rank of the input array (INT type)- Returns:
- output Output variable (NDARRAY type)
-
tile
public SDVariable tile(String name, SDVariable x, SDVariable repeat)
Repeat (tile) the input tensor the specified number of times.
For example, if input is
[1, 2]
[3, 4]
and repeat is [2, 3]
then output is
[1, 2, 1, 2, 1, 2]
[3, 4, 3, 4, 3, 4]
[1, 2, 1, 2, 1, 2]
[3, 4, 3, 4, 3, 4]- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY type)repeat
- Number of times to repeat in each axis. Must have length equal to the rank of the input array (INT type)- Returns:
- output Output variable (NDARRAY type)
-
tile
public SDVariable tile(SDVariable x, int... repeat)
see tile(String, SDVariable, int...)- Parameters:
x
- (NDARRAY type)repeat
- (Size: AtLeast(min=1))- Returns:
- output (NDARRAY type)
-
tile
public SDVariable tile(String name, SDVariable x, int... repeat)
see tile(String, SDVariable, int...)- Parameters:
name
- name May be null. Name for the output variablex
- (NDARRAY type)repeat
- (Size: AtLeast(min=1))- Returns:
- output (NDARRAY type)
-
transpose
public SDVariable transpose(SDVariable x)
Matrix transpose operation: If input has shape [a,b] output has shape [b,a]- Parameters:
x
- Input variable (NDARRAY type)- Returns:
- output transposed input (NDARRAY type)
-
transpose
public SDVariable transpose(String name, SDVariable x)
Matrix transpose operation: If input has shape [a,b] output has shape [b,a]- Parameters:
name
- name May be null. Name for the output variablex
- Input variable (NDARRAY type)- Returns:
- output transposed input (NDARRAY type)
-
unsortedSegmentMax
public SDVariable unsortedSegmentMax(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment max operation. As per segmentMax(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [6, 9, 8] = [max(3,6), max(1,4,9), max(2,8)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentMax
public SDVariable unsortedSegmentMax(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment max operation. As per segmentMax(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [6, 9, 8] = [max(3,6), max(1,4,9), max(2,8)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentMax
public SDVariable unsortedSegmentMax(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment max operation. As per segmentMax(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [6, 9, 8] = [max(3,6), max(1,4,9), max(2,8)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentMax
public SDVariable unsortedSegmentMax(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment max operation. As per segmentMax(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [6, 9, 8] = [max(3,6), max(1,4,9), max(2,8)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentMean
public SDVariable unsortedSegmentMean(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment mean operation. As per segmentMean(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [4.5, 4.666, 5] = [mean(3,6), mean(1,4,9), mean(2,8)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentMean
public SDVariable unsortedSegmentMean(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment mean operation. As per segmentMean(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [4.5, 4.666, 5] = [mean(3,6), mean(1,4,9), mean(2,8)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentMean
public SDVariable unsortedSegmentMean(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment mean operation. As per segmentMean(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [4.5, 4.666, 5] = [mean(3,6), mean(1,4,9), mean(2,8)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentMean
public SDVariable unsortedSegmentMean(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment mean operation. As per segmentMean(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [4.5, 4.666, 5] = [mean(3,6), mean(1,4,9), mean(2,8)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentMin
public SDVariable unsortedSegmentMin(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment min operation. As per segmentMin(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [3, 1, 2] = [min(3,6), min(1,4,9), min(2,8)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentMin
public SDVariable unsortedSegmentMin(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment min operation. As per segmentMin(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [3, 1, 2] = [min(3,6), min(1,4,9), min(2,8)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentMin
public SDVariable unsortedSegmentMin(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment min operation. As per segmentMin(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [3, 1, 2] = [min(3,6), min(1,4,9), min(2,8)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentMin
public SDVariable unsortedSegmentMin(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment min operation. As per segmentMin(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [3, 1, 2] = [min(3,6), min(1,4,9), min(2,8)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentProd
public SDVariable unsortedSegmentProd(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment product operation. As per segmentProd(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [4.5, 4.666, 5] = [mean(3,6), mean(1,4,9), mean(2,8)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentProd
public SDVariable unsortedSegmentProd(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment product operation. As per segmentProd(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [4.5, 4.666, 5] = [mean(3,6), mean(1,4,9), mean(2,8)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentProd
public SDVariable unsortedSegmentProd(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment product operation. As per segmentProd(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [4.5, 4.666, 5] = [mean(3,6), mean(1,4,9), mean(2,8)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentProd
public SDVariable unsortedSegmentProd(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment product operation. As per segmentProd(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [4.5, 4.666, 5] = [mean(3,6), mean(1,4,9), mean(2,8)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentSqrtN
public SDVariable unsortedSegmentSqrtN(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment sqrtN operation. Simply returns the sqrt of the count of the number of values in each segment
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [1.414, 1.732, 1.414] = [sqrt(2), sqrtN(3), sqrtN(2)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentSqrtN
public SDVariable unsortedSegmentSqrtN(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment sqrtN operation. Simply returns the sqrt of the count of the number of values in each segment
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [1.414, 1.732, 1.414] = [sqrt(2), sqrtN(3), sqrtN(2)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentSqrtN
public SDVariable unsortedSegmentSqrtN(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment sqrtN operation. Simply returns the sqrt of the count of the number of values in each segment
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [1.414, 1.732, 1.414] = [sqrt(2), sqrtN(3), sqrtN(2)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentSqrtN
public SDVariable unsortedSegmentSqrtN(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment sqrtN operation. Simply returns the sqrt of the count of the number of values in each segment
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [1.414, 1.732, 1.414] = [sqrt(2), sqrtN(3), sqrtN(2)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentSum
public SDVariable unsortedSegmentSum(SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment sum operation. As per segmentSum(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [9, 14, 10] = [sum(3,6), sum(1,4,9), sum(2,8)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentSum
public SDVariable unsortedSegmentSum(String name, SDVariable data, SDVariable segmentIds, int numSegments)
Unsorted segment sum operation. As per segmentSum(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [9, 14, 10] = [sum(3,6), sum(1,4,9), sum(2,8)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentSum
public SDVariable unsortedSegmentSum(SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment sum operation. As per segmentSum(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [9, 14, 10] = [sum(3,6), sum(1,4,9), sum(2,8)]- Parameters:
data
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unsortedSegmentSum
public SDVariable unsortedSegmentSum(String name, SDVariable data, SDVariable segmentIds, SDVariable numSegments)
Unsorted segment sum operation. As per segmentSum(String, SDVariable, SDVariable) but without
the requirement for the indices to be sorted.
If data = [1, 3, 2, 6, 4, 9, 8]
segmentIds = [1, 0, 2, 0, 1, 1, 2]
then output = [9, 14, 10] = [sum(3,6), sum(1,4,9), sum(2,8)]- Parameters:
name
- name May be null. Name for the output variabledata
- Data (variable) to perform unsorted segment max on (NUMERIC type)segmentIds
- Variable for the segment IDs (NUMERIC type)numSegments
- Number of segments (INT type)- Returns:
- output Unsorted segment output (NUMERIC type)
-
unstack
public SDVariable[] unstack(SDVariable value, int axis, int num)
Unstack a variable of rank X into N rank X-1 variables by taking slices along the specified axis.
If input has shape [a,b,c] then output has shape:
axis = 0: [b,c]
axis = 1: [a,c]
axis = 2: [a,b]- Parameters:
value
- Input variable to unstack (NDARRAY type)axis
- Axis to unstack onnum
- Number of output variables
-
unstack
public SDVariable[] unstack(String[] names, SDVariable value, int axis, int num)
Unstack a variable of rank X into N rank X-1 variables by taking slices along the specified axis.
If input has shape [a,b,c] then output has shape:
axis = 0: [b,c]
axis = 1: [a,c]
axis = 2: [a,b]- Parameters:
names
- names May be null. Arrays of names for the output variables.value
- Input variable to unstack (NDARRAY type)axis
- Axis to unstack onnum
- Number of output variables
-
variance
public SDVariable variance(SDVariable x, boolean biasCorrected, boolean keepDims, int... dimensions)
Variance array reduction operation, optionally along 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:
x
- Input variable (NUMERIC type)biasCorrected
- If true: divide by (N-1) (i.e., sample variable). If false: divide by N (population variance)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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)
-
variance
public SDVariable variance(String name, SDVariable x, boolean biasCorrected, boolean keepDims, int... dimensions)
Variance array reduction operation, optionally along 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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)biasCorrected
- If true: divide by (N-1) (i.e., sample variable). If false: divide by N (population variance)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- 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)
-
variance
public SDVariable variance(SDVariable x, boolean biasCorrected, int... dimensions)
Variance array reduction operation, optionally along 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:
x
- Input variable (NUMERIC type)biasCorrected
- If true: divide by (N-1) (i.e., sample variable). If false: divide by N (population variance)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)
-
variance
public SDVariable variance(String name, SDVariable x, boolean biasCorrected, int... dimensions)
Variance array reduction operation, optionally along 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:
name
- name May be null. Name for the output variablex
- Input variable (NUMERIC type)biasCorrected
- If true: divide by (N-1) (i.e., sample variable). If false: divide by N (population variance)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)
-
where
public SDVariable where(SDVariable x, SDVariable y, SDVariable condition)
Similar to numpy where, takes elements from x or y depending on whether the condition at a given element is true or false
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:
x
- The first array (NDARRAY type)y
- The second array (NDARRAY type)condition
- Condition array determining which elements at which indices should be picked from. If true, picks from x, other wise y (BOOL type)- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
where
public SDVariable where(String name, SDVariable x, SDVariable y, SDVariable condition)
Similar to numpy where, takes elements from x or y depending on whether the condition at a given element is true or false
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:
name
- name May be null. Name for the output variablex
- The first array (NDARRAY type)y
- The second array (NDARRAY type)condition
- Condition array determining which elements at which indices should be picked from. If true, picks from x, other wise y (BOOL type)- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
where
public SDVariable where(SDVariable x, SDVariable condition)
Similar to numpy where, takes elements from x or y depending on whether the condition at a given element is true or false
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:
x
- The first array (NUMERIC type)condition
- Condition array determining which elements at which indices should be picked from. If true, picks from x, other wise y (BOOL type)- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
where
public SDVariable where(String name, SDVariable x, SDVariable condition)
Similar to numpy where, takes elements from x or y depending on whether the condition at a given element is true or false
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:
name
- name May be null. Name for the output variablex
- The first array (NUMERIC type)condition
- Condition array determining which elements at which indices should be picked from. If true, picks from x, other wise y (BOOL type)- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
where
public SDVariable where(SDVariable condition)
Returns elements that are true from the given condition array
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:
condition
- Condition array determining which elements at which indices should be picked from. If true, picks from x, other wise y (BOOL type)- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
where
public SDVariable where(String name, SDVariable condition)
Returns elements that are true from the given condition array
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:
name
- name May be null. Name for the output variablecondition
- Condition array determining which elements at which indices should be picked from. If true, picks from x, other wise y (BOOL type)- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
whereNumpy
public SDVariable whereNumpy(SDVariable x, SDVariable y, SDVariable condition)
As implemented in numpy, Return elements chosen from x or y depending on condition.
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:
x
- The first array (NDARRAY type)y
- The second array (NDARRAY type)condition
- Condition array determining which elements at which indices should be picked from. If true, picks from x, other wise y (NUMERIC type)- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
whereNumpy
public SDVariable whereNumpy(String name, SDVariable x, SDVariable y, SDVariable condition)
As implemented in numpy, Return elements chosen from x or y depending on condition.
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:
name
- name May be null. Name for the output variablex
- The first array (NDARRAY type)y
- The second array (NDARRAY type)condition
- Condition array determining which elements at which indices should be picked from. If true, picks from x, other wise y (NUMERIC type)- Returns:
- output Number of elements that the condition is satisfied for (NUMERIC type)
-
zerosLike
public SDVariable zerosLike(SDVariable input)
Return a variable of all 0s, 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- Parameters:
input
- Input (NDARRAY type)- Returns:
- output A new Variable with the same (dynamic) shape as the input (NUMERIC type)
-
zerosLike
public SDVariable zerosLike(String name, SDVariable input)
Return a variable of all 0s, 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- Parameters:
name
- name May be null. Name for the output variableinput
- Input (NDARRAY type)- Returns:
- output A new Variable with the same (dynamic) shape as the input (NUMERIC type)
-
-