public class SameDiff extends Object
You define a graph symbolically.
That graph accumulates operations.
In order to execute the graph, you run
exec() to get all the operations
exec(List) for an already created set of ops
execAndEndResult() for the end result only
execAndEndResult(List) for a cached set of ops
| Modifier and Type | Method and Description |
|---|---|
SDVariable |
abs(SDVariable x)
Elementwise absolute value operation: out = abs(x)
|
SDVariable |
abs(String name,
SDVariable x)
Elementwise absolute value operation: out = abs(x)
|
SDVariable |
acos(SDVariable x)
Elementwise acos (arccosine, inverse cosine) operation: out = arccos(x)
|
SDVariable |
acos(String name,
SDVariable x)
Elementwise acos (arccosine, inverse cosine) operation: out = arccos(x)
|
SDVariable |
acosh(SDVariable x)
Elementwise acosh (inverse hyperbolic cosine) function: out = acosh(x)
|
SDVariable |
acosh(String name,
SDVariable x)
Elementwise acosh (inverse hyperbolic cosine) function: out = acosh(x)
|
void |
addArgsFor(SDVariable[] variables,
DifferentialFunction function)
Adds incoming arguments for the specified differential function to the graph
|
void |
addArgsFor(String[] variables,
DifferentialFunction function)
Adds incoming arguments for the specified differential function to the graph
|
void |
addAsPlaceHolder(String varName)
Add this vertex id as a place holder
|
void |
addOutgoingFor(SDVariable[] variables,
DifferentialFunction function)
Adds outgoing arguments to the graph for the specified DifferentialFunction
Also checks for input arguments and updates the graph adding an appropriate edge when the full graph is declared.
|
void |
addOutgoingFor(String[] varNames,
DifferentialFunction function)
Adds outgoing arguments to the graph for the specified DifferentialFunction
Also checks for input arguments and updates the graph adding an appropriate edge when the full graph is declared.
|
void |
addPropertyForFunction(DifferentialFunction functionFor,
String propertyName,
INDArray property)
Add a property for the given function
|
void |
addPropertyForFunction(DifferentialFunction functionFor,
String propertyName,
long property)
Add a property for the given function
|
void |
addPropertyToResolve(DifferentialFunction forFunction,
String arrayName)
Adds a property that needs to be resolve for later.
|
void |
addVariable(SDVariable variable)
Add the specified variable to this SameDiff instance
|
void |
addVariableMappingForField(DifferentialFunction function,
String fieldName,
String varName)
Adds a field name -> variable name mapping for a given function.
This is used for model import where there is an unresolved variable at the time of calling any GraphMapper.importGraph(File)
. |
void |
addVarNameForImport(String varName)
Marks a variable name as imported.
|
boolean |
allPlaceHolderVariablesResolved()
Returns true if all place holder variables are resolved.
A place holder variable is resolved when getVariable(String) getArr() does not return null and
the shape is properly resolved. |
SDVariable |
amax(SDVariable in,
int... dimensions)
Absolute max array reduction operation, optionally along specified dimensions: out = max(abs(x))
|
SDVariable |
amax(String name,
SDVariable in,
int... dimensions)
Absolute max array reduction operation, optionally along specified dimensions: out = max(abs(x))
|
SDVariable |
amean(SDVariable in,
int... dimensions)
Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
|
SDVariable |
amean(String name,
SDVariable in,
int... dimensions)
Absolute mean array reduction operation, optionally along specified dimensions: out = mean(abs(x))
|
SDVariable |
amin(SDVariable in,
int... dimensions)
Absolute min array reduction operation, optionally along specified dimensions: out = min(abs(x))
|
SDVariable |
amin(String name,
SDVariable in,
int... dimensions)
Absolute min array reduction operation, optionally along specified dimensions: out = min(abs(x))
|
SDVariable |
and(SDVariable x,
SDVariable y)
Boolean AND operation: elementwise (x != 0) && (y != 0)
If x and y arrays have equal shape, the output shape is the same as these inputs. Note: supports broadcasting if x and y have different shapes and are broadcastable. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
and(String name,
SDVariable x,
SDVariable y)
Boolean AND operation: elementwise (x != 0) && (y != 0)
If x and y arrays have equal shape, the output shape is the same as these inputs. Note: supports broadcasting if x and y have different shapes and are broadcastable. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
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 |
boolean |
arrayAlreadyExistsForVarName(String varName)
Returns true if the given vertex id and
INDArray already exist. |
ByteBuffer |
asFlatBuffers()
This method exports the current SameDiff instance into FlatBuffers format, returning the array ops and
all arrays as a ByteBuffer containing the FlatBuffers format data
|
ByteBuffer |
asFlatBuffers(ExecutorConfiguration configuration)
This method exports the current SameDiff instance into FlatBuffers format, returning the array ops and
all arrays as a ByteBuffer containing the FlatBuffers format data
|
void |
asFlatFile(File file)
This method converts SameDiff instance to FlatBuffers and saves it to file which can be restored later
|
void |
asFlatFile(File file,
ExecutorConfiguration configuration)
This method converts SameDiff instance to FlatBuffers and saves it to file which can be restored later
|
protected int |
asFlatNode(DifferentialFunction node,
com.google.flatbuffers.FlatBufferBuilder bufferBuilder,
List<SDVariable> variables,
Map<String,Integer> reverseMap,
Map<String,Integer> forwardMap,
Map<String,Integer> framesMap,
AtomicInteger idCounter) |
protected int |
asFlatNode(String name,
SameDiff scope,
com.google.flatbuffers.FlatBufferBuilder bufferBuilder) |
String |
asFlatPrint()
This method returns a text representation of the "flattened" graph.
|
SDVariable |
asin(SDVariable x)
Elementwise asin (arcsin, inverse sine) operation: out = arcsin(x)
|
SDVariable |
asin(String name,
SDVariable x)
Elementwise asin (arcsin, inverse sine) operation: out = arcsin(x)
|
SDVariable |
asinh(SDVariable x)
Elementwise asinh (inverse hyperbolic sine) function: out = asinh(x)
|
SDVariable |
asinh(String name,
SDVariable x)
Elementwise asinh (inverse hyperbolic sine) function: out = asinh(x)
|
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).
|
void |
associateArrayWithVariable(INDArray arr,
SDVariable variable)
Associate the array with the given variable.
|
void |
associateArrayWithVariable(INDArray arr,
String variable)
Associate the array with the given variable.
|
protected void |
associateSameDiffWithOpsAndVariables()
Associate the current SameDiff instance with all ops and variables.
|
SDVariable |
asum(SDVariable in,
int... dimensions)
Absolute sum array reduction operation, optionally along specified dimensions: out = sum(abs(x))
|
SDVariable |
asum(String name,
SDVariable in,
int... dimensions)
Absolute sum array reduction operation, optionally along specified dimensions: out = sum(abs(x))
|
SDVariable |
atan(SDVariable x)
Elementwise atan (arctangent, inverse tangent) operation: out = arctangent(x)
|
SDVariable |
atan(String name,
SDVariable x)
Elementwise atan (arctangent, inverse tangent) operation: out = arctangent(x)
|
SDVariable |
atan2(SDVariable y,
SDVariable x)
Elementwise atan (arctangent, inverse tangent) operation: out = atan2(x,y).
|
SDVariable |
atan2(String name,
SDVariable y,
SDVariable x)
Elementwise atan (arctangent, inverse tangent) operation: out = atan2(x,y).
|
SDVariable |
atanh(SDVariable x)
Elementwise atanh (inverse hyperbolic tangent) function: out = atanh(x)
|
SDVariable |
atanh(String name,
SDVariable x)
Elementwise atanh (inverse hyperbolic tangent) function: out = atanh(x)
|
SDVariable |
avgPooling2d(SDVariable input,
Pooling2DConfig pooling2DConfig)
2D Convolution layer operation - average pooling 2d
|
SDVariable |
avgPooling2d(String name,
SDVariable input,
Pooling2DConfig pooling2DConfig)
2D Convolution layer operation - average pooling 2d
|
SDVariable |
avgPooling3d(SDVariable input,
Pooling3DConfig pooling3DConfig)
3D convolution layer operation - average pooling 3d
|
SDVariable |
avgPooling3d(String name,
SDVariable input,
Pooling3DConfig pooling3DConfig)
3D convolution layer operation - average pooling 3d
|
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 |
batchNorm(SDVariable input,
SDVariable mean,
SDVariable variance,
SDVariable gamma,
SDVariable beta,
boolean applyGamma,
boolean applyBeta,
double epsilon)
Batch norm operation.
|
SDVariable |
batchNorm(String name,
SDVariable input,
SDVariable mean,
SDVariable variance,
SDVariable gamma,
SDVariable beta,
boolean applyGamma,
boolean applyBeta,
double epsilon)
Batch norm operation.
|
SDVariable |
batchToSpace(SDVariable x,
int[] blocks,
int[][] crops) |
SDVariable |
batchToSpace(String name,
SDVariable x,
int[] blocks,
int[][] crops)
Convolution 2d layer batch to space operation on 4d input.
|
SDVariable |
biasAdd(SDVariable input,
SDVariable bias) |
SDVariable |
biasAdd(String name,
SDVariable input,
SDVariable bias)
Bias addition operation: a special case of addition, typically used with CNN 4D activations and a 1D bias vector
|
SDVariable |
ceil(SDVariable x)
Element-wise ceiling function: out = ceil(x).
|
SDVariable |
ceil(String name,
SDVariable x)
Element-wise ceiling function: out = ceil(x).
|
void |
clearExecutionCache()
Clear the execution cache, if it is present
|
SDVariable |
clipByNorm(SDVariable x,
double clipValue)
Clipping by L2 norm
if l2Norm(x) < clipValue, then input is returned unmodifed Otherwise, out[i] = in[i] * clipValue / l2Norm(in) |
SDVariable |
clipByNorm(SDVariable x,
double clipValue,
int... dimensions)
Clipping by L2 norm, optionally along dimension(s)
if l2Norm(x,dimension) < clipValue, then input is returned unmodifed Otherwise, out[i] = in[i] * clipValue / l2Norm(in, dimensions) where each value is clipped according to the corresponding l2Norm along the specified dimensions |
SDVariable |
clipByNorm(String name,
SDVariable x,
double clipValue)
Clipping by L2 norm
if l2Norm(x) < clipValue, then input is returned unmodifed Otherwise, out[i] = in[i] * clipValue / l2Norm(in) |
SDVariable |
clipByNorm(String name,
SDVariable x,
double clipValue,
int... dimensions)
Clipping by L2 norm, optionally along dimension(s)
if l2Norm(x,dimension) < clipValue, then input is returned unmodifed Otherwise, out[i] = in[i] * clipValue / l2Norm(in, dimensions) where each value is clipped according to the corresponding l2Norm along the specified dimensions |
SDVariable |
clipByValue(SDVariable x,
double clipValueMin,
double clipValueMax)
Element-wise clipping function:
out[i] = in[i] if in[i] >= clipValueMin and in[i] <= clipValueMax out[i] = clipValueMin if in[i] < clipValueMin out[i] = clipValueMax if in[i] > clipValueMax |
SDVariable |
clipByValue(String name,
SDVariable x,
double clipValueMin,
double clipValueMax)
Element-wise clipping function:
out[i] = in[i] if in[i] >= clipValueMin and in[i] <= clipValueMax out[i] = clipValueMin if in[i] < clipValueMin out[i] = clipValueMax if in[i] > clipValueMax |
SDVariable |
col2Im(SDVariable in,
Conv2DConfig config)
col2im operation for use in 2D convolution operations.
|
SDVariable |
col2Im(String name,
SDVariable in,
Conv2DConfig config)
col2im operation for use in 2D convolution operations.
|
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 |
confusionMatrix(SDVariable labels,
SDVariable predictions) |
SDVariable |
confusionMatrix(SDVariable labels,
SDVariable pred,
Integer numClasses) |
SDVariable |
confusionMatrix(SDVariable labels,
SDVariable pred,
Integer numClasses,
SDVariable weights) |
SDVariable |
confusionMatrix(SDVariable labels,
SDVariable pred,
SDVariable weights) |
SDVariable |
confusionMatrix(String name,
SDVariable labels,
SDVariable pred)
Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
which are represented as integer values.
|
SDVariable |
confusionMatrix(String name,
SDVariable labels,
SDVariable pred,
Integer numClasses)
Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
which are represented as integer values.
For example, if labels = [0, 1, 1], predicted = [0, 2, 1], and numClasses=4 then output is: [1, 0, 0, 0] [0, 1, 1, 0] [0, 0, 0, 0] [0, 0, 0, 0] |
SDVariable |
confusionMatrix(String name,
SDVariable labels,
SDVariable pred,
Integer numClasses,
SDVariable weights)
Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
which are represented as integer values.
For example, if labels = [0, 1, 1], predicted = [0, 2, 1], numClasses = 4, and weights = [1, 2, 3] [1, 0, 0, 0] [0, 3, 2, 0] [0, 0, 0, 0] [0, 0, 0, 0] |
SDVariable |
confusionMatrix(String name,
SDVariable labels,
SDVariable pred,
SDVariable weights)
Compute the 2d confusion matrix of size [numClasses, numClasses] from a pair of labels and predictions, both of
which are represented as integer values.
|
SDVariable |
constant(SDVariable value,
long... shape)
Return a variable of given shape in which all values have a given constant value.
|
SDVariable |
constant(String name,
SDVariable value,
long... shape)
Return a variable of given shape in which all values have a given constant value.
|
SDVariable |
conv1d(SDVariable input,
SDVariable weights,
Conv1DConfig conv1DConfig)
1D Convolution layer operation - Conv1d
|
SDVariable |
conv1d(String name,
SDVariable input,
SDVariable weights,
Conv1DConfig conv1DConfig)
Conv1d operation.
|
SDVariable |
conv2d(SDVariable[] inputs,
Conv2DConfig config)
2D Convolution operation with optional bias
|
SDVariable |
conv2d(SDVariable layerInput,
SDVariable weights,
Conv2DConfig config)
2D Convolution operation (without bias)
|
SDVariable |
conv2d(SDVariable layerInput,
SDVariable weights,
SDVariable bias,
Conv2DConfig config)
2D Convolution operation with optional bias
|
SDVariable |
conv2d(String name,
SDVariable[] inputs,
Conv2DConfig config)
2D Convolution operation with optional bias
|
SDVariable |
conv3d(SDVariable input,
SDVariable weights,
Conv3DConfig conv3DConfig)
Convolution 3D operation without bias
|
SDVariable |
conv3d(SDVariable input,
SDVariable weights,
SDVariable bias,
Conv3DConfig conv3DConfig)
Convolution 3D operation with optional bias
|
SDVariable |
conv3d(String name,
SDVariable input,
SDVariable weights,
Conv3DConfig conv3DConfig)
Convolution 3D operation without bias
|
SDVariable |
conv3d(String name,
SDVariable input,
SDVariable weights,
SDVariable bias,
Conv3DConfig conv3DConfig)
Convolution 3D operation with optional bias
|
SDVariable |
cos(SDVariable x)
Elementwise cosine operation: out = cos(x)
|
SDVariable |
cos(String name,
SDVariable x)
Elementwise cosine operation: out = cos(x)
|
SDVariable |
cosh(SDVariable x)
Elementwise cosh (hyperbolic cosine) operation: out = cosh(x)
|
SDVariable |
cosh(String name,
SDVariable x)
Elementwise cosh (hyperbolic cosine) operation: out = cosh(x)
|
SDVariable |
cosineDistance(SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
cosineDistance(String name,
SDVariable x,
SDVariable y,
int... dimensions)
Cosine distance reduction operation.
|
SDVariable |
cosineSimilarity(SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
cosineSimilarity(String name,
SDVariable x,
SDVariable y,
int... dimensions)
Cosine similarity pairwise reduction operation.
|
SDVariable |
countNonZero(SDVariable input,
int... dimensions)
Count non zero array reduction operation, optionally along specified dimensions: out = count(x != 0)
|
SDVariable |
countNonZero(String name,
SDVariable input,
int... dimensions)
Count non zero array reduction operation, optionally along specified dimensions: out = count(x != 0)
|
SDVariable |
countZero(SDVariable input,
int... dimensions)
Count zero array reduction operation, optionally along specified dimensions: out = count(x == 0)
|
SDVariable |
countZero(String name,
SDVariable input,
int... dimensions)
Count zero array reduction operation, optionally along specified dimensions: out = count(x == 0)
|
static SameDiff |
create()
Create a new (empty) SameDiff instance without any functions or variables
|
static SameDiff |
create(SameDiff originalSameDiff)
Create a new SameDiff instance from an existing instance.
|
void |
createGradFunction()
Create the gradient function (for calculating gradients via
execBackwards()) if it is not already defined. |
SDVariable |
cross(SDVariable a,
SDVariable b) |
SDVariable |
cross(String name,
SDVariable a,
SDVariable b)
Returns the pair-wise cross product of equal size arrays a and b: a x b = ||a||x||b|| sin(theta).
|
SDVariable |
cube(SDVariable x)
Element-wise cube function: out = x^3
|
SDVariable |
cube(String name,
SDVariable x)
Element-wise cube function: out = x^3
|
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 |
deconv2d(SDVariable[] inputs,
DeConv2DConfig deconv2DConfig)
2D deconvolution operation with or without optional bias
|
SDVariable |
deconv2d(SDVariable layerInput,
SDVariable weights,
DeConv2DConfig deconv2DConfig)
2D deconvolution operation without bias
|
SDVariable |
deconv2d(SDVariable layerInput,
SDVariable weights,
SDVariable bias,
DeConv2DConfig deconv2DConfig)
2D deconvolution operation with optional bias
|
SDVariable |
deconv2d(String name,
SDVariable[] inputs,
DeConv2DConfig deconv2DConfig)
2D deconvolution operation with or without optional bias
|
Collection<String> |
definedFunctionNames()
The set of defined SameDiff function names.
|
void |
defineFunction(String function,
SameDiffFunctionDefinition functionDefinition) |
void |
defineFunction(String function,
SameDiffFunctionDefinition functionDefinition,
Map<String,INDArray> inputs) |
SameDiff |
defineFunction(String function,
SameDiffFunctionDefinition functionDefinition,
SDVariable[] variables) |
SDVariable |
depthToSpace(SDVariable x,
int blockSize,
String dataFormat)
Convolution 2d layer batch to space operation on 4d input.
Reduces input channels dimension by rearranging data into a larger spatial dimensions Example: if input has shape [mb, 8, 2, 2] and block size is 2, then output size is [mb, 8/(2*2), 2*2, 2*2] = [mb, 2, 4, 4] |
SDVariable |
depthToSpace(String name,
SDVariable x,
int blockSize,
String dataFormat)
Convolution 2d layer batch to space operation on 4d input.
Reduces input channels dimension by rearranging data into a larger spatial dimensions Example: if input has shape [mb, 8, 2, 2] and block size is 2, then output size is [mb, 8/(2*2), 2*2, 2*2] = [mb, 2, 4, 4] |
SDVariable |
depthWiseConv2d(SDVariable[] inputs,
Conv2DConfig depthConv2DConfig)
Depth-wise convolution 2D operation.
|
SDVariable |
depthWiseConv2d(SDVariable layerInput,
SDVariable depthWeights,
Conv2DConfig config)
Depth-wise 2D convolution operation without bias
|
SDVariable |
depthWiseConv2d(SDVariable layerInput,
SDVariable depthWeights,
SDVariable bias,
Conv2DConfig config)
Depth-wise 2D convolution operation with optional bias
|
SDVariable |
depthWiseConv2d(String name,
SDVariable[] inputs,
Conv2DConfig depthConv2DConfig)
Depth-wise convolution 2D operation.
|
SDVariable |
diag(SDVariable x) |
SDVariable |
diag(String name,
SDVariable x)
Returns an output variable with diagonal values equal to the specified values; off-diagonal values will be set to 0
For example, if input = [1,2,3], then output is given by: [ 1, 0, 0] [ 0, 2, 0] [ 0, 0, 3] Higher input ranks are also supported: if input has shape [a,...,R-1] then output[i,...,k,i,...,k] = input[i,...,k]. |
SDVariable |
diagPart(SDVariable x) |
SDVariable |
diagPart(String name,
SDVariable x)
Extract the diagonal part from the input array.
If input is [ 1, 0, 0] [ 0, 2, 0] [ 0, 0, 3] then output is [1, 2, 3]. Supports higher dimensions: in general, out[i,...,k] = in[i,...,k,i,...,k] |
SDVariable |
dilation2D(SDVariable df,
SDVariable weights,
int[] strides,
int[] rates,
boolean isSameMode)
TODO doc string
|
SDVariable |
dilation2D(String name,
SDVariable df,
SDVariable weights,
int[] strides,
int[] rates,
boolean isSameMode)
TODO doc string
|
SameDiff |
disableDebugging()
Clears debugging state and disables debug mode.
|
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 |
dropout(SDVariable input,
double inputRetainProbability) |
SDVariable |
dropout(String name,
SDVariable input,
double inputRetainProbability) |
SameDiff |
dup()
Clone/duplicate the SameDiff instance, including arrays etc.
|
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 |
elu(SDVariable x)
Element-wise exponential linear unit (ELU) function:
out = x if x > 0 out = a * (exp(x) - 1) if x <= 0 with constant a = 1.0 |
SDVariable |
elu(String name,
SDVariable x)
Element-wise exponential linear unit (ELU) function:
out = x if x > 0 out = a * (exp(x) - 1) if x <= 0 with constant a = 1.0 |
SDVariable |
eluDerivative(SDVariable x)
Element-wise derivative exponential linear unit (ELU) function, dOut/dIn given input.
|
SDVariable |
eluDerivative(String name,
SDVariable x)
Element-wise derivative exponential linear unit (ELU) function, dOut/dIn given input.
|
SameDiff |
enableDebugMode()
Enables tracing of graphs automatically.
|
SDVariable |
entropy(SDVariable in,
int... dimensions)
Entropy reduction: -sum(x * log(x))
|
SDVariable |
entropy(String name,
SDVariable in,
int... dimensions)
Entropy reduction: -sum(x * log(x))
|
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. |
boolean |
equals(Object o) |
SDVariable |
erf(SDVariable x)
Element-wise Gaussian error function - out = erf(in)
|
SDVariable |
erf(String name,
SDVariable x)
Element-wise Gaussian error function - out = erf(in)
|
SDVariable |
erfc(SDVariable x)
Element-wise complementary Gaussian error function - out = erfc(in) = 1 - erf(in)
|
SDVariable |
erfc(String name,
SDVariable x)
Element-wise complementary Gaussian error function - out = erfc(in) = 1 - erf(in)
|
SDVariable |
euclideanDistance(SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
euclideanDistance(String name,
SDVariable x,
SDVariable y,
int... dimensions)
Euclidean distance (l2 norm, l2 distance) reduction operation.
|
INDArray[] |
eval(Map<String,INDArray> inputs)
Evaluate the given inputs based on the current graph
|
org.nd4j.linalg.primitives.Pair<Map<SDVariable,DifferentialFunction>,List<DifferentialFunction>> |
exec()
Execute the SameDiff instance using the current state
After execution, the arrays for variables can be obtained using getArrForVarName(String) or
SDVariable.getArr() |
List<DifferentialFunction> |
exec(List<DifferentialFunction> ops)
Executes the list of operations.
|
org.nd4j.linalg.primitives.Pair<Map<SDVariable,DifferentialFunction>,List<DifferentialFunction>> |
exec(String functionName)
Execute the specified SameDiff function instance
|
List<DifferentialFunction> |
exec(String functionName,
List<DifferentialFunction> cachedOps)
Exec the given function given the ops
|
INDArray |
execAndEndResult()
Execute the graph using the current arrays/state and return the array for the final variable in the graph.
After execution, the arrays for other variables can be obtained using getArrForVarName(String)
or SDVariable.getArr() |
INDArray |
execAndEndResult(int outputIndex)
Execute the graph using the current arrays/state and return the (first, and possibly only) array for the specified
variable in the graph.
After execution, the arrays for other variables can be obtained using getArrForVarName(String)
or SDVariable.getArr() |
INDArray |
execAndEndResult(List<DifferentialFunction> ops)
Execute the specified ops and return the output of the last one
|
INDArray |
execAndEndResult(String functionName)
Exec a given SameDiff function instance
|
INDArray[] |
execAndEndResults()
Execute the graph using the current arrays/state and return the array(s) for the final variable in the graph.
After execution, the arrays for other variables can be obtained using getArrForVarName(String)
or SDVariable.getArr() |
INDArray |
execBackwardAndEndResult()
Exec a backwards operation and return the end result
|
org.nd4j.linalg.primitives.Pair<Map<SDVariable,DifferentialFunction>,List<DifferentialFunction>> |
execBackwards()
Execute the gradient (backward pass) function on this graph.
Constructs a backwards graph (differentiating the defined graph) if it does not already exist, and the executes the operations on that graph, calculating gradients for all variables. Note that after execBackwards() has completed, the gradient arrays for a each variable can be accessed using SDVariable.getGradient() followed by SDVariable.getArr() or by using getGradForVariable(String) |
org.nd4j.linalg.primitives.Pair<Map<SDVariable,DifferentialFunction>,List<DifferentialFunction>> |
execWithPlaceHolder(Map<String,INDArray> inputs)
Creates and executes a list of operations based on the given variables passed in.
resolveVariablesWith(Map) is called |
INDArray |
execWithPlaceHolderAndEndResult(Map<String,INDArray> inputs)
Creates and executes a list of operations
|
SDVariable |
exp(SDVariable x)
Elementwise exponent function: out = exp(x) = 2.71828...^x
|
SDVariable |
exp(String name,
SDVariable x)
Elementwise exponent function: out = exp(x) = 2.71828...^x
|
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] |
SDVariable |
expm1(SDVariable x)
Elementwise 1.0 - exponent function: out = 1.0 - exp(x) = 1.0 - 2.71828...^x
|
SDVariable |
expm1(String name,
SDVariable x)
Elementwise 1.0 - exponent function: out = 1.0 - exp(x) = 1.0 - 2.71828...^x
|
SDVariable |
eye(int rows)
Generate a square identity matrix with the specified number of rows.
|
SDVariable |
eye(int rows,
int cols) |
SDVariable |
eye(int rows,
int cols,
int... batchDimension)
|
SDVariable |
eye(SDVariable rows)
As per
eye(int) but with the number of rows specified as a scalar SDVariable |
SDVariable |
eye(SDVariable rows,
SDVariable cols)
As per
eye(int, int) bit with the number of rows/columns specified as scalar SDVariables |
SDVariable |
eye(SDVariable rows,
SDVariable cols,
SDVariable batchDimension)
As per
eye(int, int, int...) bit with the number of rows/columns specified as scalar SDVariables,
and the batch dimension specified as a 1D SDVariable |
SDVariable |
eye(String name,
int rows)
Generate an identity matrix with the specified number of rows and columns.
|
SDVariable |
eye(String name,
int rows,
int cols)
Generate an identity matrix with the specified number of rows and columns
Example:
|
SDVariable |
eye(String name,
int rows,
int cols,
int... batchDimension)
Generate an identity matrix with the specified number of rows and columns, with optional leading dims
Example: batchShape: [3,3] numRows: 2 numCols: 4 returns a tensor of shape (3, 3, 2, 4) that consists of 3 * 3 batches of (2,4)-shaped identity matrices: 1 0 0 0 0 1 0 0 |
SDVariable |
eye(String name,
SDVariable rows)
As per
eye(String, int) but with the number of rows specified as a scalar SDVariable |
SDVariable |
eye(String name,
SDVariable rows,
SDVariable cols)
As per
eye(String, int, int) bit with the number of rows/columns specified as scalar SDVariables |
SDVariable |
eye(String name,
SDVariable rows,
SDVariable cols,
SDVariable batchDimension)
As per
eye(String, int, int, int...) bit with the number of rows/columns specified as scalar SDVariables,
and the batch dimension specified as a 1D SDVariable |
DifferentialFunctionFactory |
f()
Returns this samediff instance's
DifferentialFunctionFactory |
SDVariable |
fill(SDVariable shape,
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,
double value)
Generate an output variable with the specified (dynamic) shape with all elements set to the specified value
|
SDVariable |
firstIndex(SDVariable in,
Condition condition,
boolean keepDims,
int... dimensions) |
SDVariable |
firstIndex(SDVariable in,
Condition condition,
int... dimensions) |
SDVariable |
firstIndex(String name,
SDVariable in,
Condition condition,
boolean keepDims,
int... dimensions)
First index reduction operation.
Returns a variable that contains the index of the first element that matches the specified condition (for each slice along the specified dimensions) Note that if keepDims = true, the output variable has the same rank as the input variable, with the reduced dimensions having size 1. |
SDVariable |
firstIndex(String name,
SDVariable in,
Condition condition,
int... dimensions)
First index reduction operation.
Returns a variable that contains the index of the first element that matches the specified condition (for each slice along the specified dimensions) |
SDVariable |
floor(SDVariable x)
Element-wise floor function: out = floor(x).
|
SDVariable |
floor(String name,
SDVariable x)
Element-wise floor function: out = floor(x).
|
boolean |
functionExists(String id)
Returns true if the given function id exists
|
DifferentialFunction[] |
functions()
Get an array of differential functions that have been defined for this SameDiff instance
|
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
|
String |
generateNewVarName(String baseName,
int argIndex)
Generate a new variable name based on the uniqueness of the base name and arg index
For example, if baseName = "X" will return: "X" if "X" does not already exist, or "X:argIndex" if argIndex > 0 "X_1" if "X" already exists, or "X_1:argIndex" if argIndex > 0 "X_2" if "X" and "X_1" already exists, or "X_2:argIndex" if argIndex > 0 And so on, until an unused name is found |
SDVariable[] |
generateOutputVariableForOp(DifferentialFunction function)
Generate the variables based on the given input op
and return the output variable names.
|
SDVariable[] |
generateOutputVariableForOp(DifferentialFunction function,
String baseName)
Generate the variables based on the given input op and return the output variable names.
|
INDArray |
getArrForVarName(String varName)
Get an
INDArray for a given vertex id, or null if none exists |
String |
getBaseNameForFunction(DifferentialFunction function)
Returns the base name for the given function
if any (may return null)
|
static byte |
getDataTypeAsByte(DataBuffer.Type type)
This method converts enums for DataType
|
static DataBuffer.Type |
getDataTypeFromByte(byte val)
This method converts enums for DataType
|
static byte |
getFlatOpType(Op.Type type)
This method converts an Op.Type to it's corresponding byte value
|
SDVariable |
getForwardVariableForVertexId(int vertexId)
Get the forward variable for gradient based on the gradient's vertex id
|
SameDiff |
getFunction(String functionName)
Get a SameDiff function instance given the name of the function
|
DifferentialFunction |
getFunctionById(String id)
Get the function by the
DifferentialFunction#getOwnName() |
SDVariable |
getGradForVariable(String varName)
Get the gradient for the given vertex id
|
String[] |
getInputsForFunction(DifferentialFunction function)
Returns the name(s) of the inputs for the given function
|
SDVariable[] |
getInputVariablesForFunction(DifferentialFunction function)
Get the input variable(s) for the specified differential function
|
TensorList |
getListByName(String name) |
static long |
getOpNum(String name,
Op.Type type)
This method return operation ID for given op name/type pair.
|
static byte |
getOrderAsByte()
This method returns current byte order for this JVM as libnd4j enum
|
static ByteOrder |
getOrderFromByte(byte val)
This method just converts enums
|
long[] |
getOriginalShapeForPlaceHolder(String varName)
Get the original shape for the vertex id if one was set (other wise returns null).
This is mainly for use in validating passed in arrays as arguments to resolveVariablesWith(Map)
usually when executing using execWithPlaceHolder(Map) |
String[] |
getOutputsForFunction(DifferentialFunction function)
Returns the name(s) of the outputs for the given function
|
SDVariable[] |
getOutputVariablesForFunction(DifferentialFunction function)
Get the output variable(s) for the specified differential function
|
List<String[]> |
getPlaceHoldersFor(String varName)
Get the place holders for a given vertex id.
|
<T> T |
getPropertyForFunction(DifferentialFunction functionInstance,
String propertyName)
Get the property for a given function
|
long[] |
getShapeForVarName(String varName)
Get the shape for the given vertex id.
|
static Op.Type |
getTypeFromByte(byte type)
This method converts enums for Op.Type
|
SDVariable |
getVariable(String name)
Get the variable based on the opName
|
List<DifferentialFunction> |
getVariableArgOfFunctions(String variableName)
Return a list of differential functions (if any) that this variable is the input argument for
|
DifferentialFunction |
getVariableOutputFunction(String variableName)
Get the differential function (if any) that this variable is the output for
|
List<SDVariable> |
getVariablesAssociatedWithFunctions(List<DifferentialFunction> functions)
Get the
SDVariable associated with each function based on the
DifferentialFunction.outputVariables() ()} |
String |
getVarNameForFieldAndFunction(DifferentialFunction function,
String fieldName)
Get the variable name to use
for resolving a given field
for a given function during import time.
|
SDVariable |
grad(String varName)
Get the gradient for the variable with the specified variable name.
|
SDVariable |
gradientBackwardsMarker(SDVariable x)
Intended for internal/developer use
|
SDVariable |
gradientBackwardsMarker(String name,
SDVariable x)
Intended for internal/developer use
|
SDVariable |
gru(GRUCellConfiguration configuration)
The gru cell
|
SDVariable |
gru(String baseName,
GRUCellConfiguration configuration)
The gru cell
|
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 |
hammingDistance(SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
hammingDistance(String name,
SDVariable x,
SDVariable y,
int... dimensions)
Hamming distance reduction operation.
|
SDVariable |
hardSigmoid(SDVariable in)
Element-wise hard sigmoid function:
out[i] = 0 if in[i] <= -2.5 out[1] = 0.2*in[i]+0.5 if -2.5 < in[i] < 2.5 out[i] = 1 if in[i] >= 2.5 |
SDVariable |
hardSigmoid(String name,
SDVariable in)
Element-wise hard sigmoid function:
out[i] = 0 if in[i] <= -2.5 out[1] = 0.2*in[i]+0.5 if -2.5 < in[i] < 2.5 out[i] = 1 if in[i] >= 2.5 |
SDVariable |
hardTanh(SDVariable in)
Element-wise hard tanh function:
out[i] = -1 if in[i] <= -1 out[1] = in[i] if -1 < in[i] < 1 out[i] = 1 if in[i] >= 1 |
SDVariable |
hardTanh(String name,
SDVariable in)
Element-wise hard tanh function:
out[i] = -1 if in[i] <= -1 out[1] = in[i] if -1 < in[i] < 1 out[i] = 1 if in[i] >= 1 |
SDVariable |
hardTanhDerivative(SDVariable x)
Derivative (dOut/dIn) of the element-wise hard Tanh function -
hardTanh(SDVariable) |
SDVariable |
hardTanhDerivative(String name,
SDVariable x)
Derivative (dOut/dIn) of the element-wise hard Tanh function -
hardTanh(SDVariable) |
boolean |
hasArgs(DifferentialFunction function)
Returns true if this function already has defined arguments
|
int |
hashCode() |
boolean |
hasPlaceHolderVariables(String vertexId)
Returns true if the given vertex id has any placeholder variables
|
boolean |
hasPropertiesToResolve(DifferentialFunction function)
Returns true if the given function has ndarray properties to resolve.
|
SDVariable |
iamax(SDVariable in,
boolean keepDims,
int... dimensions)
Index of the max absolute value: argmax(abs(in))
|
SDVariable |
iamax(SDVariable in,
int... dimensions)
Index of the max absolute value: argmax(abs(in))
|
SDVariable |
iamax(String name,
SDVariable in,
boolean keepDims,
int... dimensions)
Index of the max absolute value: argmax(abs(in))
|
SDVariable |
iamax(String name,
SDVariable in,
int... dimensions)
Index of the max absolute value: argmax(abs(in))
|
SDVariable |
iamin(SDVariable in,
boolean keepDims,
int... dimensions)
Index of the min absolute value: argmin(abs(in))
|
SDVariable |
iamin(SDVariable in,
int... dimensions)
Index of the min absolute value: argmin(abs(in))
|
SDVariable |
iamin(String name,
SDVariable in,
boolean keepDims,
int... dimensions)
Index of the min absolute value: argmin(abs(in))
|
SDVariable |
iamin(String name,
SDVariable in,
int... dimensions)
Index of the min absolute value: argmin(abs(in))
|
SDVariable |
identity(SDVariable input)
Elementwise identity operation: out = x
|
SDVariable |
identity(String name,
SDVariable input)
Elementwise identity operation: out = x
|
If |
ifStatement(SameDiffConditional conditional,
SameDiffFunctionDefinition conditionBody,
SameDiffFunctionDefinition trueBody,
SameDiffFunctionDefinition falseBody,
SDVariable[] inputVars) |
SDVariable |
im2Col(SDVariable in,
Conv2DConfig config)
im2col operation for use in 2D convolution operations.
|
SDVariable |
im2Col(String name,
SDVariable in,
Conv2DConfig config)
im2col operation for use in 2D convolution operations.
|
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 |
invoke(Op op,
SDVariable x)
Invoke an op by opName
|
SDVariable |
invoke(Op op,
SDVariable x,
SDVariable y)
Invoke an op by opName
|
SDVariable |
invokeFunctionOn(String functionName,
SameDiff with) |
SDVariable |
invokeGraphOn(SameDiff sameDiff) |
SDVariable |
isFinite(SDVariable x)
Is finite operation: elementwise isFinite(x)
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 otherwise |
SDVariable |
isFinite(String name,
SDVariable x)
Is finite operation: elementwise isFinite(x)
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 otherwise |
boolean |
isImportVariable(String variableName)
Returns true if the variable name is imported
|
SDVariable |
isInfinite(SDVariable x)
Is infinite operation: elementwise isInfinite(x)
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 otherwise |
SDVariable |
isInfinite(String name,
SDVariable x)
Is infinite operation: elementwise isInfinite(x)
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 otherwise |
SDVariable |
isMax(SDVariable x)
Is maximum operation: elementwise x == max(x)
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 otherwise |
SDVariable |
isMax(String name,
SDVariable x)
Is maximum operation: elementwise x == max(x)
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 otherwise |
SDVariable |
isNaN(SDVariable x)
Is Not a Number operation: elementwise isNaN(x)
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 otherwise |
SDVariable |
isNaN(String name,
SDVariable x)
Is Not a Number operation: elementwise isNaN(x)
Returns an array with the same shape/size as the input, with values 1 where condition is satisfied, or value 0 otherwise |
SDVariable |
isNonDecreasing(SDVariable x)
Is the array non decreasing?
An array is non-decreasing if for every valid i, x[i] <= x[i+1]. |
SDVariable |
isNonDecreasing(String name,
SDVariable x)
Is the array non decreasing?
An array is non-decreasing if for every valid i, x[i] <= x[i+1]. |
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
|
boolean |
isPlaceHolder(String varName)
Returns true if this vertex id is a place holder variable or not
A place holder variable is one where the array shape(s) are currently known and can't yet be calculated |
SDVariable |
isStrictlyIncreasing(SDVariable x)
Is the array strictly increasing?
An array is strictly increasing if for every valid i, x[i] < x[i+1]. |
SDVariable |
isStrictlyIncreasing(String name,
SDVariable x)
Is the array strictly increasing?
An array is strictly increasing if for every valid i, x[i] < x[i+1]. |
SDVariable |
jaccardDistance(SDVariable x,
SDVariable y,
int... dimensions)
Jaccard similarity reduction operation.
|
SDVariable |
jaccardDistance(String name,
SDVariable x,
SDVariable y,
int... dimensions)
Jaccard similarity reduction operation.
|
SDVariable |
lastIndex(SDVariable in,
Condition condition,
boolean keepDims,
int... dimensions) |
SDVariable |
lastIndex(SDVariable in,
Condition condition,
int... dimensions) |
SDVariable |
lastIndex(String name,
SDVariable in,
Condition condition,
boolean keepDims,
int... dimensions)
Last index reduction operation.
Returns a variable that contains the index of the last element that matches the specified condition (for each slice along the specified dimensions) Note that if keepDims = true, the output variable has the same rank as the input variable, with the reduced dimensions having size 1. |
SDVariable |
lastIndex(String name,
SDVariable in,
Condition condition,
int... dimensions)
Last index reduction operation.
Returns a variable that contains the index of the last element that matches the specified condition (for each slice along the specified dimensions) |
SDVariable |
leakyRelu(SDVariable x,
double alpha)
Element-wise leaky ReLU function:
out = x if x >= 0.0 out = alpha * x if x < cutoff Alpha value is most commonly set to 0.01 |
SDVariable |
leakyRelu(String name,
SDVariable x,
double alpha)
Element-wise leaky ReLU function:
out = x if x >= 0.0 out = alpha * x if x < cutoff Alpha value is most commonly set to 0.01 |
SDVariable |
leakyReluDerivative(String name,
SDVariable x,
double alpha)
Leaky ReLU derivative: dOut/dIn given input.
See leakyRelu(String, SDVariable, double) |
SDVariable |
linear(SDVariable input,
SDVariable weights,
SDVariable bias) |
SDVariable |
linear(String name,
SDVariable input,
SDVariable weights,
SDVariable bias)
Linear layer operation: out = mmul(in,w) + bias
Note that bias array is optional |
SDVariable |
linspace(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,
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 |
localResponseNormalization(SDVariable inputs,
LocalResponseNormalizationConfig lrnConfig)
2D convolution layer operation - local response normalization
|
SDVariable |
localResponseNormalization(String name,
SDVariable input,
LocalResponseNormalizationConfig lrnConfig)
2D convolution layer operation - local response normalization
|
SDVariable |
log(SDVariable x)
Element-wise logarithm function (base e - natural logarithm): out = log(x)
|
SDVariable |
log(SDVariable in,
double base)
Element-wise logarithm function (with specified base): out = log_{base}(x)
|
SDVariable |
log(String name,
SDVariable x)
Element-wise logarithm function (base e - natural logarithm): out = log(x)
|
SDVariable |
log(String name,
SDVariable in,
double base)
Element-wise logarithm function (with specified base): out = log_{base}(x)
|
SDVariable |
log1p(SDVariable x)
Elementwise natural logarithm function: out = log_e (1 + x)
|
SDVariable |
log1p(String name,
SDVariable x)
Elementwise natural logarithm function: out = log_e (1 + x)
|
SDVariable |
logEntropy(SDVariable in,
int... dimensions)
Log entropy reduction: log(-sum(x * log(x)))
|
SDVariable |
logEntropy(String name,
SDVariable in,
int... dimensions)
Log entropy reduction: log(-sum(x * log(x)))
|
SDVariable |
logSigmoid(SDVariable x)
Element-wise sigmoid function: out[i] = log(sigmoid(in[i]))
|
SDVariable |
logSigmoid(String name,
SDVariable x)
Element-wise sigmoid function: out[i] = log(sigmoid(in[i]))
|
SDVariable |
logSoftmax(SDVariable x)
Log softmax activation
|
SDVariable |
logSoftmax(String name,
SDVariable x)
Log softmax activation
|
SDVariable |
logSumExp(SDVariable input,
int... dimensions)
Log-sum-exp reduction (optionally along dimension).
|
SDVariable |
logSumExp(String name,
SDVariable input,
int... dimensions)
Log-sum-exp reduction (optionally along dimension).
|
SDVariable |
lossBinaryXENT(SDVariable x,
SDVariable y,
int... dimensions)
Binary cross entropy loss.
|
SDVariable |
lossBinaryXENT(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossCosineSimilarity(SDVariable x,
SDVariable y,
int... dimensions)
TODO doc string
|
SDVariable |
lossCosineSimilarity(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossHinge(SDVariable x,
SDVariable y,
int... dimensions)
Hinge loss
|
SDVariable |
lossHinge(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossKLD(SDVariable x,
SDVariable y,
int... dimensions)
Kullback-Leibler divergence loss
|
SDVariable |
lossKLD(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossL1(SDVariable x,
SDVariable y,
int... dimensions)
L1 loss
|
SDVariable |
lossL1(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossL2(SDVariable x,
SDVariable y,
int... dimensions)
L2 loss
|
SDVariable |
lossL2(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossMAE(SDVariable x,
SDVariable y,
int... dimensions)
Mean absolute error loss
|
SDVariable |
lossMAE(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossMCXENT(SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossMCXENT(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossMSE(SDVariable x,
SDVariable y,
int... dimensions)
Mean squared error loss
|
SDVariable |
lossMSE(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossMSLE(SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossMSLE(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossNegativeLogLikelihood(SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossNegativeLogLikelihood(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossPoisson(SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossPoisson(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossSquaredHinge(SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lossSquaredHinge(String name,
SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
lstm(String baseName,
LSTMCellConfiguration configuration)
LSTM unit
|
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 |
manhattanDistance(SDVariable x,
SDVariable y,
int... dimensions) |
SDVariable |
manhattanDistance(String name,
SDVariable x,
SDVariable y,
int... dimensions)
Manhattan distance (l1 norm, l1 distance) reduction operation.
|
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 |
matrixDeterminant(SDVariable in) |
SDVariable |
matrixDeterminant(String name,
SDVariable in)
Matrix determinant op.
|
SDVariable |
matrixInverse(SDVariable in) |
SDVariable |
matrixInverse(String name,
SDVariable in)
Matrix inverse op.
|
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 |
maxPooling2d(SDVariable input,
Pooling2DConfig pooling2DConfig)
2D Convolution layer operation - max pooling 2d
|
SDVariable |
maxPooling2d(String name,
SDVariable input,
Pooling2DConfig pooling2DConfig)
2D Convolution layer operation - max pooling 2d
|
SDVariable |
maxPooling3d(SDVariable input,
Pooling3DConfig pooling3DConfig)
3D convolution layer operation - max pooling 3d operation.
|
SDVariable |
maxPooling3d(String name,
SDVariable input,
Pooling3DConfig pooling3DConfig)
3D convolution layer operation - max pooling 3d operation.
|
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
|
long |
memoryForGraph()
Returns the number of bytes for the graph.
|
SDVariable |
mergeAdd(SDVariable... x)
Merge add function: merges an arbitrary number of equal shaped arrays using elementwise addition:
out = sum_i in[i]
|
SDVariable |
mergeAdd(String name,
SDVariable... inputs)
Merge add function: merges an arbitrary number of equal shaped arrays using element-wise addition:
out = sum_i in[i]
|
SDVariable |
mergeAvg(SDVariable... inputs)
Merge average function: merges an arbitrary number of equal shaped arrays using element-wise mean operation:
out = mean_i in[i]
|
SDVariable |
mergeAvg(String name,
SDVariable... inputs)
Merge average function: merges an arbitrary number of equal shaped arrays using element-wise mean operation:
out = mean_i in[i]
|
SDVariable |
mergeMax(SDVariable... x)
Merge max function: merges an arbitrary number of equal shaped arrays using element-wise maximum operation:
out = max_i in[i]
|
SDVariable |
mergeMax(String name,
SDVariable... inputs)
Merge max function: merges an arbitrary number of equal shaped arrays using element-wise maximum operation:
out = max_i in[i]
|
SDVariable[] |
meshgrid(List<String> names,
boolean cartesian,
SDVariable... inputs) |
SDVariable[] |
meshgrid(List<String> names,
SDVariable... inputs)
Broadcast the 1D input variables onto an n-dimensional grid.
The resulting variable can be used for example for evaluating functions at all locations on a grid. Example: |
SDVariable[] |
meshgrid(SDVariable... inputs) |
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[] |
moments(SDVariable input,
int... axes) |
SDVariable[] |
moments(String[] name,
SDVariable input,
int... axes)
Calculate the mean and (population) variance for the input variable, for the specified axis
|
SDVariable |
neg(SDVariable x)
Elementwise negative operation: out = -x
|
SDVariable |
neg(String name,
SDVariable x)
Elementwise negative operation: out = -x
|
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. |
static com.rits.cloning.Cloner |
newCloner() |
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[] |
normalizeMoments(SDVariable counts,
SDVariable means,
SDVariable variances,
double shift) |
SDVariable[] |
normalizeMoments(String[] name,
SDVariable counts,
SDVariable means,
SDVariable variances,
double shift)
Calculate the mean and variance from the sufficient statistics
|
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
|
long |
numElements()
Count the number of elements in all arrays, according to
SDVariable.getShape() |
SDVariable |
one(String name,
int[] shape)
Create a new variable with the specified shape, with all values initialized to 1.0
|
SDVariable |
one(String name,
long[] shape)
Create a new variable with the specified shape, with all values initialized to 1.0
|
SDVariable |
oneHot(SDVariable indices,
int depth) |
SDVariable |
oneHot(SDVariable indices,
int depth,
int axis,
double on,
double off) |
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 |
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 |
or(SDVariable x,
SDVariable y)
Boolean OR operation: elementwise (x != 0) || (y != 0)
If x and y arrays have equal shape, the output shape is the same as these inputs. Note: supports broadcasting if x and y have different shapes and are broadcastable. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
or(String name,
SDVariable x,
SDVariable y)
Boolean OR operation: elementwise (x != 0) || (y != 0)
If x and y arrays have equal shape, the output shape is the same as these inputs. Note: supports broadcasting if x and y have different shapes and are broadcastable. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
parallel_stack(SDVariable[] values) |
SDVariable |
parallel_stack(String name,
SDVariable[] values) |
static org.nd4j.linalg.primitives.Pair<String,Integer> |
parseVariable(String varName)
Note: INTENDED FOR DEVELOPER USE
This method extract base variable name and output index (if exists) from raw variable name. |
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] |
static int[] |
permuteDataFormatForSameDiff(String dataFormat,
boolean weights)
Permute indices for the samediff/dl4j format.
|
SDVariable |
pow(SDVariable x,
double value)
Element-wise power function: out = x^value
|
SDVariable |
pow(String name,
SDVariable x,
double value)
Element-wise power function: out = x^value
|
void |
printFunction(DifferentialFunction differentialFunction)
Print the given function for debugging (will not print functions)
|
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
|
List<String> |
propertiesToResolveForFunction(DifferentialFunction function)
Return the properties to resolve for the given function.
|
void |
putArrayForVarName(String varName,
INDArray arr)
Adds an INDArray for a given variable name.
|
void |
putFunctionForId(String id,
DifferentialFunction function)
Put the function for the given id
|
void |
putListByName(String name,
TensorList list) |
void |
putOrUpdateArrayForVarName(String varName,
INDArray arr)
Put the array if it does not exist for the given variable name, or update it if it does
|
void |
putOrUpdateShapeForVarName(String varName,
long[] shape,
boolean clearArrayOnShapeMismatch)
Put or update the shape for the given variable name.
|
void |
putPlaceHolderForVariable(String varName,
String... placeHolderVariables)
Add one or or more place holder variables for the given vertex id.
|
void |
putShapeForVarName(String varName,
long[] shape)
Associate a vertex id with the given shape.
|
void |
putSubFunction(String name,
SameDiff nameSpace)
Associate a
SameDiff namespace as a sub function. |
SDVariable |
randomBernoulli(double p,
long... shape) |
SDVariable |
randomBernoulli(double p,
SDVariable shape) |
SDVariable |
randomBernoulli(String name,
double p,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Bernoulli distribution,
with the specified probability.
|
SDVariable |
randomBernoulli(String name,
double p,
SDVariable shape)
Generate a new random SDVariable, where values are randomly sampled according to a Bernoulli distribution,
with the specified probability.
|
SDVariable |
randomBinomial(int nTrials,
double p,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Binomial distribution,
with the specified number of trials and probability.
|
SDVariable |
randomBinomial(String name,
int nTrials,
double p,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Binomial distribution,
with the specified number of trials and probability.
|
SDVariable |
randomExponential(double lambda,
SDVariable shape)
Generate a new random SDVariable, where values are randomly sampled according to a exponential distribution:
P(x) = lambda * exp(-lambda * x)
|
SDVariable |
randomExponential(String name,
double lambda,
SDVariable shape)
Generate a new random SDVariable, where values are randomly sampled according to a exponential distribution:
P(x) = lambda * exp(-lambda * x)
|
SDVariable |
randomLogNormal(double mean,
double stddev,
long... shape) |
SDVariable |
randomLogNormal(String name,
double mean,
double stddev,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Log Normal distribution,
i.e.,
log(x) ~ N(mean, stdev) |
SDVariable |
randomNormal(double mean,
double stddev,
long... shape) |
SDVariable |
randomNormal(double mean,
double stddev,
SDVariable shape) |
SDVariable |
randomNormal(String name,
double mean,
double stddev,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Gaussian (normal) distribution,
N(mean, stdev)
See randomNormal(String, double, double, SDVariable) for the equivalent function where the shape is
specified as a long[] instead |
SDVariable |
randomNormal(String name,
double mean,
double stddev,
SDVariable shape)
Generate a new random SDVariable, where values are randomly sampled according to a Gaussian (normal) distribution,
N(mean, stdev)
See randomNormal(String, double, double, long...) for the equivalent function where the shape is
specified as a long[] instead |
SDVariable |
randomNormalTruncated(double mean,
double stddev,
long... shape) |
SDVariable |
randomNormalTruncated(String name,
double mean,
double stddev,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a Gaussian (normal) distribution,
N(mean, stdev).
|
SDVariable |
randomUniform(double min,
double max,
long... shape) |
SDVariable |
randomUniform(double min,
double max,
SDVariable shape) |
SDVariable |
randomUniform(String name,
double min,
double max,
long... shape)
Generate a new random SDVariable, where values are randomly sampled according to a uniform distribution,
U(min,max)
See randomUniform(double, double, long...) for the equivalent function where the shape is
specified as a SDVariable instead |
SDVariable |
randomUniform(String name,
double min,
double max,
SDVariable shape)
Generate a new random SDVariable, where values are randomly sampled according to a uniform distribution,
U(min,max)
See randomUniform(double, double, long...) for the equivalent function where the shape is
specified as a long[] instead |
SDVariable |
range(double from,
double to,
double step)
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)
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(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 |
reciprocal(SDVariable a)
Element-wise reciprocal (inverse) function: out[i] = 1 / in[i]
|
SDVariable |
reciprocal(String name,
SDVariable a)
Element-wise reciprocal (inverse) function: out[i] = 1 / in[i]
|
SDVariable |
relu(SDVariable x,
double cutoff)
Element-wise rectified linear function with specified cutoff:
out[i] = in[i] if in[i] >= cutoff out[i] = 0 otherwise |
SDVariable |
relu(String name,
SDVariable x,
double cutoff)
Element-wise rectified linear function with specified cutoff:
out[i] = in[i] if in[i] >= cutoff out[i] = 0 otherwise |
SDVariable |
relu6(SDVariable x,
double cutoff)
Element-wise "rectified linear 6" function with specified cutoff:
out[i] = min(max(in, cutoff), 6) |
SDVariable |
relu6(String name,
SDVariable x,
double cutoff)
Element-wise "rectified linear 6" function with specified cutoff:
out[i] = min(max(in, cutoff), 6) |
SDVariable |
reluLayer(SDVariable input,
SDVariable weights,
SDVariable bias) |
SDVariable |
reluLayer(String name,
SDVariable input,
SDVariable weights,
SDVariable bias)
ReLU (Rectified Linear Unit) layer operation: out = relu(mmul(in,w) + bias)
Note that bias array is optional |
void |
removeArgFromFunction(String varName,
DifferentialFunction function)
Remove an argument for a function.
|
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.
|
void |
resolveVariablesWith(Map<String,INDArray> arrays)
Resolve all ndarrays by updating the variables for each array specified in the given map.
|
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 |
rollAxis(SDVariable x,
int axis) |
SDVariable |
rollAxis(String name,
SDVariable x,
int axis) |
SDVariable |
round(SDVariable x)
Elementwise round function: out = round(x).
|
SDVariable |
round(String name,
SDVariable x)
Element-wise round function: out = round(x).
|
SDVariable |
rsqrt(SDVariable x)
Element-wise reciprocal (inverse) of square root: out = 1.0 / sqrt(x)
|
SDVariable |
rsqrt(String name,
SDVariable x)
Element-wise reciprocal (inverse) of square root: out = 1.0 / sqrt(x)
|
SDVariable |
scalar(String name,
double value)
Create a new scalar (rank 0) SDVariable with the specified value
|
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 an arary 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 |
SDVariable |
sconv2d(SDVariable[] inputs,
Conv2DConfig conv2DConfig)
Separable 2D convolution operation with/without optional bias
|
SDVariable |
sconv2d(String name,
SDVariable[] inputs,
Conv2DConfig conv2DConfig)
Separable 2D convolution operation with/without optional bias
|
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) |
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) |
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) |
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) |
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) |
SDVariable |
selu(SDVariable x)
Element-wise SeLU function - Scaled exponential Lineal Unit: see Self-Normalizing Neural Networks
out[i] = scale * alpha * (exp(in[i])-1) if in[i]>0, or 0 if in[i] <= 0 Uses default lcale and alpha values. |
SDVariable |
selu(String name,
SDVariable x)
Element-wise SeLU function - Scaled exponential Lineal Unit: see Self-Normalizing Neural Networks
out[i] = scale * alpha * (exp(in[i])-1) if in[i]>0, or 0 if in[i] <= 0 Uses default lcale and alpha values. |
SDVariable |
separableConv2d(SDVariable layerInput,
SDVariable depthWeights,
SDVariable pointWeights,
Conv2DConfig config)
Separable 2D convolution operation without bias
|
SDVariable |
separableConv2d(SDVariable layerInput,
SDVariable depthWeights,
SDVariable pointWeights,
SDVariable bias,
Conv2DConfig config)
Separable 2D convolution operation with optional bias
|
SDVariable |
sequenceMask(SDVariable lengths) |
SDVariable |
sequenceMask(SDVariable lengths,
int maxLen) |
SDVariable |
sequenceMask(SDVariable lengths,
SDVariable maxLen) |
SDVariable |
sequenceMask(String name,
SDVariable lengths) |
SDVariable |
sequenceMask(String name,
SDVariable lengths,
int maxLen) |
SDVariable |
sequenceMask(String name,
SDVariable lengths,
SDVariable maxLen)
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) |
void |
setBaseNameForFunctionInstanceId(String baseName,
DifferentialFunction function)
Sets a base name for the function id.
|
SDVariable |
setDiag(SDVariable in,
SDVariable diag) |
SDVariable |
setDiag(String name,
SDVariable in,
SDVariable diag)
Set the diagonal value to the specified values
If input is [ a, b, c] [ d, e, f] [ g, h, i] and diag = [ 1, 2, 3] then output is [ 1, b, c] [ d, 2, f] [ g, h, 3] |
void |
setForwardVariableForVarName(String varName,
SDVariable forwardVariable) |
void |
setGradientForVariableName(String variableName,
SDVariable variable)
Assign a SDVariable to represent the gradient of the SDVariable with the specified name
|
void |
setOriginalPlaceHolderShape(String variableName,
long[] shape)
Set the original shape for a given place holder.
This is used to track original shapes of place holder variables. The reason we track original shapes is to validate possible candidate arrays coming in (especially with -1 as the expected shapes). |
<X extends SDVariable> |
setupFunction(X function)
Attempts to insert the
DifferentialFunction reference in to this SameDiff instance. |
SDVariable |
shannonEntropy(SDVariable in,
int... dimensions)
Shannon Entropy reduction: -sum(x * log2(x))
|
SDVariable |
shannonEntropy(String name,
SDVariable in,
int... dimensions)
Shannon Entropy reduction: -sum(x * log2(x))
|
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
|
boolean |
shapeAlreadyExistsForVarName(String varName)
Returns true if the given vertex id and shape already exist.
|
SDVariable |
sigmoid(SDVariable x)
Element-wise sigmoid function: out[i] = 1.0/(1+exp(-in[i]))
|
SDVariable |
sigmoid(String name,
SDVariable x)
Element-wise sigmoid function: out[i] = 1.0/(1+exp(-in[i]))
|
SDVariable |
sigmoidCrossEntropyWithLogits(SDVariable logits,
SDVariable weights,
SDVariable labels,
int reductionMode,
double labelSmoothing)
TODO
|
SDVariable |
sigmoidCrossEntropyWithLogits(String name,
SDVariable logits,
SDVariable weights,
SDVariable labels,
int reductionMode,
double labelSmoothing)
TODO
|
SDVariable |
sigmoidDerivative(SDVariable x,
SDVariable wrt)
Element-wise sigmoid function derivative: dL/dIn given input and dL/dOut
|
SDVariable |
sigmoidDerivative(String name,
SDVariable x,
SDVariable wrt)
Element-wise sigmoid function derivative: dL/dIn given input and dL/dOut
|
SDVariable |
sign(SDVariable x)
Element-wise sign (signum) function:
out = -1 if in < 0 out = 0 if in = 0 out = 1 if in > 0 |
SDVariable |
sign(String name,
SDVariable x)
Element-wise sign (signum) function:
out = -1 if in < 0 out = 0 if in = 0 out = 1 if in > 0 |
SDVariable |
sin(SDVariable x)
Elementwise sine operation: out = sin(x)
|
SDVariable |
sin(String name,
SDVariable x)
Elementwise sine operation: out = sin(x)
|
SDVariable |
sinh(SDVariable x)
Elementwise sinh (hyperbolic sine) operation: out = sinh(x)
|
SDVariable |
sinh(String name,
SDVariable x)
Elementwise sinh (hyperbolic sine) operation: out = sinh(x)
|
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(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 |
softmax(SDVariable x)
Softmax activation
|
SDVariable |
softmax(String name,
SDVariable x)
Softmax activation
|
SDVariable |
softmaxCrossEntropyWithLogits(SDVariable logits,
SDVariable weights,
SDVariable labels,
int reductionMode,
double labelSmoothing)
TODO
|
SDVariable |
softmaxCrossEntropyWithLogits(String name,
SDVariable logits,
SDVariable weights,
SDVariable labels,
int reductionMode,
double labelSmoothing)
TODO
|
SDVariable |
softmaxDerivative(String name,
SDVariable x,
SDVariable wrt) |
SDVariable |
softmaxDerivative(String name,
SDVariable x,
SDVariable wrt,
Integer dimension) |
SDVariable |
softplus(SDVariable x)
Element-wise softplus function: out = log(exp(x) + 1)
|
SDVariable |
softplus(String name,
SDVariable x)
Element-wise softplus function: out = log(exp(x) + 1)
|
SDVariable |
softsign(SDVariable x)
Element-wise softsign function: out = x / (abs(x) + 1)
|
SDVariable |
softsign(String name,
SDVariable x)
Element-wise softsign function: out = x / (abs(x) + 1)
|
SDVariable |
softsignDerivative(SDVariable x)
Element-wise derivative (dOut/dIn) of the softsign function
softsign(SDVariable) |
SDVariable |
softsignDerivative(String name,
SDVariable x)
Element-wise derivative (dOut/dIn) of the softsign function
softsign(SDVariable) |
SDVariable |
spaceToBatch(SDVariable x,
int[] blocks,
int[][] padding) |
SDVariable |
spaceToBatch(String name,
SDVariable x,
int[] blocks,
int[][] padding)
Convolution 2d layer space to batch operation on 4d input.
|
SDVariable |
spaceToDepth(SDVariable x,
int blockSize,
String dataFormat) |
SDVariable |
spaceToDepth(String name,
SDVariable x,
int blockSize,
String dataFormat)
Convolution 2d layer space to depth operation on 4d input.
Increases input channels (reduced spatial dimensions) by rearranging data into a larger channels dimension Example: if input has shape [mb, 2, 4, 4] and block size is 2, then output size is [mb, 8/(2*2), 2*2, 2*2] = [mb, 2, 4, 4] |
SDVariable |
sqrt(SDVariable x)
Element-wise square root function: out = sqrt(x)
|
SDVariable |
sqrt(String name,
SDVariable x)
Element-wise square root function: out = sqrt(x)
|
SDVariable |
square(SDVariable x)
Element-wise square function: out = x^2
|
SDVariable |
square(String name,
SDVariable x)
Element-wise square function: out = x^2
|
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 |
sru(SRUConfiguration configuration)
Simple recurrent unit
|
SDVariable |
sru(String baseName,
SRUConfiguration configuration)
Simiple recurrent unit
|
SDVariable |
sruCell(SRUCellConfiguration configuration)
An sru cell
|
SDVariable |
sruCell(String baseName,
SRUCellConfiguration configuration)
An sru cell
|
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 |
step(SDVariable in,
double cutoff)
Elementwise step function:
out(x) = 1 if x >= cutoff out(x) = 0 otherwise |
SDVariable |
step(String name,
SDVariable in,
double cutoff)
Elementwise step function:
out(x) = 1 if x >= cutoff out(x) = 0 otherwise |
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
|
String |
summary()
Generate and return a String representation of the current SameDiff instance
Reports variables, ops, SameDiff function instances, and (where possible) array shapes. For ops, the input and output variables are reported. For variables, the ops that they are inputs to - or outputs of - are also reported |
SDVariable |
swish(SDVariable x)
Element-wise "swish" function: out = x * sigmoid(b*x) with b=1.0
See: https://arxiv.org/abs/1710.05941 |
SDVariable |
swish(String name,
SDVariable x)
Element-wise "swish" function: out = x * sigmoid(b*x) with b=1.0
See: https://arxiv.org/abs/1710.05941 |
SDVariable |
tan(SDVariable x)
Elementwise tangent operation: out = tan(x)
|
SDVariable |
tan(String name,
SDVariable x)
Elementwise tangent operation: out = tan(x)
|
SDVariable |
tanh(SDVariable x)
Elementwise tanh (hyperbolic tangent) operation: out = tanh(x)
|
SDVariable |
tanh(String name,
SDVariable x)
Elementwise tanh (hyperbolic tangent) operation: out = tanh(x)
|
TensorArrayV3 |
tensorArray() |
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(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 |
trace(SDVariable in) |
SDVariable |
trace(String name,
SDVariable in)
Matrix trace operation
For rank 2 matrices, the output is a scalar vith the trace - i.e., sum of the main diagonal.
For higher rank inputs, output[a,b,c] = trace(in[a,b,c,:,:]) |
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[] |
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.
|
void |
updateArrayForVarName(String varName,
INDArray arr)
Update the INDArray for the given variable.
|
void |
updateShapeForVarName(String varName,
long[] shape)
Update a vertex id with the given shape.
Note that you should use putShapeForVarName(String, long[]) if you want to add a new shape. |
void |
updateShapeForVarName(String varName,
long[] shape,
boolean clearArrayOnShapeMismatch)
Update a vertex id with the given shape.
Note that you should use putShapeForVarName(String, long[]) if you want to add a new shape. |
void |
updateVariable(String variableName,
INDArray arr)
Update the
INDArray
ndarray for the given variable name |
void |
updateVariableName(String varName,
String withName)
Update the opName for the variable
with the given vertex id
|
SDVariable |
updateVariableNameAndReference(SDVariable varToUpdate,
String newVarName)
Updates the variable name property on the passed in variable, the reference in samediff, and returns the variable.
|
SDVariable[] |
updateVariableNamesAndReferences(SDVariable[] variablesToUpdate,
String[] newVariableNames)
Updates the variable name property on the passed in variables, its reference in samediff, and returns the variable.
|
SDVariable |
upsampling2d(SDVariable input,
boolean nchw,
int scaleH,
int scaleW)
2D Convolution layer operation - Upsampling 2d
|
SDVariable |
upsampling2d(SDVariable input,
int scale)
2D Convolution layer operation - Upsampling 2d with same scale for both dimensions.
|
SDVariable |
upsampling2d(String name,
SDVariable input,
boolean nchw,
int scaleH,
int scaleW)
2D Convolution layer operation - Upsampling 2d
|
SDVariable |
upsampling2d(String name,
SDVariable input,
int scale)
2D Convolution layer operation - Upsampling 2d with same scale for both dimensions.
|
SDVariable |
var(INDArray arr)
Create an
SDVariable with a generated name, and assocate the specified array with it |
SDVariable |
var(int... shape)
Creates a
SDVariable with the specified shape and a generated nameAny array will be generated with all zeros for the values |
SDVariable |
var(long... shape)
Creates a
SDVariable with the specified shape and a generated nameAny array will be generated with all zeros for the values |
SDVariable |
var(SDVariable arr)
Initialize a
SDVariable reference tying this variable to this samediff instance. |
SDVariable |
var(String name,
INDArray arr)
Create an
SDVariable with the specified name, and assocate the specified array with it |
SDVariable |
var(String name,
int... shape)
Creates a
SDVariable with the given shape and nameAny array will be generated with all zeros for the values |
SDVariable |
var(String name,
long... shape)
Creates a
SDVariable with the given shape and nameAny array will be generated with all zeros for the values |
SDVariable |
var(String name,
long[] shape,
WeightInitScheme weightInitScheme)
Variable initialization with a specified
WeightInitScheme |
SDVariable |
var(WeightInitScheme weightInitScheme,
long... shape)
Creates a
SDVariable with the specified shape and a generated name. |
Map<String,SDVariable> |
variableMap()
Return the internal variable map
|
List<SDVariable> |
variables()
The list of all variables in the graph
|
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 |
weightedCrossEntropyWithLogits(SDVariable targets,
SDVariable inputs,
SDVariable weights)
TODO
|
SDVariable |
weightedCrossEntropyWithLogits(String name,
SDVariable targets,
SDVariable inputs,
SDVariable weights)
TODO
|
While |
whileStatement(SameDiffConditional sameDiffConditional,
SameDiffFunctionDefinition conditionBody,
SameDiffFunctionDefinition loopBody,
SDVariable[] inputVars)
Creates a while statement
|
SDVariable |
xor(SDVariable x,
SDVariable y)
Boolean XOR (exclusive OR) operation: elementwise (x != 0) XOR (y != 0)
If x and y arrays have equal shape, the output shape is the same as these inputs. Note: supports broadcasting if x and y have different shapes and are broadcastable. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
xor(String name,
SDVariable x,
SDVariable y)
Boolean XOR (exclusive OR) operation: elementwise (x != 0) XOR (y != 0)
If x and y arrays have equal shape, the output shape is the same as these inputs. Note: supports broadcasting if x and y have different shapes and are broadcastable. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
INDArray |
yetAnotherExecMethod(Map<String,INDArray> inputs) |
SDVariable |
zero(String name,
int[] shape)
Create a new variable with the specified shape, with all values initialized to 0
|
SDVariable |
zero(String name,
long[] shape)
Create a new variable with the specified shape, with all values initialized to 0
|
SDVariable |
zeroFraction(SDVariable input)
Full array zero fraction array reduction operation, optionally along specified dimensions: out = (count(x == 0) / length(x))
|
SDVariable |
zeroFraction(String name,
SDVariable input)
Full array zero fraction array reduction operation, optionally along specified dimensions: out = (count(x == 0) / length(x))
|
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.
|
public static com.rits.cloning.Cloner newCloner()
public void updateVariableName(String varName, String withName)
varName - the vertex id to updatewithName - thew new opNamepublic SameDiff disableDebugging()
public SameDiff enableDebugMode()
public DifferentialFunctionFactory f()
DifferentialFunctionFactorypublic SDVariable invokeGraphOn(SameDiff sameDiff)
sameDiff - public boolean functionExists(String id)
id - the function id to test forpublic DifferentialFunction getFunctionById(String id)
DifferentialFunction#getOwnName()id - the id of the functionpublic void putFunctionForId(String id, DifferentialFunction function)
id - the id of the functionfunction - the functionpublic String[] getInputsForFunction(DifferentialFunction function)
function - the function to get the inputs forpublic String[] getOutputsForFunction(DifferentialFunction function)
function - the function to get the outputs forpublic SDVariable[] getOutputVariablesForFunction(DifferentialFunction function)
function - the function reference to get the output variable(s) forpublic SDVariable[] getInputVariablesForFunction(DifferentialFunction function)
function - the function reference to get the input variable(s) forpublic void updateArrayForVarName(String varName, INDArray arr)
varName - Name of the variable to update the array forarr - Array to updateND4JIllegalStateException - when the array does not exist.putArrayForVarName(String, INDArray),
putOrUpdateShapeForVarName(String, long[], boolean)public void putArrayForVarName(String varName, INDArray arr)
updateArrayForVarName(String, INDArray) if the array already exists.varName - the vertex id to addarr - the array to addND4JIllegalStateException - when the array already exists.putOrUpdateShapeForVarName(String, long[], boolean)public void putOrUpdateArrayForVarName(@NonNull
String varName,
INDArray arr)
varName - Variable namearr - Arraypublic long[] getShapeForVarName(String varName)
A shape *and* an array should not be defined at the same time. This wastes memory. The internal map used for tracking shapes for particular vertex ids should also delete redundant shapes stored to avoid redundant sources of information.
varName - the vertex id to get the shape forpublic void updateShapeForVarName(String varName, long[] shape)
putShapeForVarName(String, long[]) if you want to add a new shape.
Update is meant to be an in place replacement of the shape for the vertex id *only*.varName - the vertex id to associateshape - the shape to associate withputShapeForVarName(String, long[]),
putOrUpdateShapeForVarName(String, long[], boolean)public void updateShapeForVarName(String varName, long[] shape, boolean clearArrayOnShapeMismatch)
putShapeForVarName(String, long[]) if you want to add a new shape.
Update is meant to be an in place replacement of the shape for the vertex id *only*.varName - the vertex id to associateshape - the shape to associate withclearArrayOnShapeMismatch - boolean to indicate whether to clear the variable on shape mismatchputShapeForVarName(String, long[]),
putOrUpdateShapeForVarName(String, long[], boolean)public void putShapeForVarName(String varName, long[] shape)
varName - the vertex id to associateshape - the shape to associate withputShapeForVarName(String, long[]),
putOrUpdateShapeForVarName(String, long[], boolean)public void putOrUpdateShapeForVarName(String varName, @NonNull long[] shape, boolean clearArrayOnShapeMismatch)
varName - Variable nameshape - Shape to putclearArrayOnShapeMismatch - If false: no change to arrays. If true: if an INDArray is defined for the specified
variable name, it will be removed from the graph (to be later re-generated) if
its shape does not match the specified shapepublic boolean shapeAlreadyExistsForVarName(String varName)
varName - the vertex idpublic boolean arrayAlreadyExistsForVarName(String varName)
INDArray already exist.varName - the vertex idpublic INDArray getArrForVarName(String varName)
INDArray for a given vertex id, or null if none existsvarName - Variable name to get the array forpublic void associateArrayWithVariable(INDArray arr, @NonNull String variable)
arr - the array to get the variable forvariable - the name of the variable to associate the array withpublic void associateArrayWithVariable(INDArray arr, SDVariable variable)
arr - the array to get the variable forvariable - the variable to associate the array withpublic void putSubFunction(String name, SameDiff nameSpace)
SameDiff namespace as a sub function.name - the opName of the functionnameSpace - the namespacepublic Map<String,SDVariable> variableMap()
public SDVariable invoke(Op op, SDVariable x, SDVariable y)
op - the opx - the first inputy - the second inputpublic Collection<String> definedFunctionNames()
public long memoryForGraph()
public SDVariable invoke(Op op, SDVariable x)
op - the opx - the first inputpublic void addPropertyToResolve(DifferentialFunction forFunction, String arrayName)
This is very common for model import.
forFunction - the function to add the property to resolve forarrayName - the array namepublic List<String> propertiesToResolveForFunction(DifferentialFunction function)
DifferentialFunction.resolvePropertiesFromSameDiffBeforeExecution()function - the function get the properties to resolve forpublic boolean hasPropertiesToResolve(DifferentialFunction function)
function - the function to checkpublic <T> T getPropertyForFunction(DifferentialFunction functionInstance, String propertyName)
T - the inferred return typefunctionInstance - the function to get the
property forpropertyName - the name of the property to getpublic void addPropertyForFunction(DifferentialFunction functionFor, String propertyName, INDArray property)
functionFor - the function add a property forpropertyName - the property nameproperty - the property valuepublic void addPropertyForFunction(DifferentialFunction functionFor, String propertyName, long property)
functionFor - the function to add the property forpropertyName - the name of the property to add the value forproperty - the property value to addpublic void addVariableMappingForField(DifferentialFunction function, String fieldName, String varName)
GraphMapper.importGraph(File)
.
This data structure is typically accessed during DifferentialFunction.resolvePropertiesFromSameDiffBeforeExecution()
When a function attempts to resolve variables right before execution, there needs to be a way of knowing which variable in a samediff graph should map to a function's particular field name
function - the function to mapfieldName - the field name for the function to mapvarName - the variable name of the array to get from samediffpublic String getVarNameForFieldAndFunction(DifferentialFunction function, String fieldName)
DifferentialFunction.resolvePropertiesFromSameDiffBeforeExecution()function - the function to get the variable name forfieldName - the field name to resolve forpublic boolean isImportVariable(String variableName)
variableName - the imported variable namepublic void addVarNameForImport(String varName)
varName - the var name to add.public void setBaseNameForFunctionInstanceId(String baseName, DifferentialFunction function)
generateOutputVariableForOp(DifferentialFunction, String)
for ensuring original names for model import map to current samediff names
when names are generated.baseName - the base name to addfunction - the function to declare a base name for.public String getBaseNameForFunction(DifferentialFunction function)
function - the function to get the base name forpublic <X extends SDVariable> X setupFunction(X function)
DifferentialFunction reference in to this SameDiff instance.
If the given array field with the given index already exists, it will do a reference check to ensure that the 2
array fields are the same. If not, an exception is thrown.function - the array field to attempt to createpublic void addOutgoingFor(SDVariable[] variables, DifferentialFunction function)
variables - Variables - arguments for the specified differential functionfunction - Differential functionpublic void addOutgoingFor(String[] varNames, DifferentialFunction function)
varNames - Name of the variables that are outputs of the specified differential functionfunction - Differential functionpublic void addArgsFor(String[] variables, DifferentialFunction function)
variables - Name of the variables that are arguments (inputs) to the specified functionfunction - Functionpublic void addArgsFor(SDVariable[] variables, DifferentialFunction function)
variables - variables that are arguments (inputs) to the specified functionfunction - Functionpublic DifferentialFunction getVariableOutputFunction(String variableName)
variableName - Name of the variablepublic List<DifferentialFunction> getVariableArgOfFunctions(String variableName)
variableName - Name of the variablepublic boolean hasArgs(DifferentialFunction function)
function - the function to checkpublic DifferentialFunction[] functions()
public static SameDiff create(SameDiff originalSameDiff)
originalSameDiff - Original SameDiff instancepublic static SameDiff create()
public INDArray[] eval(Map<String,INDArray> inputs)
inputs - the inputs to evaluatepublic SameDiff dup()
public long numElements()
SDVariable.getShape()public List<SDVariable> variables()
public SDVariable one(String name, int[] shape)
name - the name of the variable to createshape - the shape of the array to be createdpublic SDVariable one(String name, long[] shape)
name - the name of the variable to createshape - the shape of the array to be createdpublic SDVariable onesLike(SDVariable input)
input - Input SDVariablepublic SDVariable onesLike(String name, SDVariable input)
name - Name of the new SDVariableinput - Input SDVariablepublic SDVariable zero(String name, long[] shape)
name - the name of the variable to createshape - the shape of the array to be createdpublic SDVariable zero(String name, int[] shape)
name - the name of the variable to createshape - the shape of the array to be createdpublic SDVariable zerosLike(SDVariable input)
input - Input SDVariablepublic SDVariable zerosLike(String name, SDVariable input)
name - Name of the new SDVariableinput - Input SDVariablepublic SDVariable constant(SDVariable value, long... shape)
value - constant to set for each valueshape - shape of the variable as long arraypublic SDVariable constant(String name, SDVariable value, long... shape)
name - Name of the new SDVariablevalue - constant to set for each valueshape - shape of the variable as long arraypublic SDVariable linspace(double start, double stop, long number)
start - Start valuestop - Stop valuenumber - Number of values to generatepublic SDVariable linspace(String name, double start, double stop, long number)
name - Name of the new variablestart - Start valuestop - Stop valuenumber - Number of values to generatepublic SDVariable range(double from, double to, double step)
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 sizepublic SDVariable range(String name, double from, double to, double step)
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[] meshgrid(SDVariable... inputs)
meshgrid(List, SDVariable...)public SDVariable[] meshgrid(List<String> names, SDVariable... inputs)
input1 = [1, 2, 3]
input2 = [4, 5, 6]
SDVariable[] out = meshgrid(input1, input2)
out[0]:
[ 1, 2, 3]
[ 1, 2, 3]
[ 1, 2, 3]
out[1]:
[ 4, 4, 4]
[ 5, 5, 5]
[ 6, 6, 6]
names - List of names for the output variables. Must have exactly N names for N input arraysinputs - N x 1D input variablespublic SDVariable[] meshgrid(List<String> names, boolean cartesian, SDVariable... inputs)
meshgrid(List, SDVariable...)public SDVariable var(String name, long[] shape, WeightInitScheme weightInitScheme)
WeightInitSchemename - the name of the variableshape - the shape of the array to be createdweightInitScheme - the weight initialization schemepublic SDVariable var(String name, long... shape)
SDVariable with the given shape and namename - the name of the variableshape - the shape of the variablepublic SDVariable var(String name, int... shape)
SDVariable with the given shape and namename - the name of the variableshape - the shape of the variablepublic SDVariable var(SDVariable arr)
SDVariable reference tying this variable to this samediff instance.
NDArraySupplierInitScheme is used to ensure that if the array is allocated anywhere
and SameDiff instance to exist as a copy of the variable.
arr - public SDVariable var(int... shape)
SDVariable with the specified shape and a generated nameshape - the shape of the variablepublic SDVariable var(long... shape)
SDVariable with the specified shape and a generated nameshape - the shape of the variablepublic SDVariable var(WeightInitScheme weightInitScheme, long... shape)
SDVariable with the specified shape and a generated name. The associated array will
then be generated using the specified weight initialization schemeweightInitScheme - The weight initialization scheme to use when generating an INDArrayshape - the shape of the variablepublic SDVariable var(INDArray arr)
SDVariable with a generated name, and assocate the specified array with itarr - Array to associate with the new variablevar(String, INDArray)public SDVariable var(String name, INDArray arr)
SDVariable with the specified name, and assocate the specified array with itarr - Array to associate with the new variablepublic SDVariable eye(int rows)
rows - Number of rows (and columns)public SDVariable eye(String name, int rows)
rows - Number of rowspublic SDVariable eye(int rows, int cols)
eye(String, int, int)public SDVariable eye(String name, int rows, int cols)
SDVariable eye = eye(3,2)
eye:
[ 1, 0]
[ 0, 1]
[ 0, 0]
name - Name of the new SDVariablerows - Number of rowscols - Number of columnspublic SDVariable eye(int rows, int cols, int... batchDimension)
public SDVariable eye(String name, int rows, int cols, int... batchDimension)
rows - Number of rowscols - Number of columnsbatchDimension - Batch dimensions. May be nullpublic SDVariable eye(String name, SDVariable rows, SDVariable cols, SDVariable batchDimension)
eye(String, int, int, int...) bit with the number of rows/columns specified as scalar SDVariables,
and the batch dimension specified as a 1D SDVariablepublic SDVariable eye(SDVariable rows, SDVariable cols, SDVariable batchDimension)
eye(int, int, int...) bit with the number of rows/columns specified as scalar SDVariables,
and the batch dimension specified as a 1D SDVariablepublic SDVariable eye(String name, SDVariable rows, SDVariable cols)
eye(String, int, int) bit with the number of rows/columns specified as scalar SDVariablespublic SDVariable eye(SDVariable rows, SDVariable cols)
eye(int, int) bit with the number of rows/columns specified as scalar SDVariablespublic SDVariable eye(String name, SDVariable rows)
eye(String, int) but with the number of rows specified as a scalar SDVariablepublic SDVariable eye(SDVariable rows)
eye(int) but with the number of rows specified as a scalar SDVariablepublic void removeArgFromFunction(String varName, DifferentialFunction function)
varName - the variable name to removefunction - the function to remove the argument frompublic SDVariable getVariable(String name)
name - the opName of the variablepublic SDVariable getGradForVariable(String varName)
varName - the vertex idpublic void setGradientForVariableName(String variableName, SDVariable variable)
variableName - the variable name to assign the gradient variable forvariable - the gradient variablepublic SDVariable getForwardVariableForVertexId(int vertexId)
vertexId - the vertex idpublic void setForwardVariableForVarName(String varName, SDVariable forwardVariable)
varName - forwardVariable - public SDVariable grad(String varName)
execBackwards() must be executed first.
All gradient functions are obtained from the results of the execBackwards call.varName - the variable name to get the gradient variable for.public SDVariable randomUniform(double min, double max, SDVariable shape)
public SDVariable randomUniform(String name, double min, double max, SDVariable shape)
randomUniform(double, double, long...) for the equivalent function where the shape is
specified as a long[] insteadname - Name of the new SDVariablemin - Minimum valuemax - Maximum value. Must satisfy max >= minshape - Shape of the new random SDVariable, as a 1D arraypublic SDVariable randomUniform(double min, double max, long... shape)
public SDVariable randomUniform(String name, double min, double max, long... shape)
randomUniform(double, double, long...) for the equivalent function where the shape is
specified as a SDVariable insteadname - Name of the new SDVariablemin - Minimum valuemax - Maximum value. Must satisfy max >= minshape - Shape of the new random SDVariablepublic SDVariable randomNormal(double mean, double stddev, SDVariable shape)
public SDVariable randomNormal(String name, double mean, double stddev, SDVariable shape)
randomNormal(String, double, double, long...) for the equivalent function where the shape is
specified as a long[] insteadname - Name of the new SDVariablemean - Mean value for the random arraystddev - Standard deviation for the random arrayshape - Shape of the new random SDVariable, as a 1D arraypublic SDVariable randomNormal(double mean, double stddev, long... shape)
public SDVariable randomNormal(String name, double mean, double stddev, long... shape)
randomNormal(String, double, double, SDVariable) for the equivalent function where the shape is
specified as a long[] insteadname - Name of the new SDVariablemean - Mean value for the random arraystddev - Standard deviation for the random arrayshape - Shape of the new random SDVariablepublic SDVariable randomLogNormal(double mean, double stddev, long... shape)
public SDVariable randomLogNormal(String name, double mean, double stddev, long... shape)
log(x) ~ N(mean, stdev)name - Name of the new SDVariablemean - Mean value for the random arraystddev - Standard deviation for the random arrayshape - Shape of the new random SDVariablepublic SDVariable randomNormalTruncated(double mean, double stddev, long... shape)
public SDVariable randomNormalTruncated(String name, double mean, double stddev, long... shape)
name - Name of the new SDVariablemean - Mean value for the random arraystddev - Standard deviation for the random arrayshape - Shape of the new random SDVariablepublic SDVariable randomBernoulli(double p, SDVariable shape)
public SDVariable randomBernoulli(String name, double p, SDVariable shape)
randomBernoulli(String, double, long...) for the equivalent function where the shape is
specified as a long[] insteadname - Name of the new SDVariablep - Probability of value 1shape - Shape of the new random SDVariable, as a 1D arraypublic SDVariable randomBernoulli(double p, long... shape)
randomBernoulli(String, double, long...)public SDVariable randomBernoulli(String name, double p, long... shape)
randomBernoulli(String, double, SDVariable) for the equivalent function where the shape is
specified as a SDVarible insteadname - Name of the new SDVariablep - Probability of value 1shape - Shape of the new random SDVariable, as a 1D arraypublic SDVariable randomBinomial(int nTrials, double p, long... shape)
nTrials - Number of trials parameter for the binomial distributionp - Probability of success for each trialshape - Shape of the new random SDVariable, as a 1D arraypublic SDVariable randomBinomial(String name, int nTrials, double p, long... shape)
name - Name of the new SDVariablenTrials - Number of trials parameter for the binomial distributionp - Probability of success for each trialshape - Shape of the new random SDVariable, as a 1D arraypublic SDVariable randomExponential(double lambda, SDVariable shape)
lambda - Must be > 0shape - Shape of the outputpublic SDVariable randomExponential(String name, double lambda, SDVariable shape)
name - Name of the output variablelambda - Must be > 0shape - Shape of the new variablepublic SDVariable upsampling2d(SDVariable input, int scale)
input - Input - 4d CNN (image) activations in NCHW format (shape [minibatch, channels, height, width])scale - Scale to upsample in both H and W dimensionspublic SDVariable upsampling2d(String name, SDVariable input, int scale)
input - Input - 4d CNN (image) activations in NCHW format (shape [minibatch, channels, height, width])scale - Scale to upsample in both H and W dimensionspublic SDVariable upsampling2d(SDVariable input, boolean nchw, int scaleH, int scaleW)
input - Input - 4d CNN (image) activations in NCHW format (shape [minibatch, channels, height, width])
or NHWC format (shape [minibatch, height, width, channels])nchw - If true: input is in NCHW (minibatch, channels, height, width) format. False: NHWC formatscaleH - Scale to upsample in height dimensionscaleW - Scale to upsample in width dimensionpublic SDVariable upsampling2d(String name, SDVariable input, boolean nchw, int scaleH, int scaleW)
input - Input, in NCHW formatnchw - If true: input is in NCHW (minibatch, channels, height, width) format. False: NHWC formatscaleH - Scale to upsample in height dimensionscaleW - Scale to upsample in width dimensionpublic SDVariable avgPooling2d(SDVariable input, Pooling2DConfig pooling2DConfig)
input - the input to average pooling 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])pooling2DConfig - the configuration forpublic SDVariable avgPooling2d(String name, SDVariable input, Pooling2DConfig pooling2DConfig)
name - name of the operation in SameDiffinput - the input to average pooling 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])pooling2DConfig - the configurationpublic SDVariable maxPooling2d(SDVariable input, Pooling2DConfig pooling2DConfig)
input - the input to max pooling 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])pooling2DConfig - the configurationpublic SDVariable maxPooling2d(String name, SDVariable input, Pooling2DConfig pooling2DConfig)
name - name of the operation in SameDiffinput - the input to max pooling 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])pooling2DConfig - the configurationpublic SDVariable avgPooling3d(SDVariable input, Pooling3DConfig pooling3DConfig)
input - the input to average pooling 3d operation - 5d activations in NCDHW format
(shape [minibatch, channels, depth, height, width]) or NDHWC format
(shape [minibatch, depth, height, width, channels])pooling3DConfig - the configurationpublic SDVariable avgPooling3d(String name, SDVariable input, Pooling3DConfig pooling3DConfig)
name - name of the operation in SameDiffinput - the input to average pooling 3d operation - 5d activations in NCDHW format
(shape [minibatch, channels, depth, height, width]) or NDHWC format
(shape [minibatch, depth, height, width, channels])pooling3DConfig - the configurationpublic SDVariable maxPooling3d(SDVariable input, Pooling3DConfig pooling3DConfig)
input - the input to average pooling 3d operation - 5d activations in NCDHW format
(shape [minibatch, channels, depth, height, width]) or NDHWC format
(shape [minibatch, depth, height, width, channels])pooling3DConfig - the configurationpublic SDVariable maxPooling3d(String name, SDVariable input, Pooling3DConfig pooling3DConfig)
name - name of the operation in SameDiffinput - the input to average pooling 3d operation - 5d activations in NCDHW format
(shape [minibatch, channels, depth, height, width]) or NDHWC format
(shape [minibatch, depth, height, width, channels])pooling3DConfig - the configurationpublic SDVariable conv1d(SDVariable input, SDVariable weights, Conv1DConfig conv1DConfig)
input - the input array/activations for the conv1d opweights - weights for conv1d opconv1DConfig - the configurationpublic SDVariable conv1d(String name, SDVariable input, SDVariable weights, Conv1DConfig conv1DConfig)
name - name of the operation in SameDiffinput - the inputs to conv1dweights - weights for conv1d opconv1DConfig - the configurationpublic SDVariable localResponseNormalization(SDVariable inputs, LocalResponseNormalizationConfig lrnConfig)
inputs - the inputs to lrnlrnConfig - the configurationpublic SDVariable localResponseNormalization(String name, SDVariable input, LocalResponseNormalizationConfig lrnConfig)
name - name of the operation in SameDiffinput - the inputs to lrnlrnConfig - the configurationpublic SDVariable conv2d(SDVariable layerInput, SDVariable weights, Conv2DConfig config)
layerInput - the input to max pooling 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])weights - Weights for the convolution operation. 4 dimensions.
If layer input data is in NCHW format, weights should have format [outputChannels, inputChannels, kernelHeight, kernelWidth].
If layer input data is in NHWC format, weight should have format [kernelHeight, kernelWidth, inputChannels, outputChannels]config - Conv2DConfig configurationpublic SDVariable conv2d(SDVariable layerInput, SDVariable weights, SDVariable bias, Conv2DConfig config)
layerInput - the input to max pooling 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])weights - Weights for the convolution operation. 4 dimensions.
If layer input data is in NCHW format, weights should have format [outputChannels, inputChannels, kernelHeight, kernelWidth].
If layer input data is in NHWC format, weight should have format [kernelHeight, kernelWidth, inputChannels, outputChannels]bias - Optional 1D bias array with shape [outputChannels]. May be null.config - Conv2DConfig configurationpublic SDVariable conv2d(SDVariable[] inputs, Conv2DConfig config)
inputs - an array with either 2 elements (layerInput, weights) or 3 elements (layerInput, weights, bias) as
described in conv2d(SDVariable, SDVariable, SDVariable, Conv2DConfig)config - Conv2DConfig configurationpublic SDVariable conv2d(String name, SDVariable[] inputs, Conv2DConfig config)
name - Name of the output SDVariableinputs - an array with either 2 elements (layerInput, weights) or 3 elements (layerInput, weights, bias) as
described in conv2d(SDVariable, SDVariable, SDVariable, Conv2DConfig)config - Conv2DConfig configurationpublic SDVariable depthWiseConv2d(SDVariable layerInput, SDVariable depthWeights, Conv2DConfig config)
layerInput - the input to max pooling 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])depthWeights - depth-wise conv 2D weights. 4 dimensions.
If layer input data is in NCHW format, weights should have format [outputChannels, inputChannels, kernelHeight, kernelWidth].
If layer input data is in NHWC format, weight should have format [kernelHeight, kernelWidth, inputChannels, outputChannels]config - Conv2DConfig configurationpublic SDVariable depthWiseConv2d(SDVariable layerInput, SDVariable depthWeights, SDVariable bias, Conv2DConfig config)
layerInput - the input to max pooling 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])depthWeights - depth-wise conv 2D weights. 4 dimensions.
If layer input data is in NCHW format, weights should have format [outputChannels, inputChannels, kernelHeight, kernelWidth].
If layer input data is in NHWC format, weight should have format [kernelHeight, kernelWidth, inputChannels, outputChannels]bias - Optional 1D bias array with shape [outputChannels]. May be null.config - Conv2DConfig configurationpublic SDVariable depthWiseConv2d(SDVariable[] inputs, Conv2DConfig depthConv2DConfig)
inputs - the inputs to depth-wise conv2d. An array with either 2 elements (layerInput, depthWeights)
or 3 elements (layerInput, depthWeights, bias) as described in
depthWiseConv2d(SDVariable, SDVariable, SDVariable, Conv2DConfig)depthConv2DConfig - the configurationpublic SDVariable depthWiseConv2d(String name, SDVariable[] inputs, Conv2DConfig depthConv2DConfig)
name - name of the output variableinputs - the inputs to depth-wise conv2d. An array with either 2 elements (layerInput, depthWeights)
or 3 elements (layerInput, depthWeights, bias) as described in
depthWiseConv2d(SDVariable, SDVariable, SDVariable, Conv2DConfig)depthConv2DConfig - the configurationpublic SDVariable separableConv2d(SDVariable layerInput, SDVariable depthWeights, SDVariable pointWeights, Conv2DConfig config)
layerInput - the input to max pooling 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])depthWeights - Depth weights, rank 4.
If layer input is in NCHW format, depth weights should have format [outputChannels, depthMultiplier, kernelHeight, kernelWidth].
If layer input is in NHWC format, depth weights should have format [kernelHeight, kernelWidth, inputChannels, depthMultiplier]pointWeights - Point weights, rank 4.
If layer input is in NCHW format, point weights should have format [outputChannels, inputChannels*depthMultiplier, 1, 1].
If layer input is in NHWC format, point weights should have format [1, 1, inputChannels*depthMultiplier, outputChannels]config - Conv2DConfig configurationpublic SDVariable separableConv2d(SDVariable layerInput, SDVariable depthWeights, SDVariable pointWeights, SDVariable bias, Conv2DConfig config)
layerInput - the input to max pooling 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])depthWeights - Depth weights, rank 4.
If layer input is in NCHW format, depth weights should have format [outputChannels, depthMultiplier, kernelHeight, kernelWidth].
If layer input is in NHWC format, depth weights should have format [kernelHeight, kernelWidth, inputChannels, depthMultiplier]pointWeights - Point weights, rank 4.
If layer input is in NCHW format, point weights should have format [outputChannels, inputChannels*depthMultiplier, 1, 1].
If layer input is in NHWC format, point weights should have format [1, 1, inputChannels*depthMultiplier, outputChannels]bias - Optional bias, rank 1 with shape [outputChannels]. May be null.config - Conv2DConfig configurationpublic SDVariable sconv2d(SDVariable[] inputs, Conv2DConfig conv2DConfig)
inputs - the inputs to separable conv2 operation. Should be length 3 (layerInput, depthWeights, pointWeights)
or length 4 (layerInput, depthWeights, pointWeights, bias) as described in separableConv2d(SDVariable, SDVariable, SDVariable, SDVariable, Conv2DConfig)conv2DConfig - the configurationpublic SDVariable sconv2d(String name, SDVariable[] inputs, Conv2DConfig conv2DConfig)
name - name of the output variableinputs - the inputs to separable conv2 operation. Should be length 3 (layerInput, depthWeights, pointWeights)
or length 4 (layerInput, depthWeights, pointWeights, bias) as described in separableConv2d(SDVariable, SDVariable, SDVariable, SDVariable, Conv2DConfig)conv2DConfig - the configurationpublic SDVariable deconv2d(SDVariable layerInput, SDVariable weights, DeConv2DConfig deconv2DConfig)
layerInput - the input to deconvolution 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])weights - Weights for the 2d deconvolution operation. 4 dimensions.
If layer input data is in NCHW format, weights should have format [inputChannels, outputChannels, kernelHeight, kernelWidth].
If layer input data is in NHWC format, weight should have format [kernelHeight, kernelWidth, outputChannels, inputChannels]deconv2DConfig - DeConv2DConfig configurationpublic SDVariable deconv2d(SDVariable layerInput, SDVariable weights, SDVariable bias, DeConv2DConfig deconv2DConfig)
layerInput - the input to deconvolution 2d operation - 4d CNN (image) activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])weights - Weights for the 2d deconvolution operation. 4 dimensions.
If layer input data is in NCHW format, weights should have format [inputChannels, outputChannels, kernelHeight, kernelWidth].
If layer input data is in NHWC format, weight should have format [kernelHeight, kernelWidth, outputChannels, inputChannels]bias - Optional 1D bias array with shape [outputChannels]. May be null.deconv2DConfig - DeConv2DConfig configurationpublic SDVariable deconv2d(SDVariable[] inputs, DeConv2DConfig deconv2DConfig)
inputs - Inputs to the deconvolution 2d operation - input array of length 2 (layerInput, weights)
or length 3 (layerInput, weights, bias) as described in deconv2d(SDVariable[], DeConv2DConfig)deconv2DConfig - the configurationpublic SDVariable deconv2d(String name, SDVariable[] inputs, DeConv2DConfig deconv2DConfig)
name - Name of the output variableinputs - Inputs to the deconvolution 2d operation - input array of length 2 (layerInput, weights)
or length 3 (layerInput, weights, bias) as described in deconv2d(SDVariable[], DeConv2DConfig)deconv2DConfig - the configurationpublic SDVariable conv3d(SDVariable input, SDVariable weights, Conv3DConfig conv3DConfig)
input - the input to average pooling 3d operation - 5d activations in NCDHW format
(shape [minibatch, channels, depth, height, width]) or NDHWC format
(shape [minibatch, depth, height, width, channels])weights - Weights for conv3d. Rank 5.
If input data is in NCDHW fomat, weights should have shape [outputChannels, inputChannels, kernelDepth, kernelHeight, kernelWidth].
If input data is in NDHWC fomat, weights should have shape [kernelDepth, kernelHeight, kernelWidth, inputChannels, outputChannels].conv3DConfig - the configurationpublic SDVariable conv3d(SDVariable input, SDVariable weights, SDVariable bias, Conv3DConfig conv3DConfig)
input - the input to average pooling 3d operation - 5d activations in NCDHW format
(shape [minibatch, channels, depth, height, width]) or NDHWC format
(shape [minibatch, depth, height, width, channels])weights - Weights for conv3d. Rank 5.
If input data is in NCDHW fomat, weights should have shape [outputChannels, inputChannels, kernelDepth, kernelHeight, kernelWidth].
If input data is in NDHWC fomat, weights should have shape [kernelDepth, kernelHeight, kernelWidth, inputChannels, outputChannels].bias - Optional 1D bias array with shape [outputChannels]. May be null.conv3DConfig - the configurationpublic SDVariable conv3d(String name, SDVariable input, SDVariable weights, Conv3DConfig conv3DConfig)
name - Name of the output variableinput - the input to average pooling 3d operation - 5d activations in NCDHW format
(shape [minibatch, channels, depth, height, width]) or NDHWC format
(shape [minibatch, depth, height, width, channels])weights - Weights for conv3d. Rank 5.
If input data is in NCDHW fomat, weights should have shape [outputChannels, inputChannels, kernelDepth, kernelHeight, kernelWidth].
If input data is in NDHWC fomat, weights should have shape [kernelDepth, kernelHeight, kernelWidth, inputChannels, outputChannels].conv3DConfig - the configurationpublic SDVariable conv3d(String name, SDVariable input, SDVariable weights, SDVariable bias, Conv3DConfig conv3DConfig)
name - Name of the output variableinput - the input to average pooling 3d operation - 5d activations in NCDHW format
(shape [minibatch, channels, depth, height, width]) or NDHWC format
(shape [minibatch, depth, height, width, channels])weights - Weights for conv3d. Rank 5.
If input data is in NCDHW fomat, weights should have shape [outputChannels, inputChannels, kernelDepth, kernelHeight, kernelWidth].
If input data is in NDHWC fomat, weights should have shape [kernelDepth, kernelHeight, kernelWidth, inputChannels, outputChannels].bias - Optional 1D bias array with shape [outputChannels]. May be null.conv3DConfig - the configurationpublic SDVariable batchNorm(SDVariable input, SDVariable mean, SDVariable variance, SDVariable gamma, SDVariable beta, boolean applyGamma, boolean applyBeta, double epsilon)
public SDVariable batchNorm(String name, SDVariable input, SDVariable mean, SDVariable variance, SDVariable gamma, SDVariable beta, boolean applyGamma, boolean applyBeta, double epsilon)
public SDVariable im2Col(SDVariable in, Conv2DConfig config)
in - Input - rank 4 input with shape [minibatch, inputChannels, height, width]config - Convolution configuration for the im2col operationpublic SDVariable im2Col(String name, SDVariable in, Conv2DConfig config)
name - Name of the output variablein - Input - rank 4 input with shape [minibatch, inputChannels, height, width]config - Convolution configuration for the im2col operationpublic SDVariable col2Im(SDVariable in, Conv2DConfig config)
in - Input - rank 6 input with shape [minibatch, inputChannels, kernelHeight, kernelWidth, outputHeight, outputWidth]config - Convolution configuration for the col2im operationpublic SDVariable col2Im(String name, SDVariable in, Conv2DConfig config)
name - Name of the output variablein - Input - rank 6 input with shape [minibatch, inputChannels, kernelHeight, kernelWidth, outputHeight, outputWidth]config - Convolution configuration for the col2im operationpublic SDVariable scalar(String name, double value)
name - Name of the SDVariablevalue - Value to initialize the variable withpublic 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 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 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 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 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 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 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 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 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 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 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 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 or(SDVariable x, SDVariable y)
x - Input 1y - Input 2public SDVariable or(String name, SDVariable x, SDVariable y)
name - Name of the output variablex - Input 1y - Input 2public SDVariable and(SDVariable x, SDVariable y)
x - Input 1y - Input 2public SDVariable and(String name, SDVariable x, SDVariable y)
name - Name of the output variablex - Input 1y - Input 2public SDVariable xor(SDVariable x, SDVariable y)
x - Input 1y - Input 2public SDVariable xor(String name, SDVariable x, SDVariable y)
name - Name of the output variablex - Input 1y - Input 2public SDVariable abs(SDVariable x)
x - Input variablepublic SDVariable abs(String name, SDVariable x)
name - Name of the output variablex - Input variablepublic SDVariable neg(SDVariable x)
x - Input variablepublic SDVariable neg(String name, SDVariable x)
name - Name of the output variablex - Input variablepublic SDVariable cos(SDVariable x)
x - Input variablepublic SDVariable cos(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable sin(SDVariable x)
x - Input variablepublic SDVariable sin(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable tan(SDVariable x)
x - Input variablepublic SDVariable tan(String name, SDVariable x)
name - Output variable namex - Input variablepublic 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 acos(SDVariable x)
x - Input variablepublic SDVariable acos(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable asin(SDVariable x)
x - Input variablepublic SDVariable asin(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable atan(SDVariable x)
x - Input variablepublic SDVariable atan(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable atan2(SDVariable y, SDVariable x)
y - Input Y variablex - Input X variablepublic SDVariable atan2(String name, SDVariable y, SDVariable x)
name - Name of the output variabley - Input Y variablex - Input X variablepublic SDVariable cosh(SDVariable x)
x - Input variablepublic SDVariable cosh(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable sinh(SDVariable x)
x - Input variablepublic SDVariable sinh(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable tanh(SDVariable x)
x - Input variablepublic SDVariable tanh(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable step(SDVariable in, double cutoff)
in - Input variablecutoff - Cutoff value for step functionpublic SDVariable step(String name, SDVariable in, double cutoff)
name - Name of the output variablein - Input variablecutoff - Cutoff value for step functionpublic SDVariable acosh(SDVariable x)
x - Input variablepublic SDVariable acosh(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable asinh(SDVariable x)
x - Input variablepublic SDVariable asinh(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable atanh(SDVariable x)
x - Input variablepublic SDVariable atanh(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable exp(SDVariable x)
x - Input variablepublic SDVariable exp(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable rsqrt(SDVariable x)
x - Input variablepublic SDVariable rsqrt(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable expm1(SDVariable x)
x - Input variablepublic SDVariable expm1(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable log1p(SDVariable x)
x - Input variablepublic SDVariable log1p(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable round(SDVariable x)
x - Input variablepublic SDVariable round(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable isInfinite(SDVariable x)
x - Input arraypublic SDVariable isInfinite(String name, SDVariable x)
name - Output variable namex - Input arraypublic SDVariable isNaN(SDVariable x)
x - Input arraypublic SDVariable isNaN(String name, SDVariable x)
name - Output variable namex - Input arraypublic SDVariable isFinite(SDVariable x)
x - Input arraypublic SDVariable isFinite(String name, SDVariable x)
name - Output variable namex - Input arraypublic SDVariable isMax(SDVariable x)
x - Input arraypublic SDVariable isMax(String name, SDVariable x)
name - Name of the output variablex - Input arraypublic SDVariable isNonDecreasing(SDVariable x)
x - Input variablepublic SDVariable isNonDecreasing(String name, SDVariable x)
name - Output namex - Input variablepublic SDVariable isStrictlyIncreasing(SDVariable x)
x - Input variablepublic SDVariable isStrictlyIncreasing(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable isNumericTensor(SDVariable x)
x - Input variablepublic SDVariable isNumericTensor(String name, SDVariable x)
name - Output variable namex - Input variablepublic 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 log(SDVariable x)
x - Input variablepublic SDVariable log(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable log(SDVariable in, double base)
in - Input variablebase - Logarithm basepublic SDVariable log(String name, SDVariable in, double base)
name - Name of the output variablein - Input variablebase - Logarithm basepublic SDVariable logSumExp(SDVariable input, int... dimensions)
input - Input variabledimensions - Optional dimensions to reduce alongpublic SDVariable logSumExp(String name, SDVariable input, int... dimensions)
name - Name of the output variableinput - Input variabledimensions - Optional dimensions to reduce alongpublic SDVariable cube(SDVariable x)
x - Input variablepublic SDVariable cube(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable pow(SDVariable x, double value)
x - Input variablevalue - Power to raise each element topublic SDVariable pow(String name, SDVariable x, double value)
name - Output variable namex - Input variablevalue - Power to raise each element topublic SDVariable sqrt(SDVariable x)
x - Input variablepublic SDVariable sqrt(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable square(SDVariable x)
x - Input variablepublic SDVariable square(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable floor(SDVariable x)
x - Input variablepublic SDVariable floor(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable ceil(SDVariable x)
x - Input variablepublic SDVariable ceil(String name, SDVariable x)
name - Name of the output variablex - Input variablepublic SDVariable clipByValue(SDVariable x, double clipValueMin, double clipValueMax)
x - Input variableclipValueMin - Minimum value for clippingclipValueMax - Maximum value for clippingpublic SDVariable clipByValue(String name, SDVariable x, double clipValueMin, double clipValueMax)
name - Name of the output variablex - Input variableclipValueMin - Minimum value for clippingclipValueMax - Maximum value for clippingpublic SDVariable clipByNorm(SDVariable x, double clipValue)
x - Input variableclipValue - Clipping value (maximum l2 norm)public SDVariable clipByNorm(String name, SDVariable x, double clipValue)
name - Name of the output variablex - Input variableclipValue - Clipping value (maximum l2 norm)public SDVariable clipByNorm(SDVariable x, double clipValue, int... dimensions)
x - Input variableclipValue - Clipping value (maximum l2 norm)dimensions - If not specified, all dimensions are usedpublic SDVariable clipByNorm(String name, SDVariable x, double clipValue, int... dimensions)
name - Output variable namex - Input variableclipValue - Clipping value (maximum l2 norm)dimensions - If not specified, all dimensions are usedpublic SDVariable relu(SDVariable x, double cutoff)
x - Input variablecutoff - Cutoff value. Usually 0public SDVariable relu(String name, SDVariable x, double cutoff)
name - Output variable namex - Input variablecutoff - Cutoff value. Usually 0public SDVariable relu6(SDVariable x, double cutoff)
x - Input variablecutoff - Cutoff value. Usually 0public SDVariable relu6(String name, SDVariable x, double cutoff)
name - Output variable namex - Input variablecutoff - Cutoff value. Usually 0public SDVariable softmax(SDVariable x)
x - Input variablepublic SDVariable softmax(String name, SDVariable x)
x - Input variablepublic SDVariable logSoftmax(SDVariable x)
x - Input variablepublic SDVariable logSoftmax(String name, SDVariable x)
name - Variable namex - Input variablepublic SDVariable selu(SDVariable x)
x - Input variablepublic SDVariable selu(String name, SDVariable x)
name - Name of the output variablex - Input variablepublic SDVariable mergeAdd(SDVariable... x)
x - Input variablespublic SDVariable mergeAdd(String name, SDVariable... inputs)
name - Name of the output variableinputs - Input variablespublic SDVariable mergeMax(SDVariable... x)
x - Input variablespublic SDVariable mergeMax(String name, SDVariable... inputs)
inputs - Input variablespublic SDVariable mergeAvg(SDVariable... inputs)
inputs - Input variablespublic SDVariable mergeAvg(String name, SDVariable... inputs)
name - Name of the output variableinputs - Input variablespublic SDVariable batchToSpace(SDVariable x, int[] blocks, int[][] crops)
public SDVariable batchToSpace(String name, SDVariable x, int[] blocks, int[][] crops)
name - Output variable namex - Input variable. 4d inputblocks - Block size, in the height/width dimensioncrops - Optional 2d int[] array: values [[crop top, crop bottom], [crop left, crop right]]spaceToBatch(String, SDVariable, int[], int[][])public SDVariable depthToSpace(SDVariable x, int blockSize, String dataFormat)
x - the input to depth to space pooling 2d operation - 4d activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])blockSize - Block size, in the height/width dimensiondataFormat - Data format: "NCHW" or "NHWC"public SDVariable depthToSpace(String name, SDVariable x, int blockSize, String dataFormat)
name - Output variable namex - the input to depth to space pooling 2d operation - 4d activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])blockSize - Block size, in the height/width dimensiondataFormat - Data format: "NCHW" or "NHWC"depthToSpace(String, SDVariable, int, String)public SDVariable spaceToBatch(SDVariable x, int[] blocks, int[][] padding)
public SDVariable spaceToBatch(String name, SDVariable x, int[] blocks, int[][] padding)
name - Output variable namex - Input variable. 4d inputblocks - Block size, in the height/width dimensionpadding - Optional 2d int[] array for padding the result: values [[pad top, pad bottom], [pad left, pad right]]batchToSpace(String, SDVariable, int[], int[][])public SDVariable spaceToDepth(SDVariable x, int blockSize, String dataFormat)
public SDVariable spaceToDepth(String name, SDVariable x, int blockSize, String dataFormat)
name - Output variable namex - the input to depth to space pooling 2d operation - 4d activations in NCHW format
(shape [minibatch, channels, height, width]) or NHWC format (shape [minibatch, height, width, channels])blockSize - Block size, in the height/width dimensiondataFormat - Data format: "NCHW" or "NHWC"depthToSpace(String, SDVariable, int, String)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 segmentMax(SDVariable data, SDVariable segmentIds)
public SDVariable segmentMax(String name, SDVariable data, SDVariable segmentIds)
name - 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)
name - 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)
name - 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)
name - 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)
name - Name of the output variable. May be nulldata - Data to perform segment max onsegmentIds - Variable for the segment IDspublic SDVariable dilation2D(SDVariable df, SDVariable weights, int[] strides, int[] rates, boolean isSameMode)
df - weights - strides - rates - isSameMode - public SDVariable dilation2D(String name, SDVariable df, SDVariable weights, int[] strides, int[] rates, boolean isSameMode)
name - df - weights - strides - rates - isSameMode - public 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 rank(SDVariable in)
in - Input variablepublic SDVariable rank(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 cross(SDVariable a, SDVariable b)
cross(String, SDVariable, SDVariable)public SDVariable cross(String name, SDVariable a, SDVariable b)
a - First inputb - Second inputpublic 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 repeat(SDVariable df, int axis)
repeat(String, SDVariable, int)public SDVariable repeat(String name, SDVariable df, int axis)
repeat(String, SDVariable, int)public 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 parallel_stack(SDVariable[] values)
stack(String, int, SDVariable...)public SDVariable parallel_stack(String name, SDVariable[] values)
stack(String, int, SDVariable...)public SDVariable[] unstack(SDVariable value, int axis)
unstack(String[], SDVariable, int, int)public SDVariable[] unstack(String[] names, SDVariable value, int axis)
unstack(String[], SDVariable, int, int)public SDVariable[] unstack(SDVariable value, int axis, int num)
unstack(String[], SDVariable, int, int)public SDVariable[] unstack(String[] names, 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 erf(SDVariable x)
x - Input variablepublic SDVariable erf(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable erfc(SDVariable x)
x - Input variablepublic SDVariable erfc(String name, SDVariable x)
name - Name of the output variablex - Input variablepublic SDVariable diag(SDVariable x)
diag(String, SDVariable)public SDVariable diag(String name, SDVariable x)
name - Name of the output variablex - Input variablepublic SDVariable diagPart(SDVariable x)
diagPart(String, SDVariable)public SDVariable diagPart(String name, SDVariable x)
x - Input variablediag(String, SDVariable)public SDVariable setDiag(SDVariable in, SDVariable diag)
setDiag(String, SDVariable, SDVariable)public SDVariable setDiag(String name, SDVariable in, SDVariable diag)
name - Name of the output variablein - Input variablediag - Diagonalpublic SDVariable oneHot(SDVariable indices, int depth)
oneHot(String, SDVariable, int)public SDVariable oneHot(SDVariable indices, int depth, int axis, double on, double off)
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 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 offname - Output variable nameindices - Indices - value 0 to depth-1depth - Number of classespublic SDVariable reciprocal(SDVariable a)
a - Input variablepublic SDVariable reciprocal(String name, SDVariable a)
name - Name of the output variablea - Input variablepublic SDVariable gradientBackwardsMarker(SDVariable x)
public SDVariable gradientBackwardsMarker(String name, SDVariable x)
public SDVariable hardTanh(SDVariable in)
in - Input variablepublic SDVariable hardTanh(String name, SDVariable in)
name - Output variable namein - Input variablepublic SDVariable hardSigmoid(SDVariable in)
in - Input variablepublic SDVariable hardSigmoid(String name, SDVariable in)
name - Name of the output variablein - Input variablepublic SDVariable hardTanhDerivative(SDVariable x)
hardTanh(SDVariable)x - Inputpublic SDVariable hardTanhDerivative(String name, SDVariable x)
hardTanh(SDVariable)name - Output variable namex - Inputpublic SDVariable sigmoid(SDVariable x)
x - Input Variablepublic SDVariable sigmoid(String name, SDVariable x)
name - Output variable namex - Input Variablepublic SDVariable sigmoidDerivative(SDVariable x, SDVariable wrt)
x - Input Variablewrt - Gradient at the output - dL/dOut. Must have same shape as the inputpublic SDVariable sigmoidDerivative(String name, SDVariable x, SDVariable wrt)
name - Output variable namex - Input Variablewrt - Gradient at the output - dL/dOut. Must have same shape as the inputpublic SDVariable logSigmoid(SDVariable x)
x - Input Variablepublic SDVariable logSigmoid(String name, SDVariable x)
name - Name of the output variablex - Input Variablepublic SDVariable sign(SDVariable x)
x - Input variablepublic SDVariable sign(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable softsign(SDVariable x)
x - Input variablepublic SDVariable softsign(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable softsignDerivative(SDVariable x)
softsign(SDVariable)x - Input variablepublic SDVariable softsignDerivative(String name, SDVariable x)
softsign(SDVariable)name - Output variable namex - Input variablepublic SDVariable softplus(SDVariable x)
x - Input variablepublic SDVariable softplus(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable swish(SDVariable x)
x - Input variablepublic SDVariable swish(String name, SDVariable x)
name - Name of the output variablex - Input variablepublic SDVariable elu(SDVariable x)
x - Input variablepublic SDVariable elu(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable eluDerivative(SDVariable x)
elu(SDVariable)x - Input variablepublic SDVariable eluDerivative(String name, SDVariable x)
elu(SDVariable)name - Output variable namex - Input variablepublic SDVariable leakyRelu(SDVariable x, double alpha)
x - Input variablealpha - Cutoff - usually 0.0public SDVariable leakyRelu(String name, SDVariable x, double alpha)
x - Input variablealpha - Cutoff - usually 0.0public SDVariable leakyReluDerivative(String name, SDVariable x, double alpha)
leakyRelu(String, SDVariable, double)x - Input variablealpha - Alpha valuepublic SDVariable mean(SDVariable x)
x - Input variablepublic SDVariable mean(SDVariable x, int... dimension)
x - Input variabledimension - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic 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 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 variance(SDVariable x, boolean biasCorrected, int... dimensions)
public SDVariable variance(String name, 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, 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 entropy(SDVariable in, int... dimensions)
in - Input variabledimensions - Dimensions to reduce on (null/empty for full array)public SDVariable entropy(String name, SDVariable in, int... dimensions)
name - Name of the output variablein - Input variabledimensions - Dimensions to reduce on (null/empty for full array)public SDVariable logEntropy(SDVariable in, int... dimensions)
in - Input variabledimensions - Dimensions to reduce on (null for full array)public SDVariable logEntropy(String name, SDVariable in, int... dimensions)
name - Name of the output variablein - Input variabledimensions - Dimensions to reduce on (null for full array)public SDVariable shannonEntropy(SDVariable in, int... dimensions)
in - Input variabledimensions - Dimensions to reduce on (null/empty for full array)public SDVariable shannonEntropy(String name, SDVariable in, int... dimensions)
name - Name of the output variablein - Input variabledimensions - Dimensions to reduce on (null/empty for full array)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 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 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 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 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 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 amax(SDVariable in, int... dimensions)
in - Input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable amax(String name, SDVariable in, int... dimensions)
name - Name of the output variablein - Input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable amin(SDVariable in, int... dimensions)
in - Input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable amin(String name, SDVariable in, int... dimensions)
name - Name of the output variablein - Input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable amean(SDVariable in, int... dimensions)
in - Input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable amean(String name, SDVariable in, int... dimensions)
name - Name of the output variablein - Input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable asum(SDVariable in, int... dimensions)
in - Input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable asum(String name, SDVariable in, int... dimensions)
name - Name of the output variablein - Input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable countZero(SDVariable input, int... dimensions)
input - Input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable countZero(String name, SDVariable input, int... dimensions)
name - Name of the output variableinput - Input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable zeroFraction(SDVariable input)
input - Input variablepublic SDVariable zeroFraction(String name, SDVariable input)
name - Name of the output variableinput - Input variablepublic SDVariable countNonZero(SDVariable input, int... dimensions)
input - Input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable countNonZero(String name, SDVariable input, int... dimensions)
name - Name of the output variableinput - Input variabledimensions - 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 argmax(SDVariable in, int... dimensions)
in - Input variabledimensions - 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 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 argmin(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, boolean keepDims, int... dimensions)
public 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 iamax(SDVariable in, int... dimensions)
argmax(SDVariable, int...)public SDVariable iamax(SDVariable in, boolean keepDims, int... dimensions)
public SDVariable iamax(String name, SDVariable in, int... dimensions)
public SDVariable iamax(String name, SDVariable in, boolean keepDims, int... dimensions)
public SDVariable iamin(SDVariable in, int... dimensions)
public SDVariable iamin(SDVariable in, boolean keepDims, int... dimensions)
public SDVariable iamin(String name, SDVariable in, int... dimensions)
public SDVariable iamin(String name, SDVariable in, boolean keepDims, int... dimensions)
public SDVariable firstIndex(SDVariable in, Condition condition, int... dimensions)
public SDVariable firstIndex(SDVariable in, Condition condition, boolean keepDims, int... dimensions)
public SDVariable firstIndex(String name, SDVariable in, Condition condition, int... dimensions)
name - Name of the output variablein - Input variablecondition - Condition to check on input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable firstIndex(String name, SDVariable in, Condition condition, boolean keepDims, int... dimensions)
name - Name of the output variablein - Input variablecondition - Condition to check on 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 lastIndex(SDVariable in, Condition condition, int... dimensions)
public SDVariable lastIndex(SDVariable in, Condition condition, boolean keepDims, int... dimensions)
public SDVariable lastIndex(String name, SDVariable in, Condition condition, int... dimensions)
name - Name of the output variablein - Input variablecondition - Condition to check on input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable lastIndex(String name, SDVariable in, Condition condition, boolean keepDims, int... dimensions)
name - Name of the output variablein - Input variablecondition - Condition to check on input variabledimensions - Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic 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 matchCondition(SDVariable in, Condition condition)
in - Input variablecondition - Conditionpublic SDVariable matchCondition(String name, SDVariable in, Condition condition)
in - Inputcondition - Conditionpublic SDVariable cumsum(SDVariable in, boolean exclusive, boolean reverse, int... axis)
#cumsum(String, SDVariable, SDVariable, boolean, boolean)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 cumprod(SDVariable in, boolean exclusive, boolean reverse, int... axis)
#cumprod(String, SDVariable, SDVariable, boolean, boolean)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 biasAdd(SDVariable input, SDVariable bias)
biasAdd(String, SDVariable, SDVariable)public SDVariable biasAdd(String name, SDVariable input, SDVariable bias)
name - Name of the output variableinput - 4d input variablebias - 1d biaspublic 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(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(String name, SDVariable x, SDVariable seq_lengths)
public SDVariable reverseSequence(SDVariable x, SDVariable seq_lengths, int seqDim, int batchDim)
public SDVariable reverseSequence(SDVariable x, SDVariable seq_lengths)
public SDVariable sequenceMask(String name, SDVariable lengths, SDVariable maxLen)
name - Name of the output variablelengths - Lengths of the sequencesmaxLen - Maximum sequence lengthpublic SDVariable sequenceMask(SDVariable lengths, SDVariable maxLen)
public SDVariable sequenceMask(String name, SDVariable lengths, int maxLen)
public SDVariable sequenceMask(SDVariable lengths, int maxLen)
public SDVariable sequenceMask(String name, SDVariable lengths)
public SDVariable sequenceMask(SDVariable lengths)
public 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 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 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 transpose(SDVariable x)
x - Input variablepublic SDVariable transpose(String name, SDVariable x)
name - Output variable namex - Input variablepublic SDVariable permute(SDVariable x, int... dimensions)
x - Input variablepublic SDVariable permute(String name, SDVariable x, int... dimensions)
name - Output variable namex - Input variablepublic SDVariable rollAxis(SDVariable x, int axis)
x - axis - public SDVariable rollAxis(String name, SDVariable x, int axis)
x - axis - 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[] moments(SDVariable input, int... axes)
moments(String[], SDVariable, int...)public SDVariable[] moments(String[] name, SDVariable input, int... axes)
name - Name of the output variables. Can be null; if non-null, must be length 2input - Input to calculate moments foraxes - Dimensions to perform calculation overpublic SDVariable[] normalizeMoments(SDVariable counts, SDVariable means, SDVariable variances, double shift)
public SDVariable[] normalizeMoments(String[] name, SDVariable counts, SDVariable means, SDVariable variances, double shift)
name - Name of the output variables. Can be null; if non-null, must be length 2counts - Rank 0 (scalar) value with the total number of values used to calculate the sufficient statisticsmeans - Mean-value sufficient statistics: this is the SUM of all data valuesvariances - Variaance sufficient statistics: this is the squared sum of all data valuesshift - Shift value, possibly 0, used when calculating the sufficient statistics (for numerical stability)public SDVariable matrixDeterminant(SDVariable in)
matrixDeterminant(String, SDVariable)public SDVariable matrixDeterminant(String name, SDVariable in)
name - Name of the output variablein - Inputpublic SDVariable matrixInverse(SDVariable in)
matrixInverse(String, SDVariable)public SDVariable matrixInverse(String name, SDVariable in)
name - Name of the output variablein - Inputpublic SDVariable confusionMatrix(SDVariable labels, SDVariable predictions)
public SDVariable confusionMatrix(String name, SDVariable labels, SDVariable pred)
name - Name of the output variablelabels - Labels - 1D array of integer values representing label valuespred - Predictions - 1D array of integer values representing predictions. Same length as labelspublic SDVariable confusionMatrix(SDVariable labels, SDVariable pred, Integer numClasses)
public SDVariable confusionMatrix(String name, SDVariable labels, SDVariable pred, Integer numClasses)
name - Name of the output variablelabels - Labels - 1D array of integer values representing label valuespred - Predictions - 1D array of integer values representing predictions. Same length as labelsnumClasses - Number of classespublic SDVariable confusionMatrix(SDVariable labels, SDVariable pred, SDVariable weights)
public SDVariable confusionMatrix(String name, SDVariable labels, SDVariable pred, SDVariable weights)
name - Name of the output variablelabels - Labels - 1D array of integer values representing label valuespred - Predictions - 1D array of integer values representing predictions. Same length as labelsweights - Weights - 1D array of values (may be real/decimal) representing the weight/contribution of
each prediction. Must be same length as both labels and predictions arrayspublic SDVariable confusionMatrix(SDVariable labels, SDVariable pred, Integer numClasses, SDVariable weights)
public SDVariable confusionMatrix(String name, SDVariable labels, SDVariable pred, Integer numClasses, SDVariable weights)
name - Name of the output variablelabels - Labels - 1D array of integer values representing label valuespred - Predictions - 1D array of integer values representing predictions. Same length as labelsweights - Weights - 1D array of values (may be real/decimal) representing the weight/contribution of
each prediction. Must be same length as both labels and predictions arrayspublic 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 fill(SDVariable shape, double value)
shape - Shape: must be a 1D array/variablevalue - Value to set all elements topublic SDVariable fill(String name, SDVariable shape, double value)
name - Name of the output variableshape - Shape: must be a 1D array/variablevalue - Value to set all elements topublic SDVariable dropout(SDVariable input, double inputRetainProbability)
input - InputinputRetainProbability - Probability of retaining an input (set to 0 with probability 1-p)public SDVariable dropout(String name, SDVariable input, double inputRetainProbability)
input - InputinputRetainProbability - Probability of retaining an input (set to 0 with probability 1-p)public SDVariable linear(SDVariable input, SDVariable weights, SDVariable bias)
public SDVariable linear(String name, SDVariable input, SDVariable weights, SDVariable bias)
name - Name of the output variableinput - Input dataweights - Weights variablebias - Optional bias variable (may be null)public SDVariable reluLayer(SDVariable input, SDVariable weights, SDVariable bias)
public SDVariable reluLayer(String name, SDVariable input, SDVariable weights, SDVariable bias)
name - Name of the output variableinput - Input dataweights - Weights variablebias - Optional bias variable (may be null)public 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(SDVariable x, SDVariable y)
x - First input variabley - Second input variablepublic 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(String name, SDVariable x, SDVariable y)
name - Output variable namex - First input variabley - Second input variablepublic SDVariable[] batchMmul(String[] names, SDVariable[] matricesA, SDVariable[] matricesB, boolean transposeA, boolean transposeB)
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 SDVariablespublic SDVariable[] batchMmul(SDVariable[] matricesA, SDVariable[] matricesB, boolean transposeA, boolean transposeB)
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(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 tensorMmul(SDVariable x, SDVariable y, int[][] dimensions)
x - y - dimensions - public 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 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 squaredNorm(SDVariable x, int... dimensions)
norm2(String, SDVariable, 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 squaredNorm(String name, SDVariable x, boolean keepDims, int... dimensions)
norm2(String, SDVariable, boolean, int...)public 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 cosineSimilarity(SDVariable x, SDVariable y, int... dimensions)
public SDVariable cosineSimilarity(String name, SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Dimensions to calculate cosine similarity overpublic SDVariable euclideanDistance(SDVariable x, SDVariable y, int... dimensions)
public SDVariable euclideanDistance(String name, SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Dimensions to calculate cosine similarity overpublic SDVariable manhattanDistance(SDVariable x, SDVariable y, int... dimensions)
public SDVariable manhattanDistance(String name, SDVariable x, SDVariable y, int... dimensions)
name - Name of the output variablex - Input variable xy - Input variable ydimensions - Dimensions to calculate cosine similarity overpublic SDVariable cosineDistance(SDVariable x, SDVariable y, int... dimensions)
public SDVariable cosineDistance(String name, SDVariable x, SDVariable y, int... dimensions)
cosineSimilarity(String, SDVariable, SDVariable, int...)name - Name of the output variablex - Input variable xy - Input variable ydimensions - Dimensions to calculate cosine similarity overpublic SDVariable hammingDistance(SDVariable x, SDVariable y, int... dimensions)
public SDVariable hammingDistance(String name, SDVariable x, SDVariable y, int... dimensions)
name - Name of the output variablex - Input variable xy - Input variable ydimensions - Dimensions to calculate cosine similarity overpublic SDVariable jaccardDistance(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Dimensions to calculate Jaccard similarity overpublic SDVariable jaccardDistance(String name, SDVariable x, SDVariable y, int... dimensions)
name - Name of the output variablex - Input variable xy - Input variable ydimensions - Dimensions to calculate Jaccard similarity overpublic SDVariable lossBinaryXENT(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossCosineSimilarity(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossHinge(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossKLD(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossL1(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossL2(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossMAE(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossMSE(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossMCXENT(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossMSLE(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossNegativeLogLikelihood(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossPoisson(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable lossSquaredHinge(SDVariable x, SDVariable y, int... dimensions)
x - Input variable xy - Input variable ydimensions - Reduction dimensionspublic SDVariable softmaxDerivative(String name, SDVariable x, SDVariable wrt)
x - public SDVariable softmaxDerivative(String name, SDVariable x, SDVariable wrt, Integer dimension)
public SDVariable tensorMmul(String name, SDVariable x, SDVariable y, int[][] dimensions)
x - Input variable xy - Input variable ydimensions - dimensionspublic SDVariable sigmoidCrossEntropyWithLogits(SDVariable logits, SDVariable weights, SDVariable labels, int reductionMode, double labelSmoothing)
logits - weights - labels - reductionMode - labelSmoothing - public SDVariable sigmoidCrossEntropyWithLogits(String name, SDVariable logits, SDVariable weights, SDVariable labels, int reductionMode, double labelSmoothing)
name - logits - weights - labels - reductionMode - labelSmoothing - public SDVariable softmaxCrossEntropyWithLogits(SDVariable logits, SDVariable weights, SDVariable labels, int reductionMode, double labelSmoothing)
logits - weights - labels - reductionMode - labelSmoothing - public SDVariable softmaxCrossEntropyWithLogits(String name, SDVariable logits, SDVariable weights, SDVariable labels, int reductionMode, double labelSmoothing)
name - logits - weights - labels - reductionMode - labelSmoothing - public SDVariable weightedCrossEntropyWithLogits(SDVariable targets, SDVariable inputs, SDVariable weights)
targets - inputs - weights - public SDVariable weightedCrossEntropyWithLogits(String name, SDVariable targets, SDVariable inputs, SDVariable weights)
name - targets - inputs - weights - public SDVariable lossBinaryXENT(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossCosineSimilarity(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossHinge(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossKLD(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossL1(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossL2(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossMAE(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossMSE(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossMCXENT(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossMSLE(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossNegativeLogLikelihood(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossPoisson(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public SDVariable lossSquaredHinge(String name, SDVariable x, SDVariable y, int... dimensions)
x - y - dimensions - public void addVariable(SDVariable variable)
variable - Variable to addpublic String generateNewVarName(String baseName, int argIndex)
baseName - the base name to use (use function.opName() where function is a DifferentialFunctionargIndex - the arg indexpublic SDVariable lstm(String baseName, LSTMCellConfiguration configuration)
baseName - the base name for outputsconfiguration - the configuration to usepublic SDVariable sruCell(SRUCellConfiguration configuration)
configuration - the configuration for the sru cellpublic SDVariable sru(SRUConfiguration configuration)
configuration - the configuration for the srupublic SDVariable gru(GRUCellConfiguration configuration)
configuration - teh configuration to usepublic SDVariable sruCell(String baseName, SRUCellConfiguration configuration)
baseName - the base name to use for the output variablesconfiguration - the configuration for the sru cellpublic SDVariable sru(String baseName, SRUConfiguration configuration)
baseName - the base name to use for output variablesconfiguration - the configuration for the srupublic SDVariable gru(String baseName, GRUCellConfiguration configuration)
baseName - the base name for the gru cellconfiguration - teh configuration to usepublic SDVariable slice(SDVariable input, int[] begin, int[] size)
slice(String, SDVariable, int[], int[])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 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(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(String name, 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 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 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 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 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 trace(SDVariable in)
trace(String, SDVariable)public SDVariable trace(String name, SDVariable in)
name - Name of the output variable. May be null.in - Input variablepublic SDVariable[] generateOutputVariableForOp(DifferentialFunction function, String baseName)
function - the function to generate the output
variable names forpublic SDVariable[] generateOutputVariableForOp(DifferentialFunction function)
function - the function to generate the output
variable names forpublic SameDiff getFunction(String functionName)
functionName - the name of the functionpublic INDArray execAndEndResult(List<DifferentialFunction> ops)
ops - Ops to executepublic INDArray execAndEndResult()
getArrForVarName(String)
or SDVariable.getArr()
Note: If the final operation has multiple output variables, use execAndEndResults() instead
public INDArray[] execAndEndResults()
getArrForVarName(String)
or SDVariable.getArr()public INDArray execAndEndResult(int outputIndex)
getArrForVarName(String)
or SDVariable.getArr()public List<DifferentialFunction> exec(List<DifferentialFunction> ops)
ops - the list of already created opspublic TensorList getListByName(@NonNull String name)
public void putListByName(@NonNull
String name,
TensorList list)
public While whileStatement(SameDiffConditional sameDiffConditional, SameDiffFunctionDefinition conditionBody, SameDiffFunctionDefinition loopBody, SDVariable[] inputVars)
sameDiffConditional - loopBody - public If ifStatement(SameDiffConditional conditional, SameDiffFunctionDefinition conditionBody, SameDiffFunctionDefinition trueBody, SameDiffFunctionDefinition falseBody, SDVariable[] inputVars)
conditional - trueBody - falseBody - public TensorArrayV3 tensorArray()
public SDVariable invokeFunctionOn(String functionName, SameDiff with)
functionName - with - public SameDiff defineFunction(String function, SameDiffFunctionDefinition functionDefinition, SDVariable[] variables)
function - public void defineFunction(String function, SameDiffFunctionDefinition functionDefinition)
function - public void defineFunction(String function, SameDiffFunctionDefinition functionDefinition, Map<String,INDArray> inputs)
function - functionDefinition - inputs - public INDArray execAndEndResult(String functionName)
functionName - the name of the SameDiff function instance to invokepublic org.nd4j.linalg.primitives.Pair<Map<SDVariable,DifferentialFunction>,List<DifferentialFunction>> exec(String functionName)
functionName - the name of the SameDiff function instance to invokepublic List<DifferentialFunction> exec(String functionName, List<DifferentialFunction> cachedOps)
functionName - the opName of the function to
execcachedOps - the cached operationspublic org.nd4j.linalg.primitives.Pair<Map<SDVariable,DifferentialFunction>,List<DifferentialFunction>> execBackwards()
SDVariable.getGradient() followed by SDVariable.getArr() or by using getGradForVariable(String)public void createGradFunction()
execBackwards()) if it is not already defined.
Users do not usually need to call this function manually, as it is called as required in the aforementioned method.
getFunction(String)
with name "grad" as the argument.public INDArray execBackwardAndEndResult()
public INDArray execWithPlaceHolderAndEndResult(Map<String,INDArray> inputs)
public void setOriginalPlaceHolderShape(String variableName, long[] shape)
Note that if isPlaceHolder(String)
returns false for the passed in vertex id,
a ND4JIllegalStateException is thrown.
A vertex id must be added first. You can
do this with addAsPlaceHolder(String)
variableName - the vertex id for the original shapeshape - the shape of the place holderpublic long[] getOriginalShapeForPlaceHolder(String varName)
resolveVariablesWith(Map)
usually when executing using execWithPlaceHolder(Map)varName - the vertex id to get the original shape for.public boolean isPlaceHolder(String varName)
varName - the vertex id to testpublic void addAsPlaceHolder(String varName)
varName - the vertex id to addpublic void resolveVariablesWith(Map<String,INDArray> arrays)
IllegalStateException will be thrown if not all arrays are specified for resolution.arrays - the arrays to resolve.public boolean allPlaceHolderVariablesResolved()
getVariable(String) getArr() does not return null and
the shape is properly resolved.public void putPlaceHolderForVariable(String varName, String... placeHolderVariables)
Note that if a vertex id in placeHolderVariables isn't present in this samediff instance anyways,
an ND4JIllegalStateException is thrown
varName - the vertex id to add place holders forplaceHolderVariables - the place holder variablespublic boolean hasPlaceHolderVariables(String vertexId)
vertexId - the vertex id to check forpublic List<String[]> getPlaceHoldersFor(String varName)
Consider using hasPlaceHolderVariables(String)
varName - the vertex id to get the place holders forpublic org.nd4j.linalg.primitives.Pair<Map<SDVariable,DifferentialFunction>,List<DifferentialFunction>> execWithPlaceHolder(Map<String,INDArray> inputs)
resolveVariablesWith(Map) is calledpublic List<SDVariable> getVariablesAssociatedWithFunctions(List<DifferentialFunction> functions)
SDVariable associated with each function based on the
DifferentialFunction.outputVariables() ()}functions - the functions to get the variables forDifferentialFunctionpublic SDVariable updateVariableNameAndReference(SDVariable varToUpdate, String newVarName)
Note that if null for the new variable is passed in, it will just return the original input variable.
varToUpdate - the variable to updatenewVarName - the new variable namepublic SDVariable[] updateVariableNamesAndReferences(SDVariable[] variablesToUpdate, String[] newVariableNames)
variablesToUpdate - the variable to updatenewVariableNames - the new variable nameprotected void associateSameDiffWithOpsAndVariables()
public void clearExecutionCache()
public org.nd4j.linalg.primitives.Pair<Map<SDVariable,DifferentialFunction>,List<DifferentialFunction>> exec()
getArrForVarName(String) or
SDVariable.getArr()public void printFunction(DifferentialFunction differentialFunction)
differentialFunction - the function to printpublic static int[] permuteDataFormatForSameDiff(String dataFormat, boolean weights)
dataFormat - the data format to permutepublic void updateVariable(String variableName, INDArray arr)
INDArray
ndarray for the given variable namevariableName - the variable to updatearr - the array to update withprotected int asFlatNode(String name, @NonNull SameDiff scope, @NonNull com.google.flatbuffers.FlatBufferBuilder bufferBuilder)
public static org.nd4j.linalg.primitives.Pair<String,Integer> parseVariable(@NonNull String varName)
varName - protected int asFlatNode(@NonNull
DifferentialFunction node,
@NonNull
com.google.flatbuffers.FlatBufferBuilder bufferBuilder,
List<SDVariable> variables,
Map<String,Integer> reverseMap,
Map<String,Integer> forwardMap,
Map<String,Integer> framesMap,
AtomicInteger idCounter)
public ByteBuffer asFlatBuffers(@NonNull ExecutorConfiguration configuration)
configuration - - ExecutorConfiguration to be embedded into serialized graphpublic ByteBuffer asFlatBuffers()
public static ByteOrder getOrderFromByte(byte val)
val - public static byte getOrderAsByte()
public void asFlatFile(@NonNull
File file)
throws IOException
file - File to save the FlatBuffers serialized graph (including arrays) toIOExceptionpublic void asFlatFile(@NonNull
File file,
@NonNull
ExecutorConfiguration configuration)
throws IOException
file - File to save the FlatBuffers serialized graph (including arrays) toIOExceptionpublic String asFlatPrint()
summary()public static DataBuffer.Type getDataTypeFromByte(byte val)
val - public static byte getDataTypeAsByte(DataBuffer.Type type)
type - public static long getOpNum(String name, Op.Type type)
name - type - public static Op.Type getTypeFromByte(byte type)
type - Byte representing the op typepublic static byte getFlatOpType(Op.Type type)
type - type to convertpublic String summary()
Copyright © 2018. All rights reserved.