public class If extends DifferentialFunction implements CustomOp
SameDiff.SameDiffFunctionDefinition
depending on a predicate SameDiff.SameDiffConditional| Modifier and Type | Field and Description |
|---|---|
protected String |
blockName |
protected SDVariable |
dummyResult |
protected SameDiff.SameDiffFunctionDefinition |
falseBody |
protected SameDiff |
falseBodyExecution |
protected String |
falseBodyName |
protected SDVariable[] |
inputVars |
protected SameDiff |
loopBodyExecution |
protected SDVariable[] |
outputVars |
protected SameDiff.SameDiffConditional |
predicate |
protected SameDiff |
predicateExecution |
protected SDVariable |
targetBoolean |
protected SameDiff.SameDiffFunctionDefinition |
trueBody |
protected Boolean |
trueBodyExecuted |
protected String |
trueBodyName |
dimensions, extraArgs, inPlace, sameDiff, scalarValue| Constructor and Description |
|---|
If(If ifStatement) |
If(String blockName,
SameDiff parent,
SDVariable[] inputVars,
SameDiff.SameDiffFunctionDefinition conditionBody,
SameDiff.SameDiffConditional predicate,
SameDiff.SameDiffFunctionDefinition trueBody,
SameDiff.SameDiffFunctionDefinition falseBody) |
| Modifier and Type | Method and Description |
|---|---|
void |
addIArgument(int... arg) |
void |
addInputArgument(INDArray... arg) |
void |
addOutputArgument(INDArray... arg) |
void |
addTArgument(double... arg) |
void |
assertValidForExecution()
Asserts a valid state for execution,
otherwise throws an
ND4JIllegalStateException |
List<int[]> |
calculateOutputShape()
Calculate
the output shape for this op
|
List<SDVariable> |
doDiff(List<SDVariable> f1)
The actual implementation for automatic differentiation.
|
void |
exectedTrueOrFalse(boolean trueBodyExecuted)
Toggle whether the true body was executed
or the false body
|
CustomOpDescriptor |
getDescriptor()
Get the custom op descriptor if one is available.
|
Integer |
getIArgument(int index) |
INDArray |
getInputArgument(int index) |
INDArray |
getOutputArgument(int index) |
Double |
getTArgument(int index) |
int[] |
iArgs() |
void |
initFromOnnx(OnnxProto3.NodeProto node,
SameDiff initWith,
Map<String,OnnxProto3.AttributeProto> attributesForNode,
OnnxProto3.GraphProto graph)
Iniitialize the function from the given
OnnxProto3.NodeProto |
void |
initFromTensorFlow(NodeDef nodeDef,
SameDiff initWith,
Map<String,AttrValue> attributesForNode,
GraphDef graph)
Initialize the function from the given
NodeDef |
INDArray[] |
inputArguments() |
boolean |
isInplaceCall()
This method returns true if op is supposed to be executed inplace
|
int |
numIArguments() |
int |
numInputArguments() |
int |
numOutputArguments() |
int |
numTArguments() |
String |
onnxName()
The opName of this function in onnx
|
long |
opHash()
This method returns LongHash of the opName()
|
String |
opName()
The name of the op
|
Op.Type |
opType()
The type of the op
|
INDArray[] |
outputArguments() |
SDVariable[] |
outputVariables(String baseName)
Return the output functions for this differential function.
|
void |
populateInputsAndOutputsFromSameDiff()
Attempt to populate inputs and outputs from samediff.
|
void |
removeIArgument(Integer arg) |
void |
removeInputArgument(INDArray arg) |
void |
removeOutputArgument(INDArray arg) |
void |
removeTArgument(Double arg) |
double[] |
tArgs() |
String |
tensorflowName()
The opName of this function tensorflow
|
String |
toString() |
arg, args, asProperties, attributeAdaptersForFunction, configFieldName, diff, dup, equals, f, getValue, hashCode, hasPlaceHolderInputs, isConfigProperties, larg, mappingsForFunction, onnxNames, opNum, outputVariables, propertiesForFunction, rarg, resolvePropertiesFromSameDiffBeforeExecution, setInstanceId, setValueFor, tensorflowNamesprotected SameDiff loopBodyExecution
protected SameDiff predicateExecution
protected SameDiff falseBodyExecution
protected SameDiff.SameDiffConditional predicate
protected SameDiff.SameDiffFunctionDefinition trueBody
protected SameDiff.SameDiffFunctionDefinition falseBody
protected String blockName
protected String trueBodyName
protected String falseBodyName
protected SDVariable[] inputVars
protected Boolean trueBodyExecuted
protected SDVariable targetBoolean
protected SDVariable dummyResult
protected SDVariable[] outputVars
public If(If ifStatement)
public If(String blockName, SameDiff parent, SDVariable[] inputVars, SameDiff.SameDiffFunctionDefinition conditionBody, SameDiff.SameDiffConditional predicate, SameDiff.SameDiffFunctionDefinition trueBody, SameDiff.SameDiffFunctionDefinition falseBody)
public void exectedTrueOrFalse(boolean trueBodyExecuted)
trueBodyExecuted - public SDVariable[] outputVariables(String baseName)
DifferentialFunctionoutputVariables in class DifferentialFunctionpublic List<SDVariable> doDiff(List<SDVariable> f1)
DifferentialFunctiondoDiff in class DifferentialFunctionpublic String opName()
DifferentialFunctionopName in interface CustomOpopName in class DifferentialFunctionpublic long opHash()
CustomOppublic boolean isInplaceCall()
CustomOpisInplaceCall in interface CustomOppublic INDArray[] outputArguments()
outputArguments in interface CustomOppublic INDArray[] inputArguments()
inputArguments in interface CustomOppublic void addIArgument(int... arg)
addIArgument in interface CustomOppublic void removeIArgument(Integer arg)
removeIArgument in interface CustomOppublic Integer getIArgument(int index)
getIArgument in interface CustomOppublic int numIArguments()
numIArguments in interface CustomOppublic void addTArgument(double... arg)
addTArgument in interface CustomOppublic void removeTArgument(Double arg)
removeTArgument in interface CustomOppublic Double getTArgument(int index)
getTArgument in interface CustomOppublic int numTArguments()
numTArguments in interface CustomOppublic void addInputArgument(INDArray... arg)
addInputArgument in interface CustomOppublic void removeInputArgument(INDArray arg)
removeInputArgument in interface CustomOppublic INDArray getInputArgument(int index)
getInputArgument in interface CustomOppublic int numInputArguments()
numInputArguments in interface CustomOppublic void addOutputArgument(INDArray... arg)
addOutputArgument in interface CustomOppublic void removeOutputArgument(INDArray arg)
removeOutputArgument in interface CustomOppublic INDArray getOutputArgument(int index)
getOutputArgument in interface CustomOppublic int numOutputArguments()
numOutputArguments in interface CustomOppublic Op.Type opType()
DifferentialFunctionopType in class DifferentialFunctionpublic void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String,AttrValue> attributesForNode, GraphDef graph)
DifferentialFunctionNodeDefinitFromTensorFlow in class DifferentialFunctionpublic void initFromOnnx(OnnxProto3.NodeProto node, SameDiff initWith, Map<String,OnnxProto3.AttributeProto> attributesForNode, OnnxProto3.GraphProto graph)
DifferentialFunctionOnnxProto3.NodeProtoinitFromOnnx in class DifferentialFunctionpublic List<int[]> calculateOutputShape()
DifferentialFunctioncalculateOutputShape in interface CustomOpcalculateOutputShape in class DifferentialFunctionpublic CustomOpDescriptor getDescriptor()
CustomOpgetDescriptor in interface CustomOppublic void assertValidForExecution()
CustomOpND4JIllegalStateExceptionassertValidForExecution in interface CustomOppublic void populateInputsAndOutputsFromSameDiff()
CustomOppopulateInputsAndOutputsFromSameDiff in interface CustomOppublic String onnxName()
DifferentialFunctiononnxName in class DifferentialFunctionpublic String tensorflowName()
DifferentialFunctiontensorflowName in class DifferentialFunctionCopyright © 2018. All rights reserved.