Constructor and Description |
---|
SDBaseOps() |
Modifier and Type | Method and Description |
---|---|
SDVariable |
all(SDVariable x,
int... dimensions)
|
SDVariable |
all(String name,
SDVariable x,
int... dimensions)
Boolean and array reduction operation, optionally along specified dimensions
|
SDVariable |
any(SDVariable x,
int... dimensions)
|
SDVariable |
any(String name,
SDVariable x,
int... dimensions)
Boolean or array reduction operation, optionally along specified dimensions
|
SDVariable |
argmax(SDVariable in,
boolean keepDims,
int... dimensions) |
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 |
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. |
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 |
SDVariable |
argmin(SDVariable in,
boolean keepDims,
int... dimensions) |
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 |
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 |
SDVariable |
assign(SDVariable in,
Number value)
Return an array with equal shape to the input, but all elements set to 'value'
|
SDVariable |
assign(SDVariable x,
SDVariable y)
Assign/copy op: out = x.assign(y).
|
SDVariable |
assign(String name,
SDVariable in,
Number value)
Return an array with equal shape to the input, but all elements set to 'value'
|
SDVariable |
assign(String name,
SDVariable x,
SDVariable y)
Assign/copy op: out = x.assign(y).
|
SDVariable[] |
batchMmul(SDVariable[] matricesA,
SDVariable[] matricesB)
Matrix multiply a batch of matrices.
|
SDVariable[] |
batchMmul(SDVariable[] matricesA,
SDVariable[] matricesB,
boolean transposeA,
boolean transposeB)
Matrix multiply a batch of matrices.
|
SDVariable[] |
batchMmul(String[] names,
SDVariable[] matricesA,
SDVariable[] matricesB,
boolean transposeA,
boolean transposeB)
Matrix multiply a batch of matrices.
|
SDVariable |
castTo(SDVariable toCast,
DataType toType) |
SDVariable |
castTo(String name,
SDVariable toCast,
DataType toType) |
SDVariable |
concat(int dimension,
SDVariable... 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] |
SDVariable |
cumprod(SDVariable in,
boolean exclusive,
boolean reverse,
int... axis) |
SDVariable |
cumprod(String name,
SDVariable in,
boolean exclusive,
boolean reverse,
int... axis)
Cumulative product operation.
For input: [ a, b, c], output is: exclusize=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) |
SDVariable |
cumsum(String name,
SDVariable in,
boolean exclusive,
boolean reverse,
int... axis)
Cumulative sum operation.
For input: [ a, b, c], output is: exclusize=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(SDVariable x,
SDVariable y,
int... dimensions)
TODO doc string
|
SDVariable |
dot(String name,
SDVariable x,
SDVariable y,
int... dimensions)
TODO doc string
|
SDVariable[] |
dynamicPartition(SDVariable x,
SDVariable partitions,
int numPartitions) |
SDVariable[] |
dynamicPartition(String[] name,
SDVariable x,
SDVariable partitions,
int numPartitions)
Dynamically partition the input variable values into the specified number of paritions, using the indices.
Example: |
SDVariable |
dynamicStitch(SDVariable[] indices,
SDVariable[] x) |
SDVariable |
dynamicStitch(String name,
SDVariable[] indices,
SDVariable[] x)
Dynamically merge the specified input arrays into a single array, using the specified indices
|
SDVariable |
eq(SDVariable x,
double y)
Equals operation: elementwise x == y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
eq(String name,
SDVariable x,
double y)
Equals operation: elementwise x == y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
expandDims(SDVariable x,
int axis) |
SDVariable |
expandDims(String name,
SDVariable x,
int axis)
Reshape the input by adding a 1 at the specified location.
For example, if input has shape [a, b], then output shape is: axis = 0: [1, a, b] axis = 1: [a, 1, b] axis = 2: [a, b, 1] |
protected abstract DifferentialFunctionFactory |
f() |
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
|
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
|
SDVariable |
gather(SDVariable df,
int[] indices,
int axis) |
SDVariable |
gather(SDVariable df,
SDVariable indices,
int axis) |
SDVariable |
gather(String name,
SDVariable df,
int[] indices,
int axis)
Gather slices from the input variable where the indices are specified as fixed int[] values.
Output shape is same as input shape, except for axis dimension, which has size equal to indices.length. |
SDVariable |
gather(String name,
SDVariable df,
SDVariable indices,
int axis)
Gather slices from the input variable where the indices are specified as dynamic SDVariable values.
Output shape is same as input shape, except for axis dimension, which has size equal to indices.length. |
SDVariable |
gatherNd(SDVariable df,
SDVariable indices)
TODO doc string
|
SDVariable |
gatherNd(String name,
SDVariable df,
SDVariable indices)
TODO doc string
|
protected abstract String |
generateNewVarName(String baseName,
int argIndex) |
protected SDVariable |
gradientBackwardsMarker(SDVariable x)
Intended for internal/developer use
|
protected SDVariable |
gradientBackwardsMarker(String name,
SDVariable x)
Intended for internal/developer use
|
SDVariable |
gt(SDVariable x,
double y)
Greater than operation: elementwise x > y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
gt(String name,
SDVariable x,
double y)
Greater than operation: elementwise x > y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
gte(SDVariable x,
double y)
Greater than or equals operation: elementwise x >= y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
gte(String name,
SDVariable x,
double y)
Greater than or equals operation: elementwise x >= y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
identity(SDVariable input)
Elementwise identity operation: out = x
|
SDVariable |
identity(String name,
SDVariable input)
Elementwise identity operation: out = x
|
SDVariable |
ifCond(SameDiffNoArgSingleLambda cond,
SameDiffNoArgSingleLambda trueBody,
SameDiffNoArgSingleLambda falseBody)
|
SDVariable |
ifCond(String ifName,
SameDiffNoArgSingleLambda cond,
SameDiffNoArgSingleLambda trueBody,
SameDiffNoArgSingleLambda falseBody)
|
SDVariable |
ifCond(String outputName,
String ifName,
SameDiffNoArgSingleLambda cond,
SameDiffNoArgSingleLambda trueBody,
SameDiffNoArgSingleLambda falseBody)
Constructs a If statement using the tensorflow style control flow operations (Switch and Merge)
If the result of cond is true, returns the result of trueBody, otherwise returns the result of falseBody
Note that cond and body lambdas are only called once to construct the graph.
|
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 |
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 |
SDVariable |
isNumericTensor(SDVariable x)
Is the director a numeric tensor? In the current version of ND4J/SameDiff, this always returns true/1
|
SDVariable |
isNumericTensor(String name,
SDVariable x)
Is the director a numeric tensor? In the current version of ND4J/SameDiff, this always returns true/1
|
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 |
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(String name,
SDVariable from,
SDVariable to,
SDVariable length,
DataType dt)
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(SDVariable x,
double y)
Less than operation: elementwise x < y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
lt(String name,
SDVariable x,
double y)
Less than operation: elementwise x < y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
lte(SDVariable x,
double y)
Less than or equals operation: elementwise x <= y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
lte(String name,
SDVariable x,
double y)
Less than or equals operation: elementwise x <= y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
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
|
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
|
SDVariable |
matchConditionCount(SDVariable in,
Condition condition)
Returns a count of the number of elements that satisfy the condition
|
SDVariable |
matchConditionCount(String name,
SDVariable in,
Condition condition)
Returns a count of the number of elements that satisfy the condition
|
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. |
SDVariable |
max(SDVariable x,
int... dimensions)
Max array reduction operation, optionally along specified dimensions
|
SDVariable |
max(SDVariable first,
SDVariable second)
Element-wise maximum operation: out[i] = max(first[i], second[i])
Supports broadcasting |
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
|
SDVariable |
max(String name,
SDVariable first,
SDVariable second)
Element-wise maximum operation: out[i] = max(first[i], second[i])
Supports broadcasting |
SDVariable |
mean(SDVariable x)
Full array mean reduction operation
|
SDVariable |
mean(SDVariable x,
int... dimension)
Mean (average) array reduction operation, optionally along specified dimensions
|
SDVariable |
mean(String name,
SDVariable x,
boolean keepDims,
int... dimension)
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... dimension)
Mean (average) 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])
Supports broadcasting |
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])
Supports broadcasting |
SDVariable |
mmul(SDVariable x,
SDVariable y)
Matrix multiplication: out = mmul(x,y)
|
SDVariable |
mmul(SDVariable x,
SDVariable y,
MMulTranspose transpose)
Matrix multiplication: out = mmul(x,y)
Supports specifying a MMulTranspose argument to perform operation such as mmul(a^T, b), etc. |
SDVariable |
mmul(String name,
SDVariable x,
SDVariable y)
Matrix multiplication: out = mmul(x,y)
|
SDVariable |
mmul(String name,
SDVariable x,
SDVariable y,
MMulTranspose transpose)
Matrix multiplication: out = mmul(x,y)
Supports specifying a MMulTranspose argument to perform operation such as mmul(a^T, b), etc. |
SDVariable |
neq(SDVariable x,
double y)
Not equals operation: elementwise x != y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
neq(String name,
SDVariable x,
double y)
Not equals operation: elementwise x != y
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 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. Returns an array with values 1 where condition is satisfied, or value 0 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]) |
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) |
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
|
SDVariable |
oneHot(SDVariable indices,
int depth) |
SDVariable |
oneHot(SDVariable indices,
int depth,
int axis,
double on,
double off) |
SDVariable |
oneHot(SDVariable indices,
int depth,
int axis,
double on,
double off,
DataType dataType) |
SDVariable |
oneHot(String name,
SDVariable indices,
int depth)
Convert the array to a one-hot array with walues 0 and 1 for each entry
If input has shape [ a, ..., n] then output has shape [ a, ..., n, depth], with out[i, ..., j, in[i,...,j]] = 1 with other values being set to 0 |
SDVariable |
oneHot(String name,
SDVariable indices,
int depth,
int axis,
double on,
double off)
Convert the array to a one-hot array with walues
on and off for each entryIf input has shape [ a, ..., n] then output has shape [ a, ..., n, depth], with out[i, ..., j, in[i,...,j]] = on with other values being set to off |
SDVariable |
oneHot(String name,
SDVariable indices,
int depth,
int axis,
double on,
double off,
DataType dataType)
As per
oneHot(String, SDVariable, int, int, double, double) but allows configuring the output datatype |
SDVariable |
onesLike(SDVariable input)
Return a variable of all 1s, with the same shape as the input variable.
|
SDVariable |
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 specified |
SDVariable |
parallel_stack(SDVariable[] values) |
SDVariable |
parallel_stack(String name,
SDVariable[] values) |
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(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)
As per
permute(String, SDVariable, int...) but with SDVariable permute dimension |
SDVariable |
prod(SDVariable x,
int... dimensions)
Product array reduction operation, optionally along specified dimensions
|
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
|
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)
As per
range(String, double, double, double, DataType) but with SDVariable arguments |
SDVariable |
rank(SDVariable in)
Returns the rank (number of dimensions, i.e., length(shape)) of the specified SDVariable as a 0D scalar variable
|
SDVariable |
rank(String name,
SDVariable in)
Returns the rank (number of dimensions, i.e., length(shape)) of the specified SDVariable as a 0D scalar variable
|
SDVariable |
repeat(SDVariable df,
int axis) |
SDVariable |
repeat(String name,
SDVariable df,
int axis) |
SDVariable |
replaceWhere(SDVariable update,
Number 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 |
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 |
SDVariable |
replaceWhere(String name,
SDVariable update,
Number 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 |
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 |
SDVariable |
reshape(SDVariable x,
int... 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 (dynamic) shape.
|
SDVariable |
reshape(String name,
SDVariable x,
int... shape)
Reshape the input variable to the specified (fixed) shape.
|
SDVariable |
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 (dynamic) shape.
|
SDVariable |
reverse(SDVariable x,
int... dimensions) |
SDVariable |
reverse(String name,
SDVariable x,
int... dimensions)
Reverse the values of an array for the specified dimensions
If input is: [ 1, 2, 3] [ 4, 5, 6] then reverse(in, 0): [3, 2, 1] [6, 5, 4] reverse(in, 0): [4, 5, 6] [1, 2 3] |
SDVariable |
reverseSequence(SDVariable x,
SDVariable seq_lengths) |
SDVariable |
reverseSequence(SDVariable x,
SDVariable seq_lengths,
int seqDim,
int batchDim) |
SDVariable |
reverseSequence(String name,
SDVariable x,
SDVariable seq_lengths) |
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
|
SDVariable |
scalarFloorMod(SDVariable in,
Number value)
Element-wise scalar floor modulus operation: out = floorMod(in, value).
|
SDVariable |
scalarFloorMod(String name,
SDVariable in,
Number value)
Element-wise scalar floor modulus operation: out = floorMod(in, value).
|
SDVariable |
scalarMax(SDVariable in,
Number value)
Element-wise scalar maximum operation: out = max(in, value)
|
SDVariable |
scalarMax(String name,
SDVariable in,
Number value)
Element-wise scalar maximum operation: out = max(in, value)
|
SDVariable |
scalarMin(SDVariable in,
Number value)
Element-wise scalar minimum operation: out = min(in, value)
|
SDVariable |
scalarMin(String name,
SDVariable in,
Number value)
Element-wise scalar minimum operation: out = min(in, value)
|
SDVariable |
scalarSet(SDVariable in,
Number set)
Return an array with equal shape to the input, but all elements set to value 'set'
|
SDVariable |
scalarSet(String name,
SDVariable in,
Number set)
Return a variable with equal shape to the input, but all elements set to value 'set'
|
SDVariable |
scatterAdd(SDVariable ref,
SDVariable indices,
SDVariable updates) |
SDVariable |
scatterAdd(String name,
SDVariable ref,
SDVariable indices,
SDVariable updates)
Scatter addition operation.
If indices is rank 0 (a scalar), then out[index, ...] += updates[...] If indices is rank 1 (a vector), then for each position i, out[indices[i], ...] += updates[i, ...] If indices is rank 2+, then for each position (i,...,k), out[indices[i], ..., indices[k], ...] += 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) |
SDVariable |
scatterDiv(String name,
SDVariable ref,
SDVariable indices,
SDVariable updates)
Scatter division operation.
If indices is rank 0 (a scalar), then out[index, ...] /= updates[...] If indices is rank 1 (a vector), then for each position i, out[indices[i], ...] /= updates[i, ...] If indices is rank 2+, then for each position (i,...,k), out[indices[i], ..., indices[k], ...] /= 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) |
SDVariable |
scatterMax(String name,
SDVariable ref,
SDVariable indices,
SDVariable updates)
Scatter max operation.
If indices is rank 0 (a scalar), then out[index, ...] = max(updates[...], in[index,...]) If indices is rank 1 (a vector), then for each position i, out[indices[i], ...] = max(updates[i,...], in[indices[i],...]) If indices is rank 2+, then for each position (i,...,k), out[indices[i], ..., indices[k], ...] = max(updates[i, ..., k, ...], in[indices[i], ..., indices[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) |
SDVariable |
scatterMin(String name,
SDVariable ref,
SDVariable indices,
SDVariable updates)
Scatter min operation.
If indices is rank 0 (a scalar), then out[index, ...] = min(updates[...], in[index,...]) If indices is rank 1 (a vector), then for each position i, out[indices[i], ...] = min(updates[i,...], in[indices[i],...]) If indices is rank 2+, then for each position (i,...,k), out[indices[i], ..., indices[k], ...] = min(updates[i, ..., k, ...], in[indices[i], ..., indices[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) |
SDVariable |
scatterMul(String name,
SDVariable ref,
SDVariable indices,
SDVariable updates)
Scatter multiplication operation.
If indices is rank 0 (a scalar), then out[index, ...] *= updates[...] If indices is rank 1 (a vector), then for each position i, out[indices[i], ...] *= updates[i, ...] If indices is rank 2+, then for each position (i,...,k), out[indices[i], ..., indices[k], ...] *= 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) |
SDVariable |
scatterSub(String name,
SDVariable ref,
SDVariable indices,
SDVariable updates)
Scatter subtraction operation.
If indices is rank 0 (a scalar), then out[index, ...] -= updates[...] If indices is rank 1 (a vector), then for each position i, out[indices[i], ...] -= updates[i, ...] If indices is rank 2+, then for each position (i,...,k), out[indices[i], ..., indices[k], ...] -= 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) |
SDVariable |
scatterUpdate(String name,
SDVariable ref,
SDVariable indices,
SDVariable updates)
Scatter update operation.
If indices is rank 0 (a scalar), then out[index, ...] = updates[...] If indices is rank 1 (a vector), then for each position i, out[indices[i], ...] = updates[i, ...] If indices is rank 2+, then for each position (i,...,k), out[indices[i], ..., indices[k], ...] = updates[i, ..., k, ...] Note that if multiple indices refer to the same location, the output at those locations is undefined - different updates may occur in different orders |
protected abstract SameDiff |
sd() |
SDVariable |
segmentMax(SDVariable data,
SDVariable segmentIds) |
SDVariable |
segmentMax(String name,
SDVariable data,
SDVariable segmentIds)
Segment max operation.
If data = [3, 6, 1, 4, 9, 2, 8] segmentIds = [0, 0, 1, 1, 1, 2, 2] then output = [6, 9, 8] = [max(3,6), max(1,4,9), max(2,8)] Note that the segment IDs must be sorted from smallest to largest segment. |
SDVariable |
segmentMean(SDVariable data,
SDVariable segmentIds) |
SDVariable |
segmentMean(String name,
SDVariable data,
SDVariable segmentIds)
Segment mean operation.
If data = [3, 6, 1, 4, 9, 2, 8] segmentIds = [0, 0, 1, 1, 1, 2, 2] then output = [4.5, 4.666, 5] = [mean(3,6), mean(1,4,9), mean(2,8)] Note that the segment IDs must be sorted from smallest to largest segment. |
SDVariable |
segmentMin(SDVariable data,
SDVariable segmentIds) |
SDVariable |
segmentMin(String name,
SDVariable data,
SDVariable segmentIds)
Segment min operation.
If data = [3, 6, 1, 4, 9, 2, 8] segmentIds = [0, 0, 1, 1, 1, 2, 2] then output = [3, 1, 2] = [min(3,6), min(1,4,9), min(2,8)] Note that the segment IDs must be sorted from smallest to largest segment. |
SDVariable |
segmentProd(SDVariable data,
SDVariable segmentIds) |
SDVariable |
segmentProd(String name,
SDVariable data,
SDVariable segmentIds)
Segment product operation.
If data = [3, 6, 1, 4, 9, 2, 8] segmentIds = [0, 0, 1, 1, 1, 2, 2] then output = [18, 36, 16] = [prod(3,6), prod(1,4,9), prod(2,8)] Note that the segment IDs must be sorted from smallest to largest segment. |
SDVariable |
segmentSum(SDVariable data,
SDVariable segmentIds) |
SDVariable |
segmentSum(String name,
SDVariable data,
SDVariable segmentIds)
Segment sum operation.
If data = [3, 6, 1, 4, 9, 2, 8] segmentIds = [0, 0, 1, 1, 1, 2, 2] then output = [9, 14, 10] = [sum(3,6), sum(1,4,9), sum(2,8)] Note that the segment IDs must be sorted from smallest to largest segment. |
SDVariable |
sequenceMask(SDVariable lengths,
DataType dataType) |
SDVariable |
sequenceMask(SDVariable lengths,
int maxLen,
DataType dataType) |
SDVariable |
sequenceMask(SDVariable lengths,
SDVariable maxLen,
DataType dataType) |
SDVariable |
sequenceMask(String name,
SDVariable lengths,
DataType dataType) |
SDVariable |
sequenceMask(String name,
SDVariable lengths,
int maxLen,
DataType dataType) |
SDVariable |
sequenceMask(String name,
SDVariable lengths,
SDVariable maxLen,
DataType dataType)
Generate a sequence mask (with values 0 or 1) based on the specified lengths
Specifically, out[i, ..., k, j] = (j < lengths[i, ..., k] ? 1.0 : 0.0) |
SDVariable |
shape(SDVariable input)
Returns the shape of the specified SDVariable as a 1D SDVariable
|
SDVariable |
shape(String name,
SDVariable input)
Returns the shape of the specified SDVariable as a 1D SDVariable
|
SDVariable |
size(SDVariable in)
Returns the size (number of elements, i.e., prod(shape)) of the specified SDVariable as a 0D scalar variable
|
SDVariable |
size(String name,
SDVariable in)
Returns the size (number of elements, i.e., prod(shape)) of the specified SDVariable as a 0D scalar variable
|
SDVariable |
sizeAt(SDVariable in,
int dimension) |
SDVariable |
sizeAt(String name,
SDVariable in,
int dimension)
Returns a rank 0 (scalar) variable for the size of the specified dimension.
|
SDVariable |
slice(SDVariable input,
int[] begin,
int[] size) |
SDVariable |
slice(SDVariable input,
SDVariable begin,
SDVariable size) |
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) |
SDVariable |
squaredNorm(SDVariable x,
boolean keepDims,
int... dimensions)
Squared L2 norm: see
norm2(String, SDVariable, boolean, int...) |
SDVariable |
squaredNorm(SDVariable x,
int... dimensions)
Squared L2 norm: see
norm2(String, SDVariable, int...) |
SDVariable |
squaredNorm(String name,
SDVariable x,
boolean keepDims,
int... dimensions)
Squared L2 norm: see
norm2(String, SDVariable, boolean, int...) |
SDVariable |
squaredNorm(String name,
SDVariable x,
int... dimensions)
Squared L2 norm: see
norm2(String, SDVariable, int...) |
SDVariable |
squeeze(SDVariable x,
int axis) |
SDVariable |
squeeze(String name,
SDVariable x,
int axis)
Remove a single dimension of size 1.
|
SDVariable |
stack(int axis,
SDVariable... values) |
SDVariable |
stack(String name,
int axis,
SDVariable... values)
Stack a set of N SDVariables of rank X into one rank X+1 variable.
|
SDVariable |
standardDeviation(SDVariable x,
boolean biasCorrected,
int... dimensions) |
SDVariable |
standardDeviation(String name,
SDVariable x,
boolean biasCorrected,
boolean keepDims,
int... dimensions)
Stardard 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)
Stardard deviation array reduction operation, optionally along specified dimensions
|
SDVariable |
stridedSlice(SDVariable input,
int[] begin,
int[] end,
int[] strides) |
SDVariable |
stridedSlice(SDVariable in,
int[] begin,
int[] end,
int[] strides,
int beginMask,
int endMask,
int ellipsisMask,
int newAxisMask,
int shrinkAxisMask) |
SDVariable |
stridedSlice(SDVariable input,
long[] begin,
long[] end,
long[] strides) |
SDVariable |
stridedSlice(SDVariable in,
long[] begin,
long[] end,
long[] strides,
int beginMask,
int endMask,
int ellipsisMask,
int newAxisMask,
int shrinkAxisMask) |
SDVariable |
stridedSlice(String name,
SDVariable input,
int[] begin,
int[] end,
int[] strides) |
SDVariable |
stridedSlice(String name,
SDVariable in,
int[] begin,
int[] end,
int[] strides,
int beginMask,
int endMask,
int ellipsisMask,
int newAxisMask,
int shrinkAxisMask) |
SDVariable |
stridedSlice(String name,
SDVariable input,
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]) 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.
Operates as described in stridedSlice(SDVariable, long[], long[], long[]) with some extra mask arrays
as described below. |
SDVariable |
sum(SDVariable x,
boolean keepDims,
int... dimensions) |
SDVariable |
sum(SDVariable x,
int... dimensions)
Sum array reduction operation, optionally along specified dimensions
|
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
|
SDVariable |
tensorMmul(SDVariable x,
SDVariable y,
int[][] dimensions) |
SDVariable |
tensorMmul(String name,
SDVariable x,
SDVariable y,
int[][] dimensions) |
SDVariable |
tile(SDVariable x,
int... repeat) |
SDVariable |
tile(SDVariable x,
SDVariable repeat) |
SDVariable |
tile(String name,
SDVariable x,
int... 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(String name,
SDVariable x,
SDVariable repeat) |
SDVariable |
transpose(SDVariable x)
Matrix transpose operation: If input has shape [a,b] output has shape [b,a]
|
SDVariable |
transpose(String name,
SDVariable x)
Matrix transpose operation: If input has shape [a,b] output has shape [b,a]
|
SDVariable |
unsortedSegmentMax(SDVariable data,
SDVariable segmentIds,
int numSegments)
|
SDVariable |
unsortedSegmentMax(String name,
SDVariable data,
SDVariable segmentIds,
int numSegments)
Unsorted segment max operation.
|
SDVariable |
unsortedSegmentMean(SDVariable data,
SDVariable segmentIds,
int numSegments)
|
SDVariable |
unsortedSegmentMean(String name,
SDVariable data,
SDVariable segmentIds,
int numSegments)
Unsorted segment mean operation.
|
SDVariable |
unsortedSegmentMin(SDVariable data,
SDVariable segmentIds,
int numSegments)
|
SDVariable |
unsortedSegmentMin(String name,
SDVariable data,
SDVariable segmentIds,
int numSegments)
Unsorted segment min operation.
|
SDVariable |
unsortedSegmentProd(SDVariable data,
SDVariable segmentIds,
int numSegments)
|
SDVariable |
unsortedSegmentProd(String name,
SDVariable data,
SDVariable segmentIds,
int numSegments)
Unsorted segment product operation.
|
SDVariable |
unsortedSegmentSqrtN(SDVariable data,
SDVariable segmentIds,
int numSegments)
|
SDVariable |
unsortedSegmentSqrtN(String name,
SDVariable data,
SDVariable segmentIds,
int numSegments)
Unsorted segment sqrtN operation.
|
SDVariable |
unsortedSegmentSum(SDVariable data,
SDVariable segmentIds,
int numSegments)
|
SDVariable |
unsortedSegmentSum(String name,
SDVariable data,
SDVariable segmentIds,
int numSegments)
Unsorted segment sum operation.
|
SDVariable[] |
unstack(SDVariable value,
int axis) |
SDVariable[] |
unstack(SDVariable value,
int axis,
int num) |
SDVariable[] |
unstack(String[] names,
SDVariable value,
int axis) |
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.
|
protected abstract SDVariable |
updateVariableNameAndReference(SDVariable varToUpdate,
String newVarName) |
protected abstract SDVariable[] |
updateVariableNamesAndReferences(SDVariable[] variablesToUpdate,
String[] newVariableNames) |
SDVariable |
variance(SDVariable x,
boolean biasCorrected,
int... dimensions) |
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
|
SDVariable[] |
whileLoop(SDVariable[] loopVars,
SameDiffSingleLambda cond,
SameDiffLambda body)
|
SDVariable[] |
whileLoop(String[] outputNames,
String loopName,
SDVariable[] loopVars,
SameDiffSingleLambda cond,
SameDiffLambda body)
Constructs a While loop using the tensorflow style control flow operations (Switch, Merge, Enter, Exit, and NextIteration)
Repeatedly executes body on the loop variables and updates them with the results, until cond evaluates to false
Note that cond and body lambdas are only called once to construct the graph.
|
SDVariable[] |
whileLoop(String loopName,
SDVariable[] loopVars,
SameDiffSingleLambda cond,
SameDiffLambda body)
|
SDVariable |
zerosLike(SDVariable input)
Return a variable of all 0s, with the same shape as the input variable.
|
SDVariable |
zerosLike(String name,
SDVariable input)
Return a variable of all 0s, with the same shape as the input variable.
|
protected SDVariable gradientBackwardsMarker(SDVariable x)
protected SDVariable gradientBackwardsMarker(String name, SDVariable x)
protected abstract DifferentialFunctionFactory f()
protected abstract SDVariable updateVariableNameAndReference(SDVariable varToUpdate, String newVarName)
protected abstract SameDiff sd()
public SDVariable argmax(SDVariable in, int... dimensions)
in
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable argmax(String name, SDVariable in, boolean keepDims, int... dimensions)
name
- Name of the output variablein
- Input variablekeepDims
- 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 performedpublic SDVariable argmax(SDVariable in, boolean keepDims, int... dimensions)
public SDVariable argmax(String name, SDVariable in, int... dimensions)
in
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable argmin(SDVariable in, int... dimensions)
in
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable argmin(String name, SDVariable in, int... dimensions)
in
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable argmin(String name, SDVariable in, boolean keepDims, int... dimensions)
name
- Name of the output variablein
- Input variablekeepDims
- 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 performedpublic SDVariable argmin(SDVariable in, boolean keepDims, int... dimensions)
public SDVariable assign(SDVariable x, SDVariable y)
x
- Input variable xy
- Input variable ypublic SDVariable assign(String name, SDVariable x, SDVariable y)
name
- Name of the output variablex
- Input variable xy
- Input variable ypublic SDVariable assign(SDVariable in, Number value)
in
- Input variablevalue
- Value to setpublic SDVariable assign(String name, SDVariable in, Number value)
name
- Name of the output variablein
- Input variablevalue
- Value to setpublic SDVariable[] batchMmul(SDVariable[] matricesA, SDVariable[] matricesB, boolean transposeA, boolean transposeB)
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).
matricesA
- First array of input matrices, all of shape (M, N) or (N, M)matricesB
- Second array of input matrices, all of shape (N, K) or (K, N)transposeA
- whether first batch of matrices is transposed.transposeB
- whether second batch of matrices is transposed.public SDVariable[] batchMmul(String[] names, SDVariable[] matricesA, SDVariable[] matricesB, boolean transposeA, boolean transposeB)
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).
matricesA
- First array of input matrices, all of shape (M, N) or (N, M)matricesB
- Second array of input matrices, all of shape (N, K) or (K, N)transposeA
- whether first batch of matrices is transposed.transposeB
- whether second batch of matrices is transposed.names
- names for all provided SDVariablesprotected abstract SDVariable[] updateVariableNamesAndReferences(SDVariable[] variablesToUpdate, String[] newVariableNames)
public SDVariable[] batchMmul(SDVariable[] matricesA, SDVariable[] matricesB)
matricesA
- First array of input matrices, all of shape (M, N)matricesB
- Second array of input matrices, all of shape (N, K)public SDVariable castTo(SDVariable toCast, DataType toType)
public SDVariable castTo(String name, SDVariable toCast, DataType toType)
public SDVariable concat(int dimension, SDVariable... inputs)
concat(String, int, SDVariable...)
public SDVariable concat(String name, int dimension, SDVariable... inputs)
name
- Name of the output variabledimension
- Dimension to concatenate oninputs
- Input variablesstack(String, int, SDVariable...)
public SDVariable cumprod(SDVariable in, boolean exclusive, boolean reverse, int... axis)
public SDVariable cumprod(String name, SDVariable in, boolean exclusive, boolean reverse, int... axis)
name
- Name of the output variablein
- Input variableaxis
- Scalar axis argument for dimension to perform cumululative sum operations alongexclusive
- If true: exclude the first valuereverse
- If true: reverse the direction of the accumulationpublic SDVariable cumsum(SDVariable in, boolean exclusive, boolean reverse, int... axis)
public SDVariable cumsum(String name, SDVariable in, boolean exclusive, boolean reverse, int... axis)
name
- Name of the output variablein
- Input variableaxis
- Scalar axis argument for dimension to perform cumululative sum operations alongexclusive
- If true: exclude the first valuereverse
- If true: reverse the direction of the accumulationpublic SDVariable dot(SDVariable x, SDVariable y, int... dimensions)
x
- y
- dimensions
- public SDVariable dot(String name, SDVariable x, SDVariable y, int... dimensions)
name
- x
- y
- dimensions
- public SDVariable[] dynamicPartition(SDVariable x, SDVariable partitions, int numPartitions)
public SDVariable[] dynamicPartition(String[] name, SDVariable x, SDVariable partitions, int numPartitions)
input = [1,2,3,4,5]
numPartitions = 2
partitions = [1,0,0,1,0]
out[0] = [2,3,5]
out[1] = [1,4]
name
- Names for the output variables. Length must be equal to numPartitionsx
- Input variablepartitions
- 1D input with values 0 to numPartitions-1numPartitions
- Number of partitions, >= 1public SDVariable dynamicStitch(SDVariable[] indices, SDVariable[] x)
public SDVariable dynamicStitch(String name, SDVariable[] indices, SDVariable[] x)
name
- Name of the output variableindices
- Indices to use when merging. Must be >= 1, same length as input variablesx
- Input variables.public SDVariable eq(SDVariable x, double y)
x
- Input arrayy
- Double value argument to use in operationpublic SDVariable eq(String name, SDVariable x, double y)
name
- Name of the output variablex
- Input arrayy
- Double value argument to use in operationpublic SDVariable eq(SDVariable x, SDVariable y)
x
- Input 1y
- Input 2public SDVariable eq(String name, SDVariable x, SDVariable y)
name
- Name of the output variablex
- Input 1y
- Input 2public SDVariable expandDims(SDVariable x, int axis)
expandDims(String, SDVariable, int)
public SDVariable expandDims(String name, SDVariable x, int axis)
name
- Name of the output variablex
- Input variableaxis
- Axis to expandsqueeze(String, SDVariable, int)
public SDVariable fill(SDVariable shape, DataType dataType, double value)
shape
- Shape: must be a 1D array/variablevalue
- Value to set all elements topublic SDVariable fill(String name, SDVariable shape, DataType dataType, double value)
name
- Name of the output variableshape
- Shape: must be a 1D array/variablevalue
- Value to set all elements topublic SDVariable gather(SDVariable df, int[] indices, int axis)
gather(String, SDVariable, int[], int)
public SDVariable gather(String name, SDVariable df, int[] indices, int axis)
name
- name of the output variabledf
- Input variableindices
- Indices to getaxis
- Axis that the indices refer topublic SDVariable gather(SDVariable df, SDVariable indices, int axis)
public SDVariable gather(String name, SDVariable df, SDVariable indices, int axis)
name
- name of the output variabledf
- Input variableindices
- Indices to get slices for. Rank 0 or 1 inputaxis
- Axis that the indices refer topublic SDVariable gatherNd(SDVariable df, SDVariable indices)
df
- indices
- public SDVariable gatherNd(String name, SDVariable df, SDVariable indices)
name
- df
- indices
- public SDVariable gt(SDVariable x, double y)
x
- Input arrayy
- Double value argument to use in operationpublic SDVariable gt(String name, SDVariable x, double y)
name
- Name of the output variablex
- Input arrayy
- Double value argument to use in operationpublic SDVariable gt(SDVariable x, SDVariable y)
x
- Input 1y
- Input 2public SDVariable gt(String name, SDVariable x, SDVariable y)
name
- Name of the output variablex
- Input 1y
- Input 2public SDVariable gte(SDVariable x, double y)
x
- Input arrayy
- Double value argument to use in operationpublic SDVariable gte(String name, SDVariable x, double y)
name
- Name of the output variablex
- Input arrayy
- Double value argument to use in operationpublic SDVariable gte(SDVariable x, SDVariable y)
x
- Input 1y
- Input 2public SDVariable gte(String name, SDVariable x, SDVariable y)
name
- Name of the output variablex
- Input 1y
- Input 2public SDVariable identity(SDVariable input)
input
- Input variablepublic SDVariable identity(String name, SDVariable input)
name
- name of the output variableinput
- Input variablepublic SDVariable invertPermutation(SDVariable input)
input
- 1D indices for permutationpublic SDVariable invertPermutation(String name, SDVariable input)
name
- name of the output variableinput
- 1D indices for permutationpublic SDVariable isNumericTensor(SDVariable x)
x
- Input variablepublic SDVariable isNumericTensor(String name, SDVariable x)
name
- Output variable namex
- Input variablepublic SDVariable linspace(DataType dataType, double start, double stop, long number)
start
- Start valuestop
- Stop valuenumber
- Number of values to generatepublic SDVariable linspace(String name, DataType dataType, double start, double stop, long number)
name
- Name of the new variabledataType
- Data type of the output arraystart
- Start valuestop
- Stop valuenumber
- Number of values to generatepublic SDVariable linspace(String name, SDVariable from, SDVariable to, SDVariable length, DataType dt)
name
- Name of the new variablefrom
- Start valueto
- Stop valuelength
- Number of values to generatedt
- Data type of the output arraypublic SDVariable lt(SDVariable x, double y)
x
- Input arrayy
- Double value argument to use in operationpublic SDVariable lt(String name, SDVariable x, double y)
name
- Name of the output variablex
- Input arrayy
- Double value argument to use in operationpublic SDVariable lt(SDVariable x, SDVariable y)
x
- Input 1y
- Input 2public SDVariable lt(String name, SDVariable x, SDVariable y)
name
- Name of the output variablex
- Input 1y
- Input 2public SDVariable lte(SDVariable x, double y)
x
- Input arrayy
- Double value argument to use in operationpublic SDVariable lte(String name, SDVariable x, double y)
name
- Name of the output variablex
- Input arrayy
- Double value argument to use in operationpublic SDVariable lte(SDVariable x, SDVariable y)
x
- Input 1y
- Input 2public SDVariable lte(String name, SDVariable x, SDVariable y)
name
- Name of the output variablex
- Input 1y
- Input 2public SDVariable matchCondition(SDVariable in, Condition condition)
in
- Input variablecondition
- Conditionpublic SDVariable matchCondition(String name, SDVariable in, Condition condition)
in
- Inputcondition
- Conditionpublic SDVariable matchConditionCount(SDVariable in, Condition condition)
in
- Inputcondition
- Conditionpublic SDVariable matchConditionCount(String name, SDVariable in, Condition condition)
name
- Name of the output variablein
- Inputcondition
- Conditionpublic SDVariable matchConditionCount(String name, SDVariable in, Condition condition, boolean keepDim, int... dimensions)
name
- Name of the output variablein
- Input variablecondition
- 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 performedpublic SDVariable max(SDVariable x, int... dimensions)
x
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable max(String name, SDVariable x, int... dimensions)
name
- Output variable namex
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable max(String name, SDVariable x, boolean keepDims, int... dimensions)
name
- Output variable namex
- Input variablekeepDims
- 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 performedpublic SDVariable max(SDVariable first, SDVariable second)
first
- First input arraysecond
- Second input arraypublic SDVariable max(String name, SDVariable first, SDVariable second)
name
- Name of the output variablefirst
- First input arraysecond
- Second input arraypublic SDVariable mean(SDVariable x)
x
- Input variablepublic SDVariable mean(String name, SDVariable x, int... dimension)
name
- Output variable namex
- Input variabledimension
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable mean(String name, SDVariable x, boolean keepDims, int... dimension)
name
- Output variable namex
- Input variablekeepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimension
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable mean(SDVariable x, int... dimension)
x
- Input variabledimension
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable min(SDVariable x, int... dimensions)
x
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable min(String name, SDVariable x, int... dimensions)
name
- Output variable namex
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable min(String name, SDVariable x, boolean keepDims, int... dimensions)
name
- Output variable namex
- Input variablekeepDims
- 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 performedpublic SDVariable min(SDVariable first, SDVariable second)
first
- First input arraysecond
- Second input arraypublic SDVariable min(String name, SDVariable first, SDVariable second)
name
- Name of the output variablefirst
- First input arraysecond
- Second input arraypublic SDVariable mmul(SDVariable x, SDVariable y, MMulTranspose transpose)
MMulTranspose
argument to perform operation such as mmul(a^T, b), etc.x
- First input variabley
- Second input variabletranspose
- Transpose argumentspublic SDVariable mmul(String name, SDVariable x, SDVariable y, MMulTranspose transpose)
MMulTranspose
argument to perform operation such as mmul(a^T, b), etc.name
- Output variable namex
- First input variabley
- Second input variabletranspose
- Transpose argumentspublic SDVariable mmul(SDVariable x, SDVariable y)
x
- First input variabley
- Second input variablepublic SDVariable mmul(String name, SDVariable x, SDVariable y)
name
- Output variable namex
- First input variabley
- Second input variablepublic SDVariable neq(SDVariable x, double y)
x
- Input arrayy
- Double value argument to use in operationpublic SDVariable neq(String name, SDVariable x, double y)
name
- Name of the output variablex
- Input arrayy
- Double value argument to use in operationpublic SDVariable neq(SDVariable x, SDVariable y)
x
- Input 1y
- Input 2public SDVariable neq(String name, SDVariable x, SDVariable y)
name
- Name of the output variablex
- Input 1y
- Input 2public SDVariable norm1(String name, SDVariable x, int... dimensions)
name
- Output variable namex
- Input variabledimensions
- dimensions to reduce overpublic SDVariable norm1(String name, SDVariable x, boolean keepDims, int... dimensions)
name
- Output variable namex
- Input variablekeepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions to reduce overpublic SDVariable norm2(String name, SDVariable x, int... dimensions)
name
- Output variable namex
- Input variabledimensions
- dimensions to reduce overpublic SDVariable norm2(String name, SDVariable x, boolean keepDims, int... dimensions)
name
- Output variable namex
- Input variablekeepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions to reduce overpublic SDVariable normmax(String name, SDVariable x, int... dimensions)
name
- Output variable namex
- Input variabledimensions
- dimensions to reduce overpublic SDVariable normmax(String name, SDVariable x, boolean keepDims, int... dimensions)
name
- Output variable namex
- Input variablekeepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions to reduce overpublic SDVariable oneHot(SDVariable indices, int depth)
oneHot(String, SDVariable, int)
public SDVariable oneHot(String name, SDVariable indices, int depth, int axis, double on, double off)
on
and off
for each entryout[i, ..., j, in[i,...,j]] = on
with other values being set to off
name
- Output variable nameindices
- Indices - value 0 to depth-1depth
- Number of classespublic SDVariable oneHot(String name, SDVariable indices, int depth, int axis, double on, double off, DataType dataType)
oneHot(String, SDVariable, int, int, double, double)
but allows configuring the output datatypepublic SDVariable oneHot(SDVariable indices, int depth, int axis, double on, double off)
public SDVariable oneHot(SDVariable indices, int depth, int axis, double on, double off, DataType dataType)
public SDVariable oneHot(String name, SDVariable indices, int depth)
name
- Output variable nameindices
- Indices - value 0 to depth-1depth
- Number of classesoneHot(SDVariable, int, int, double, double)
public SDVariable onesLike(SDVariable input)
input
- Input SDVariablepublic SDVariable onesLike(String name, SDVariable input)
name
- Name of the new SDVariableinput
- Input SDVariablepublic SDVariable onesLike(String name, @NonNull SDVariable input, @NonNull DataType dataType)
onesLike(String, SDVariable)
but the output datatype may be specifiedpublic SDVariable parallel_stack(SDVariable[] values)
stack(String, int, SDVariable...)
public SDVariable parallel_stack(String name, SDVariable[] values)
stack(String, int, SDVariable...)
public SDVariable permute(SDVariable x, int... dimensions)
x
- Input variablepublic SDVariable permute(String name, SDVariable x, int... dimensions)
name
- Output variable namex
- Input variablepublic SDVariable permute(String name, SDVariable x, SDVariable dimensions)
permute(String, SDVariable, int...)
but with SDVariable permute dimensionpublic SDVariable prod(SDVariable x, int... dimensions)
x
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable prod(String name, SDVariable x, int... dimensions)
name
- Output variable namex
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable prod(String name, SDVariable x, boolean keepDims, int... dimensions)
name
- Output variable namex
- Input variablekeepDims
- 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 performedpublic SDVariable range(double from, double to, double step, DataType dataType)
from
and increment by step
up to (but not including) limit.range(1.0, 3.0, 0.5)
will return [1.0, 1.5, 2.0, 2.5]
from
- Initial/smallest valueto
- Largest value (exclusive)step
- Step sizedataType
- The output variable datatypepublic SDVariable range(String name, double from, double to, double step, DataType dataType)
from
and increment by step
up to (but not including) limit.range(1.0, 3.0, 0.5)
will return [1.0, 1.5, 2.0, 2.5]
name
- Name of the new variablefrom
- Initial/smallest valueto
- Largest value (exclusive)step
- Step sizepublic SDVariable range(String name, SDVariable from, SDVariable to, SDVariable step, DataType dataType)
range(String, double, double, double, DataType)
but with SDVariable argumentspublic SDVariable rank(SDVariable in)
in
- Input variablepublic SDVariable rank(String name, SDVariable in)
name
- Name of the output variablein
- Input variablepublic SDVariable repeat(SDVariable df, int axis)
repeat(String, SDVariable, int)
public SDVariable repeat(String name, SDVariable df, int axis)
repeat(String, SDVariable, int)
public SDVariable replaceWhere(SDVariable update, SDVariable from, Condition condition)
update
- Source arrayfrom
- Replacement values array (used conditionally). Must be same shape as 'update' arraycondition
- Condition to check on update array elementspublic SDVariable replaceWhere(String name, SDVariable update, SDVariable from, Condition condition)
name
- Name of the output variableupdate
- Source arrayfrom
- Replacement values array (used conditionally). Must be same shape as 'update' arraycondition
- Condition to check on update array elementspublic SDVariable replaceWhere(SDVariable update, Number value, Condition condition)
update
- Source arrayvalue
- Value to set at the output, if the condition is satisfiedcondition
- Condition to check on update array elementspublic SDVariable replaceWhere(String name, SDVariable update, Number value, Condition condition)
name
- Name of the output variableupdate
- Source arrayvalue
- Value to set at the output, if the condition is satisfiedcondition
- Condition to check on update array elementspublic SDVariable reshape(SDVariable x, long... shape)
x
- Input variableshape
- New shape for variablereshape(SDVariable, SDVariable)
public SDVariable reshape(String name, SDVariable x, long... shape)
name
- Output variable namex
- Input variableshape
- New shape for variablereshape(SDVariable, SDVariable)
public SDVariable reshape(SDVariable x, int... shape)
x
- Input variableshape
- New shape for variablereshape(SDVariable, SDVariable)
public SDVariable reshape(String name, SDVariable x, int... shape)
name
- Output variable namex
- Input variableshape
- New shape for variablereshape(SDVariable, SDVariable)
public SDVariable reshape(SDVariable x, SDVariable shape)
x
- Input variableshape
- New shape for variablereshape(SDVariable, int[])
public SDVariable reshape(String name, SDVariable x, SDVariable shape)
name
- Output variable namex
- Input variableshape
- New shape for variablereshape(SDVariable, int[])
public SDVariable reverse(SDVariable x, int... dimensions)
reverse(String, SDVariable, int...)
public SDVariable reverse(String name, SDVariable x, int... dimensions)
x
- Input variabledimensions
- Dimensionspublic SDVariable reverseSequence(SDVariable x, SDVariable seq_lengths, int seqDim, int batchDim)
public SDVariable reverseSequence(String name, SDVariable x, SDVariable seq_lengths, int seqDim, int batchDim)
name
- Name of the output variablex
- Input variableseq_lengths
- Length of the sequencesseqDim
- Sequence dimensionbatchDim
- Batch dimensionpublic SDVariable reverseSequence(SDVariable x, SDVariable seq_lengths)
public SDVariable reverseSequence(String name, SDVariable x, SDVariable seq_lengths)
public SDVariable scalarFloorMod(SDVariable in, Number value)
in
- Input variablevalue
- Scalar value to comparepublic SDVariable scalarFloorMod(String name, SDVariable in, Number value)
name
- Name of the output variablein
- Input variablevalue
- Scalar value to comparepublic SDVariable scalarMax(SDVariable in, Number value)
in
- Input variablevalue
- Scalar value to comparepublic SDVariable scalarMax(String name, SDVariable in, Number value)
name
- Name of the output variablein
- Input variablevalue
- Scalar value to comparepublic SDVariable scalarMin(SDVariable in, Number value)
in
- Input variablevalue
- Scalar value to comparepublic SDVariable scalarMin(String name, SDVariable in, Number value)
name
- Name of the output variablein
- Input variablevalue
- Scalar value to comparepublic SDVariable scalarSet(SDVariable in, Number set)
in
- Input variableset
- Value to setpublic SDVariable scalarSet(String name, SDVariable in, Number set)
name
- Name of the output variablein
- Input variableset
- Value to setpublic SDVariable scatterAdd(SDVariable ref, SDVariable indices, SDVariable updates)
public SDVariable scatterAdd(String name, SDVariable ref, SDVariable indices, SDVariable updates)
name
- Name of the output variableref
- Initial/source variableindices
- Indices arrayupdates
- Updates to add to the initial/source arraypublic SDVariable scatterDiv(SDVariable ref, SDVariable indices, SDVariable updates)
public SDVariable scatterDiv(String name, SDVariable ref, SDVariable indices, SDVariable updates)
name
- Name of the output variableref
- Initial/source variableindices
- Indices arrayupdates
- Updates to add to the initial/source arraypublic SDVariable scatterMax(SDVariable ref, SDVariable indices, SDVariable updates)
public SDVariable scatterMax(String name, SDVariable ref, SDVariable indices, SDVariable updates)
name
- Name of the output variableref
- Initial/source variableindices
- Indices arrayupdates
- Updates to add to the initial/source arraypublic SDVariable scatterMin(SDVariable ref, SDVariable indices, SDVariable updates)
public SDVariable scatterMin(String name, SDVariable ref, SDVariable indices, SDVariable updates)
name
- Name of the output variableref
- Initial/source variableindices
- Indices arrayupdates
- Updates to add to the initial/source arraypublic SDVariable scatterMul(SDVariable ref, SDVariable indices, SDVariable updates)
public SDVariable scatterMul(String name, SDVariable ref, SDVariable indices, SDVariable updates)
name
- Name of the output variableref
- Initial/source variableindices
- Indices arrayupdates
- Updates to add to the initial/source arraypublic SDVariable scatterSub(SDVariable ref, SDVariable indices, SDVariable updates)
public SDVariable scatterSub(String name, SDVariable ref, SDVariable indices, SDVariable updates)
name
- Name of the output variableref
- Initial/source variableindices
- Indices arrayupdates
- Updates to add to the initial/source arraypublic SDVariable scatterUpdate(SDVariable ref, SDVariable indices, SDVariable updates)
public SDVariable scatterUpdate(String name, SDVariable ref, SDVariable indices, SDVariable updates)
name
- Name of the output variableref
- Initial/source variableindices
- Indices arrayupdates
- Updates to add to the initial/source arraypublic SDVariable segmentMax(SDVariable data, SDVariable segmentIds)
public SDVariable segmentMax(String name, SDVariable data, SDVariable segmentIds)
unsortedSegmentMax(String, SDVariable, SDVariable, int)
for the same op without this sorted requirementname
- Name of the output variable. May be nulldata
- Data to perform segment max onsegmentIds
- Variable for the segment IDspublic SDVariable segmentMean(SDVariable data, SDVariable segmentIds)
public SDVariable segmentMean(String name, SDVariable data, SDVariable segmentIds)
unsortedSegmentMean(String, SDVariable, SDVariable, int)
for the same op without this sorted requirementname
- Name of the output variable. May be nulldata
- Data to perform segment max onsegmentIds
- Variable for the segment IDspublic SDVariable segmentMin(SDVariable data, SDVariable segmentIds)
public SDVariable segmentMin(String name, SDVariable data, SDVariable segmentIds)
unsortedSegmentMin(String, SDVariable, SDVariable, int)
for the same op without this sorted requirementname
- Name of the output variable. May be nulldata
- Data to perform segment max onsegmentIds
- Variable for the segment IDspublic SDVariable segmentProd(SDVariable data, SDVariable segmentIds)
public SDVariable segmentProd(String name, SDVariable data, SDVariable segmentIds)
unsortedSegmentProd(String, SDVariable, SDVariable, int)
for the same op without this sorted requirementname
- Name of the output variable. May be nulldata
- Data to perform segment max onsegmentIds
- Variable for the segment IDspublic SDVariable segmentSum(SDVariable data, SDVariable segmentIds)
public SDVariable segmentSum(String name, SDVariable data, SDVariable segmentIds)
unsortedSegmentSum(String, SDVariable, SDVariable, int)
for the same op without this sorted requirementname
- Name of the output variable. May be nulldata
- Data to perform segment max onsegmentIds
- Variable for the segment IDspublic SDVariable sequenceMask(SDVariable lengths, int maxLen, DataType dataType)
public SDVariable sequenceMask(String name, SDVariable lengths, int maxLen, DataType dataType)
public SDVariable sequenceMask(String name, SDVariable lengths, DataType dataType)
public SDVariable sequenceMask(SDVariable lengths, DataType dataType)
public SDVariable sequenceMask(SDVariable lengths, SDVariable maxLen, DataType dataType)
public SDVariable sequenceMask(String name, SDVariable lengths, SDVariable maxLen, DataType dataType)
name
- Name of the output variablelengths
- Lengths of the sequencesmaxLen
- Maximum sequence lengthpublic SDVariable shape(SDVariable input)
input
- Input variablepublic SDVariable shape(String name, SDVariable input)
name
- Name of the output variableinput
- Input variablepublic SDVariable size(SDVariable in)
in
- Input variablepublic SDVariable size(String name, SDVariable in)
name
- Name of the output variablein
- Input variablepublic SDVariable sizeAt(SDVariable in, int dimension)
sizeAt(String, SDVariable, int)
public SDVariable sizeAt(String name, SDVariable in, int dimension)
name
- Name of the output variablein
- Input variabledimension
- Dimension to get size ofpublic SDVariable slice(SDVariable input, int[] begin, int[] size)
slice(String, SDVariable, int[], int[])
public SDVariable slice(SDVariable input, SDVariable begin, SDVariable size)
public SDVariable slice(String name, SDVariable input, int[] begin, int[] size)
name
- Output variable nameinput
- Variable to get subset ofbegin
- Beginning index. Must be same length as rank of input arraysize
- Size of the output array. Must be same length as rank of input arraypublic SDVariable slice(String name, SDVariable input, @NonNull SDVariable begin, @NonNull SDVariable size)
public SDVariable squaredNorm(SDVariable x, int... dimensions)
norm2(String, SDVariable, int...)
public SDVariable squaredNorm(String name, SDVariable x, boolean keepDims, int... dimensions)
norm2(String, SDVariable, boolean, int...)
public SDVariable squaredNorm(String name, SDVariable x, int... dimensions)
norm2(String, SDVariable, int...)
public SDVariable squaredNorm(SDVariable x, boolean keepDims, int... dimensions)
norm2(String, SDVariable, boolean, int...)
public SDVariable squeeze(SDVariable x, int axis)
squeeze(String, SDVariable, int)
public SDVariable squeeze(String name, SDVariable x, int axis)
name
- Name of the output variablex
- Input variableaxis
- Size 1 dimension to removepublic SDVariable stack(int axis, SDVariable... values)
stack(String, int, SDVariable...)
public SDVariable stack(String name, int axis, SDVariable... values)
name
- Name of the output variableaxis
- Axis to stack onvalues
- Input variables to stack. Must have the same shape for all inputsunstack(String[], SDVariable, int, int)
public SDVariable standardDeviation(SDVariable x, boolean biasCorrected, int... dimensions)
public SDVariable standardDeviation(String name, SDVariable x, boolean biasCorrected, int... dimensions)
name
- Output variable namex
- Input variablebiasCorrected
- 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 performedpublic SDVariable standardDeviation(String name, SDVariable x, boolean biasCorrected, boolean keepDims, int... dimensions)
x
- Input variablebiasCorrected
- 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 performedpublic SDVariable stridedSlice(SDVariable input, int[] begin, int[] end, int[] strides)
public SDVariable stridedSlice(String name, SDVariable input, int[] begin, int[] end, int[] strides)
public SDVariable stridedSlice(String name, SDVariable in, int[] begin, int[] end, int[] strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
public SDVariable stridedSlice(SDVariable input, long[] begin, long[] end, long[] strides)
public SDVariable stridedSlice(String name, SDVariable input, long[] begin, long[] end, long[] strides)
name
- Output variable nameinput
- Variable to get subset ofbegin
- Beginning index. Must be same length as rank of input arrayend
- End index. Must be same length as the rank of the arraystrides
- Stride ("step size") for each dimension. Must be same length as the rank of the array. For example,
stride of 2 means take every second element.public SDVariable stridedSlice(String name, SDVariable in, long[] begin, long[] end, long[] strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
stridedSlice(SDVariable, long[], long[], long[])
with some extra mask arrays
as described below.name
- Output variable namein
- Variable to get subset ofbegin
- Beginning indexend
- End indexstrides
- Stride ("step size") for each dimension. For example,
stride of 2 means take every second element.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 dimensionspublic SDVariable stridedSlice(SDVariable in, int[] begin, int[] end, int[] strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
public SDVariable stridedSlice(SDVariable in, long[] begin, long[] end, long[] strides, int beginMask, int endMask, int ellipsisMask, int newAxisMask, int shrinkAxisMask)
public SDVariable sum(SDVariable x, int... dimensions)
x
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable sum(String name, SDVariable x, int... dimensions)
x
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable sum(String name, SDVariable x, boolean keepDims, int... dimensions)
name
- Output variable namex
- Input variablekeepDims
- 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 performedpublic SDVariable sum(SDVariable x, boolean keepDims, int... dimensions)
sum(String, SDVariable, boolean, int...)
public SDVariable tensorMmul(SDVariable x, SDVariable y, int[][] dimensions)
x
- y
- dimensions
- public SDVariable tensorMmul(String name, SDVariable x, SDVariable y, int[][] dimensions)
x
- Input variable xy
- Input variable ydimensions
- dimensionspublic SDVariable tile(SDVariable x, int... repeat)
tile(String, SDVariable, int...)
public SDVariable tile(String name, SDVariable x, int... repeat)
name
- Output variable namex
- Input variablerepeat
- Number of times to repeat in each axis. Must have length equal to the rank of the input arraypublic SDVariable tile(SDVariable x, SDVariable repeat)
tile(String, SDVariable, int...)
public SDVariable tile(String name, SDVariable x, SDVariable repeat)
tile(String, SDVariable, int...)
public SDVariable transpose(SDVariable x)
x
- Input variablepublic SDVariable transpose(String name, SDVariable x)
name
- Output variable namex
- Input variablepublic SDVariable unsortedSegmentMax(SDVariable data, SDVariable segmentIds, int numSegments)
public SDVariable unsortedSegmentMax(String name, SDVariable data, SDVariable segmentIds, int numSegments)
segmentMax(String, SDVariable, SDVariable)
but without
the requirement for the indices to be sorted.name
- Name of the output variabledata
- Data (variable) to perform unsorted segment max onsegmentIds
- Variable for the segment IDsnumSegments
- Number of segmentspublic SDVariable unsortedSegmentMean(SDVariable data, SDVariable segmentIds, int numSegments)
public SDVariable unsortedSegmentMean(String name, SDVariable data, SDVariable segmentIds, int numSegments)
segmentMean(String, SDVariable, SDVariable)
but without
the requirement for the indices to be sorted.name
- Name of the output variabledata
- Data (variable) to perform unsorted segment mean onsegmentIds
- Variable for the segment IDsnumSegments
- Number of segmentspublic SDVariable unsortedSegmentMin(SDVariable data, SDVariable segmentIds, int numSegments)
public SDVariable unsortedSegmentMin(String name, SDVariable data, SDVariable segmentIds, int numSegments)
segmentMin(String, SDVariable, SDVariable)
but without
the requirement for the indices to be sorted.name
- Name of the output variabledata
- Data (variable) to perform unsorted segment min onsegmentIds
- Variable for the segment IDsnumSegments
- Number of segmentspublic SDVariable unsortedSegmentProd(SDVariable data, SDVariable segmentIds, int numSegments)
public SDVariable unsortedSegmentProd(String name, SDVariable data, SDVariable segmentIds, int numSegments)
segmentProd(String, SDVariable, SDVariable)
but without
the requirement for the indices to be sorted.name
- Name of the output variabledata
- Data (variable) to perform unsorted segment product onsegmentIds
- Variable for the segment IDspublic SDVariable unsortedSegmentSqrtN(SDVariable data, SDVariable segmentIds, int numSegments)
public SDVariable unsortedSegmentSqrtN(String name, SDVariable data, SDVariable segmentIds, int numSegments)
name
- Name of the output variabledata
- Data (variable) to perform unsorted segment sqrtN onsegmentIds
- Variable for the segment IDspublic SDVariable unsortedSegmentSum(@NonNull SDVariable data, @NonNull SDVariable segmentIds, int numSegments)
public SDVariable unsortedSegmentSum(String name, @NonNull SDVariable data, @NonNull SDVariable segmentIds, int numSegments)
segmentSum(String, SDVariable, SDVariable)
but without
the requirement for the indices to be sorted.name
- Name of the output variabledata
- Data (variable) to perform unsorted segment sum onsegmentIds
- Variable for the segment IDsnumSegments
- Number of segmentspublic SDVariable[] unstack(SDVariable value, int axis)
unstack(String[], SDVariable, int, int)
public SDVariable[] unstack(String[] names, @NonNull SDVariable value, int axis)
unstack(String[], SDVariable, int, int)
public SDVariable[] unstack(@NonNull SDVariable value, int axis, int num)
unstack(String[], SDVariable, int, int)
public SDVariable[] unstack(String[] names, @NonNull SDVariable value, int axis, int num)
names
- Output variable names. May be nullvalue
- Input variable to unstackaxis
- Axis to unstack onnum
- Number of output variablesstack(String, int, SDVariable...)
public SDVariable variance(@NonNull SDVariable x, boolean biasCorrected, int... dimensions)
public SDVariable variance(String name, @NonNull SDVariable x, boolean biasCorrected, int... dimensions)
name
- Output variable namex
- Input variablebiasCorrected
- 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 performedpublic SDVariable variance(String name, @NonNull SDVariable x, boolean biasCorrected, boolean keepDims, int... dimensions)
name
- Output variable namex
- Input variablebiasCorrected
- 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 performedpublic SDVariable zerosLike(@NonNull SDVariable input)
input
- Input SDVariablepublic SDVariable zerosLike(String name, @NonNull SDVariable input)
name
- Name of the new SDVariableinput
- Input SDVariablepublic SDVariable any(SDVariable x, int... dimensions)
public SDVariable any(String name, SDVariable x, int... dimensions)
name
- Name of the output variablex
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable all(SDVariable x, int... dimensions)
public SDVariable all(String name, SDVariable x, int... dimensions)
name
- Name of the output variablex
- Input variabledimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable[] whileLoop(@NonNull SDVariable[] loopVars, @NonNull SameDiffSingleLambda cond, @NonNull SameDiffLambda body)
public SDVariable[] whileLoop(String loopName, @NonNull SDVariable[] loopVars, @NonNull SameDiffSingleLambda cond, @NonNull SameDiffLambda body)
public SDVariable[] whileLoop(String[] outputNames, String loopName, @NonNull SDVariable[] loopVars, @NonNull SameDiffSingleLambda cond, @NonNull SameDiffLambda body)
outputNames
- Names to give the output variables. If null, doesn't renameloopName
- The name of the loop block and frame (must be unique). If null, uses "if"loopVars
- Loop variables' inputscond
- A lambda evaluating to the loop conditionbody
- A lambda doing the loop operation and returning the new loop variable valuespublic SDVariable ifCond(@NonNull SameDiffNoArgSingleLambda cond, @NonNull SameDiffNoArgSingleLambda trueBody, @NonNull SameDiffNoArgSingleLambda falseBody)
public SDVariable ifCond(String ifName, @NonNull SameDiffNoArgSingleLambda cond, @NonNull SameDiffNoArgSingleLambda trueBody, @NonNull SameDiffNoArgSingleLambda falseBody)
public SDVariable ifCond(String outputName, String ifName, @NonNull SameDiffNoArgSingleLambda cond, @NonNull SameDiffNoArgSingleLambda trueBody, @NonNull SameDiffNoArgSingleLambda falseBody)
outputName
- Name to give the output variable. If null, doesn't renameifName
- The name of the if block. If null, uses "if"cond
- A lambda evaluating to the if conditiontrueBody
- A lambda to be executed if cond is true (the if block)falseBody
- A lambda to be executed if cond is false (the else block)Copyright © 2019. All rights reserved.