public class SDVariable extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected DataType |
dataType |
protected SameDiff |
sameDiff |
protected long[] |
shape |
protected VariableType |
variableType |
protected String |
varName |
Constructor and Description |
---|
SDVariable(@NonNull String varName,
@NonNull VariableType varType,
@NonNull SameDiff sameDiff,
long[] shape,
DataType dataType) |
Modifier and Type | Method and Description |
---|---|
SDVariable |
add(double scalar)
|
SDVariable |
add(SDVariable other)
|
SDVariable |
add(String varName,
double scalar)
Scalar addition:
out = this + scalar Output variable has the same shape as the input variable |
SDVariable |
add(String name,
SDVariable x)
Addition operation: elementwise
this + x If this and x variables have equal shape, the output shape is the same as the inputs. Supports broadcasting: if this and x have different shapes and are broadcastable, the output shape is broadcast. |
void |
addControlDependency(SDVariable controlDependency)
Add a control dependency for this variable on the specified variable.
Control dependencies can be used to enforce the execution order. |
SDVariable |
argmax(int... dimensions)
|
SDVariable |
argmax(String name,
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,
int... dimensions)
|
SDVariable |
argmin(int... dimensions)
|
SDVariable |
argmin(String name,
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,
int... dimensions)
|
SDVariable |
assign(Number value)
Return a variable with equal shape to the input, but all elements set to the specified value
|
SDVariable |
castTo(@NonNull DataType dataType) |
SDVariable |
castTo(String name,
@NonNull DataType dataType) |
SDVariable |
clone(SameDiff sd) |
SDVariable |
convertToConstant()
Convert this variable to a constant.
|
SDVariable |
convertToVariable()
Convert this variable to a VARIABLE type SDVariable.
This can only be done for constants and placeholders, not ARRAY type variables (which are usually network activations). |
DataType |
dataType() |
SDVariable |
div(double scalar)
|
SDVariable |
div(SDVariable x)
|
SDVariable |
div(String varName,
double scalar)
Scalar division:
out = this / scalar Output variable has the same shape as the input variable |
SDVariable |
div(String name,
SDVariable x)
Division operation: elementwise
this / x If this and x variables have equal shape, the output shape is the same as the inputs. Supports broadcasting: if this and x have different shapes and are broadcastable, the output shape is broadcast. |
SDVariable |
dot(SDVariable other,
int... dimensions)
|
SDVariable |
dot(String name,
SDVariable other,
int... dimensions)
Matrix dot product: out = dot(this,other, dimensions)
|
SDVariable |
dup()
Create a new SDVariable, the contents of which is copied from this current variable
|
SDVariable |
eq(double value)
|
SDVariable |
eq(SDVariable other)
|
SDVariable |
eq(String name,
double value)
Equals operation: elementwise
this == value 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 other)
Equal to operation: elementwise
this == y If x and y arrays have equal shape, the output shape is the same as the inputs. Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
boolean |
equals(Object o) |
INDArray |
eval()
Evaluate the result of this variable
|
INDArray |
eval(Map<String,INDArray> placeholders)
Evaluate the result of this variable
|
SDVariable |
fdiv(String name,
SDVariable x)
Floor division operation: elementwise
this // x If this and x variables have equal shape, the output shape is the same as the inputs. Supports broadcasting: if this and x have different shapes and are broadcastable, the output shape is broadcast. |
SDVariable |
get(SDIndex... indices)
Get a variable with content equal to a specified sub-array of this variable.
Can be used (for example) to get rows, columns, sub-matrices, etc. |
INDArray |
getArr()
A getter for the allocated ndarray with this
SDVariable . |
INDArray |
getArr(boolean enforceExistence)
A getter for the allocated ndarray with this
SDVariable . |
SDVariable |
getGradient()
The gradient variable is the variable that represents the derivative of the loss function with respect
to the output of this variable.
|
long[] |
getShape()
Returns the shape of this variable
|
LongShapeDescriptor |
getShapeDescriptor() |
String |
getVarName()
Deprecated.
Use
name() |
SDVariable |
gradient()
Alias for the gradient variable - same as
getGradient() . |
SDVariable |
gt(double value)
|
SDVariable |
gt(SDVariable other)
|
SDVariable |
gt(String name,
double value)
Greater than operation: elementwise
this > value 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 other)
Greater than operation: elementwise
this > y If x and y arrays have equal shape, the output shape is the same as the inputs. Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
gte(double value)
|
SDVariable |
gte(SDVariable other)
|
SDVariable |
gte(String name,
double value)
Greater than or equals operation: elementwise
this >= value 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 other)
Greater than or equal to operation: elementwise
this >= y If x and y arrays have equal shape, the output shape is the same as the inputs. Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
boolean |
hasGradient()
Determine if this variable has a gradient with respect to the current loss.
|
int |
hashCode() |
boolean |
isConstant() |
boolean |
isPlaceHolder()
Returns true if this variable is a place holder
|
SDVariable |
lt(double value)
|
SDVariable |
lt(SDVariable other)
|
SDVariable |
lt(String name,
double value)
Less than operation: elementwise
this < value 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 other)
Less than operation: elementwise
this < y If x and y arrays have equal shape, the output shape is the same as the inputs. Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
lte(double value)
|
SDVariable |
lte(SDVariable other)
|
SDVariable |
lte(String name,
double value)
Less than or equals operation: elementwise
this <= value 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 other)
Less than or equal to operation: elementwise
this <= y If x and y arrays have equal shape, the output shape is the same as the inputs. Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
void |
markAsLoss()
Mark this variable as a loss function variable.
|
SDVariable |
max(boolean keepDims,
int... dimensions)
|
SDVariable |
max(int... dimensions)
|
SDVariable |
max(String name,
boolean keepDims,
int... dimensions)
Maximum 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,
int... dimensions)
|
SDVariable |
mean(boolean keepDims,
int... dimensions)
|
SDVariable |
mean(int... dimensions)
|
SDVariable |
mean(String name,
boolean keepDims,
int... dimensions)
Mean (average) array reduction operation, optionally along specified dimensions
Note that if keepDims = true, the output variable has the same rank as the input variable, with the reduced dimensions having size 1. |
SDVariable |
mean(String name,
int... dimensions)
|
SDVariable |
min(boolean keepDims,
int... dimensions)
|
SDVariable |
min(int... dimensions)
|
SDVariable |
min(String name,
boolean keepDims,
int... dimensions)
Minimum array reduction operation, optionally along specified dimensions.
|
SDVariable |
min(String name,
int... dimensions)
|
SDVariable |
minus(double other)
For Kotlin operator interop
|
SDVariable |
minus(SDVariable other)
For Kotlin operator interop
|
SDVariable |
mmul(SDVariable other)
|
SDVariable |
mmul(String name,
SDVariable other)
Matrix multiplication: out = mmul(this,other)
|
SDVariable |
mmul(String name,
SDVariable other,
@NonNull MMulTranspose mMulTranspose)
Matrix multiplication: out = mmul(this,other)
|
SDVariable |
mod(String name,
SDVariable x)
Modulo operation: elementwise
this / x If this and x variables have equal shape, the output shape is the same as the inputs. Supports broadcasting: if this and x have different shapes and are broadcastable, the output shape is broadcast. |
SDVariable |
mul(double scalar)
|
SDVariable |
mul(SDVariable x)
|
SDVariable |
mul(String varName,
double scalar)
Scalar multiplication:
out = this * scalar Output variable has the same shape as the input variable |
SDVariable |
mul(String name,
SDVariable x)
Multiplication operation: elementwise
this * x If this and x variables have equal shape, the output shape is the same as the inputs. Supports broadcasting: if this and x have different shapes and are broadcastable, the output shape is broadcast. |
String |
name()
Get the name of the SDVariable
|
SDVariable |
neg()
Negate op - returns a new variable with the values of the current variable negated
|
SDVariable |
neg(String name)
Negate op - returns a new variable with the values of the current variable negated
|
SDVariable |
neq(double value)
See
neq(SDVariable) |
SDVariable |
neq(SDVariable other)
|
SDVariable |
neq(String name,
double value)
Not equals operation: elementwise
this != value 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 other)
Not equal to operation: elementwise
this != y If x and y arrays have equal shape, the output shape is the same as the inputs. Supports broadcasting: if x and y have different shapes and are broadcastable, the output shape is broadcast. Returns an array with values 1 where condition is satisfied, or value 0 otherwise. |
SDVariable |
norm1(boolean keepDims,
int... dimensions)
|
SDVariable |
norm1(int... dimensions)
|
SDVariable |
norm1(String name,
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,
int... dimensions)
|
SDVariable |
norm2(boolean keepDims,
int... dimensions)
|
SDVariable |
norm2(int... dimensions)
|
SDVariable |
norm2(String name,
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,
int... dimensions)
|
SDVariable |
normmax(boolean keepDims,
int... dimensions)
|
SDVariable |
normmax(int... dimensions)
|
SDVariable |
normmax(String name,
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,
int... dimensions)
|
SDVariable |
permute(int... dimensions)
Permute the dimensions of the current variable according to the specified permutation indices.
Example: if the current variable has shape [a,b,c] and dimensions = [2,0,1] the output has shape [c,a,b] |
SDVariable |
permute(SDVariable dimensions) |
long[] |
placeholderShape() |
SDVariable |
plus(double other)
For Kotlin operator interop
|
SDVariable |
plus(SDVariable other)
For Kotlin operator interop
|
SDVariable |
pow(double scalar)
|
SDVariable |
pow(String varName,
double scalar)
Scalar power operation:
out = this ^ scalar Output variable has the same shape as the input variable |
SDVariable |
prod(boolean keepDims,
int... dimensions)
|
SDVariable |
prod(int... dimensions)
|
SDVariable |
prod(String name,
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,
int... dimensions)
|
SDVariable |
rank()
Get the rank of this variable as a dynamic SDVariable
|
SDVariable |
rdiv(double scalar)
|
SDVariable |
rdiv(SDVariable sameDiffVariable)
|
SDVariable |
rdiv(String varName,
double scalar)
Scalar reverse division:
out = scalar / this Output variable has the same shape as the input variable |
SDVariable |
rdiv(String name,
SDVariable x)
Reverse division operation: elementwise
x / this If this and x variables have equal shape, the output shape is the same as the inputs. Supports broadcasting: if this and x have different shapes and are broadcastable, the output shape is broadcast. |
SDVariable |
rename(String newName)
Rename this variable to a new name.
|
SDVariable |
reshape(int... newShape)
Reshape the current variable to the specified shape.
|
SDVariable |
reshape(long... newShape)
Reshape the current variable to the specified shape.
|
SDVariable |
reshape(SDVariable newShape)
Reshape the current variable to the specified (dynamic) shape.
|
SDVariable |
rsub(double scalar)
|
SDVariable |
rsub(SDVariable x)
|
SDVariable |
rsub(String varName,
double scalar)
Scalar reverse subtraction:
out = scalar - this Output variable has the same shape as the input variable |
SDVariable |
rsub(String name,
SDVariable x)
Reverse subtraction operation: elementwise
x - this If this and x variables have equal shape, the output shape is the same as the inputs. Supports broadcasting: if this and x have different shapes and are broadcastable, the output shape is broadcast. |
SDVariable |
setArray(INDArray array)
Associate the specified array with this variable
|
void |
setShape(long... shape) |
SDVariable |
shape()
Get the shape of the array as a dynamic SDVariable
|
SDVariable |
squaredDifference(SDVariable x)
|
SDVariable |
squaredDifference(String name,
SDVariable x)
Squared difference operation:
(this - x)^2 |
SDVariable |
std(boolean biasCorrected,
int... dimensions)
|
SDVariable |
std(String name,
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 |
std(String name,
boolean biasCorrected,
int... dimensions)
|
SDVariable |
sub(double scalar)
|
SDVariable |
sub(SDVariable x)
|
SDVariable |
sub(String varName,
double scalar)
Scalar subtraction:
out = this - scalar Output variable has the same shape as the input variable |
SDVariable |
sub(String name,
SDVariable x)
Subtraction operation: elementwise
this - x If this and x variables have equal shape, the output shape is the same as the inputs. Supports broadcasting: if this and x have different shapes and are broadcastable, the output shape is broadcast. |
SDVariable |
sum(boolean keepDims,
int... dimensions)
|
SDVariable |
sum(int... dimensions)
|
SDVariable |
sum(String name,
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,
int... dimensions)
|
SDVariable |
times(double other)
For Kotlin operator interop
|
SDVariable |
times(SDVariable other)
For Kotlin operator interop
|
String |
toString() |
protected SameDiff sameDiff
protected String varName
protected VariableType variableType
protected long[] shape
protected DataType dataType
public SDVariable(@NonNull @NonNull String varName, @NonNull @NonNull VariableType varType, @NonNull @NonNull SameDiff sameDiff, long[] shape, DataType dataType)
public String name()
@Deprecated public String getVarName()
name()
public boolean isPlaceHolder()
public boolean isConstant()
public INDArray getArr()
SDVariable
.
This getter will lazy initialize an array if one is not found based on the associated shape and
WeightInitScheme
- if this is possible. If this is not possible (due to shapes being unknown, etc)
null is returnedINDArray
associated with this variable.public INDArray getArr(boolean enforceExistence)
SDVariable
.
This getter will lazy initialize an array if one is not found based on the associated shape and
WeightInitScheme
- if this is possible.INDArray
associated with this variable.public SDVariable gradient()
getGradient()
.
The gradient variable is the variable that represents the derivative of the loss function with respect
to the output of this variable. I.e., if this variable is X and loss function is L, then gradient() returns the
variable representing dL/dX.public SDVariable getGradient()
SameDiff.setLossVariables(String...)
and then create the
gradient functions using SameDiff.createGradFunction()
. Alternatively, the gradient function will be
created automatically when training is performed.public long[] getShape()
public void setShape(long... shape)
public long[] placeholderShape()
public DataType dataType()
public LongShapeDescriptor getShapeDescriptor()
public SDVariable castTo(@NonNull @NonNull DataType dataType)
public SDVariable castTo(String name, @NonNull @NonNull DataType dataType)
public SDVariable dup()
public SDVariable assign(Number value)
value
- Value for returned variablepublic SDVariable neg()
public SDVariable neg(String name)
name
- Name of the new variablepublic SDVariable lt(double value)
public SDVariable lt(String name, double value)
this < value
name
- Name of the output variablevalue
- value argument to use in operationpublic SDVariable lte(double value)
public SDVariable lte(String name, double value)
this <= value
name
- Name of the output variablevalue
- value argument to use in operationpublic SDVariable gt(double value)
public SDVariable gt(String name, double value)
this > value
name
- Name of the output variablevalue
- value argument to use in operationpublic SDVariable gte(double value)
public SDVariable gte(String name, double value)
this >= value
name
- Name of the output variablevalue
- value argument to use in operationpublic SDVariable eq(double value)
public SDVariable eq(String name, double value)
this == value
name
- Name of the output variablevalue
- value argument to use in operationpublic SDVariable neq(double value)
neq(SDVariable)
public SDVariable neq(String name, double value)
this != value
name
- Name of the output variablevalue
- value argument to use in operationpublic SDVariable lt(SDVariable other)
public SDVariable lt(String name, SDVariable other)
this < y
name
- Name of the output variableother
- Variable to compare values againstpublic SDVariable lte(SDVariable other)
public SDVariable lte(String name, SDVariable other)
this <= y
name
- Name of the output variableother
- Variable to compare values againstpublic SDVariable gt(SDVariable other)
public SDVariable gt(String name, SDVariable other)
this > y
name
- Name of the output variableother
- Variable to compare values againstpublic SDVariable gte(SDVariable other)
public SDVariable gte(String name, SDVariable other)
this >= y
name
- Name of the output variableother
- Variable to compare values againstpublic SDVariable eq(SDVariable other)
public SDVariable eq(String name, SDVariable other)
this == y
name
- Name of the output variableother
- Variable to compare values againstpublic SDVariable neq(SDVariable other)
public SDVariable neq(String name, SDVariable other)
this != y
name
- Name of the output variableother
- Variable to compare values againstpublic SDVariable mmul(SDVariable other)
public SDVariable mmul(String name, SDVariable other)
name
- Name of the output variableother
- Other variable to perform matrix multiplication withpublic SDVariable mmul(String name, SDVariable other, @NonNull @NonNull MMulTranspose mMulTranspose)
name
- Name of the output variableother
- Other variable to perform matrix multiplication withmMulTranspose
- Matrix transpose configurationpublic SDVariable dot(SDVariable other, int... dimensions)
public SDVariable dot(String name, SDVariable other, int... dimensions)
name
- Name of the output variableother
- Other variable to perform matrix multiplication withpublic SDVariable add(double scalar)
public SDVariable add(String varName, double scalar)
out = this + scalar
varName
- Output variable namescalar
- Scalar for operationpublic SDVariable add(SDVariable other)
public SDVariable add(String name, SDVariable x)
this + x
name
- Name of the output variablex
- Variable to perform operation withpublic SDVariable plus(SDVariable other)
add(String, SDVariable)
public SDVariable plus(double other)
add(String, double)
public SDVariable sub(double scalar)
public SDVariable sub(String varName, double scalar)
out = this - scalar
varName
- Output variable namescalar
- Scalar for operationpublic SDVariable sub(SDVariable x)
public SDVariable sub(String name, SDVariable x)
this - x
name
- Name of the output variablex
- Variable to perform operation withpublic SDVariable minus(SDVariable other)
sub(String, SDVariable)
public SDVariable minus(double other)
sub(String, double)
public SDVariable div(double scalar)
public SDVariable div(String varName, double scalar)
out = this / scalar
varName
- Output variable namescalar
- Scalar for operationpublic SDVariable div(SDVariable x)
public SDVariable div(String name, SDVariable x)
this / x
name
- Name of the output variablex
- Variable to perform operation withpublic SDVariable fdiv(String name, SDVariable x)
this // x
name
- Name of the output variablex
- Variable to perform operation withpublic SDVariable mod(String name, SDVariable x)
this / x
name
- Name of the output variablex
- Variable to perform operation withpublic SDVariable mul(double scalar)
public SDVariable mul(String varName, double scalar)
out = this * scalar
varName
- Output variable namescalar
- Scalar for operationpublic SDVariable mul(SDVariable x)
public SDVariable mul(String name, SDVariable x)
this * x
name
- Name of the output variablex
- Variable to perform operation withpublic SDVariable times(SDVariable other)
mul(String, SDVariable)
public SDVariable times(double other)
mul(String, double)
public SDVariable pow(double scalar)
public SDVariable pow(String varName, double scalar)
out = this ^ scalar
varName
- Output variable namescalar
- Scalar for operationpublic SDVariable rsub(double scalar)
public SDVariable rsub(String varName, double scalar)
out = scalar - this
varName
- Output variable namescalar
- Scalar for operationpublic SDVariable rsub(SDVariable x)
public SDVariable rsub(String name, SDVariable x)
x - this
name
- Name of the output variablex
- Variable to perform operation withpublic SDVariable rdiv(double scalar)
public SDVariable rdiv(String varName, double scalar)
out = scalar / this
varName
- Output variable namescalar
- Scalar for operationpublic SDVariable rdiv(SDVariable sameDiffVariable)
public SDVariable rdiv(String name, SDVariable x)
x / this
name
- Name of the output variablex
- Variable to perform operation withpublic SDVariable squaredDifference(SDVariable x)
public SDVariable squaredDifference(String name, SDVariable x)
(this - x)^2
x
- Other input variablepublic SDVariable sum(int... dimensions)
public SDVariable sum(boolean keepDims, int... dimensions)
public SDVariable sum(String name, int... dimensions)
public SDVariable sum(String name, boolean keepDims, int... dimensions)
name
- Output variable namekeepDims
- 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 mean(boolean keepDims, int... dimensions)
public SDVariable mean(String name, int... dimensions)
public SDVariable mean(int... dimensions)
public SDVariable mean(String name, boolean keepDims, int... dimensions)
name
- Output variable namekeepDims
- 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 std(boolean biasCorrected, int... dimensions)
public SDVariable std(String name, boolean biasCorrected, int... dimensions)
public SDVariable std(String name, boolean biasCorrected, boolean keepDims, int... dimensions)
biasCorrected
- If true: divide by (N-1) (i.e., sample stdev). If false: divide by N (population stdev)keepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- Dimensions to reduce over. If dimensions are not specified, full array reduction is performedpublic SDVariable prod(int... dimensions)
public SDVariable prod(boolean keepDims, int... dimensions)
public SDVariable prod(String name, int... dimensions)
public SDVariable prod(String name, boolean keepDims, int... dimensions)
name
- Output variable namekeepDims
- 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 min(int... dimensions)
public SDVariable min(boolean keepDims, int... dimensions)
public SDVariable min(String name, int... dimensions)
public SDVariable min(String name, boolean keepDims, int... dimensions)
name
- Output variable namekeepDims
- 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(int... dimensions)
public SDVariable max(String name, int... dimensions)
public SDVariable max(boolean keepDims, int... dimensions)
public SDVariable max(String name, boolean keepDims, int... dimensions)
name
- Output variable namekeepDims
- 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 norm1(int... dimensions)
public SDVariable norm1(boolean keepDims, int... dimensions)
public SDVariable norm1(String name, int... dimensions)
public SDVariable norm1(String name, boolean keepDims, int... dimensions)
out = sum_i abs(x[i])
name
- Output variable namekeepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions to reduce overpublic SDVariable norm2(int... dimensions)
public SDVariable norm2(boolean keepDims, int... dimensions)
public SDVariable norm2(String name, int... dimensions)
public SDVariable norm2(String name, boolean keepDims, int... dimensions)
out = sqrt(sum_i x[i]^2)
name
- Output variable namekeepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions to reduce overpublic SDVariable normmax(int... dimensions)
public SDVariable normmax(boolean keepDims, int... dimensions)
public SDVariable normmax(String name, int... dimensions)
public SDVariable normmax(String name, boolean keepDims, int... dimensions)
out = max(abs(x[i]))
name
- Output variable namekeepDims
- If true: keep the dimensions that are reduced on (as size 1). False: remove the reduction dimensionsdimensions
- dimensions to reduce overpublic SDVariable argmax(int... dimensions)
public SDVariable argmax(String name, int... dimensions)
public SDVariable argmax(String name, boolean keepDims, int... dimensions)
name
- Name of the output 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(int... dimensions)
public SDVariable argmin(String name, int... dimensions)
public SDVariable argmin(String name, boolean keepDims, int... dimensions)
name
- Name of the output 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 shape()
public SDVariable rank()
public SDVariable reshape(SDVariable newShape)
newShape
- New shape for variablepublic SDVariable reshape(int... newShape)
newShape
- New shape for variablepublic SDVariable reshape(long... newShape)
newShape
- New shape for variablepublic SDVariable permute(int... dimensions)
dimensions
- The new dimension orderpublic SDVariable permute(SDVariable dimensions)
public SDVariable setArray(INDArray array)
array
- Array to associate with this variablepublic INDArray eval()
public INDArray eval(Map<String,INDArray> placeholders)
public void addControlDependency(SDVariable controlDependency)
controlDependency
- Control dependency to add for this variablepublic SDVariable get(SDIndex... indices)
indices
- Indices to getpublic SDVariable convertToConstant()
public SDVariable convertToVariable()
public SDVariable rename(String newName)
SameDiff.renameVariable(String, String)
newName
- The new name for the variable - no variable with this name must already existpublic void markAsLoss()
SameDiff.addLossVariable(String)
public boolean hasGradient()
SameDiff.createGradFunction()
and SameDiff.setLossVariables(String...)
public SDVariable clone(SameDiff sd)
Copyright © 2020. All rights reserved.