public abstract class DifferentialFunction extends Object
Modifier and Type | Field and Description |
---|---|
protected int[] |
dimensions |
protected Object[] |
extraArgs |
protected boolean |
inPlace |
protected SameDiff |
sameDiff |
protected Number |
scalarValue |
Constructor and Description |
---|
DifferentialFunction() |
DifferentialFunction(SameDiff sameDiff,
boolean inPlace,
Object[] extraArgs) |
DifferentialFunction(SameDiff sameDiff,
boolean inPlace,
SDVariable[] args)
Add the various arguments for
this function
|
DifferentialFunction(SameDiff sameDiff,
NodeDef nodeDef,
Map<String,AttrValue> attributesForNode,
GraphDef graph)
Initialize the function from the given
NodeDef |
DifferentialFunction(SameDiff sameDiff,
Object[] extraArgs) |
DifferentialFunction(SameDiff sameDiff,
OnnxProto3.NodeProto node,
Map<String,OnnxProto3.AttributeProto> attributesForNode,
OnnxProto3.GraphProto graph)
Initialize the function from the given
OnnxProto3.NodeProto |
DifferentialFunction(SameDiff sameDiff,
SDVariable[] args) |
Modifier and Type | Method and Description |
---|---|
SDVariable |
arg()
Return the first argument
|
SDVariable[] |
args()
Return the arguments for a given function
|
FunctionProperties |
asProperties()
Return function properties for the given function
|
Map<String,Map<String,AttributeAdapter>> |
attributeAdaptersForFunction()
Returns the
AttributeAdapter s for each of the
possible ops for import (typically tensorflow and onnx)
See AttributeAdapter for more information on what the
adapter does. |
List<int[]> |
calculateOutputShape()
Calculate
the output shape for this op
|
String |
configFieldName()
Returns the name of the field to be used for looking up field names.
|
List<SDVariable> |
diff(List<SDVariable> i_v1)
Perform automatic differentiation
wrt the input variables
|
abstract List<SDVariable> |
doDiff(List<SDVariable> f1)
The actual implementation for automatic differentiation.
|
DifferentialFunction |
dup()
Duplicate this function
|
boolean |
equals(Object o) |
DifferentialFunctionFactory |
f()
Shortcut for the
DifferentialFunctionFactory |
Object |
getValue(Field property)
Get the value for a given property
for this function
|
int |
hashCode() |
boolean |
hasPlaceHolderInputs()
Returns true if this
function has place holder inputs
|
abstract void |
initFromOnnx(OnnxProto3.NodeProto node,
SameDiff initWith,
Map<String,OnnxProto3.AttributeProto> attributesForNode,
OnnxProto3.GraphProto graph)
Iniitialize the function from the given
OnnxProto3.NodeProto |
abstract void |
initFromTensorFlow(NodeDef nodeDef,
SameDiff initWith,
Map<String,AttrValue> attributesForNode,
GraphDef graph)
Initialize the function from the given
NodeDef |
boolean |
isConfigProperties()
Returns true if the fields for this class should be looked up from a configuration class.
|
SDVariable |
larg()
The left argument for this function
|
Map<String,Map<String,PropertyMapping>> |
mappingsForFunction()
Returns the mappings for a given function (
for tensorflow and onnx import mapping properties
of this function).
|
abstract String |
onnxName()
The opName of this function in onnx
|
String[] |
onnxNames()
The opName of this function in onnx
|
String |
opName()
The name of the op
|
int |
opNum()
The number of the op (mainly for old legacy XYZ ops
like
Op ) |
Op.Type |
opType()
The type of the op
|
SDVariable[] |
outputVariables()
Return the output variables for this differential function.
|
abstract SDVariable[] |
outputVariables(String baseName)
Return the output functions for this differential function.
|
Map<String,Object> |
propertiesForFunction()
Returns the properties for a given function
|
SDVariable |
rarg()
The right argument for this function.
|
void |
resolvePropertiesFromSameDiffBeforeExecution()
Resolve properties and arguments right before execution of
this operation.
|
protected void |
setInstanceId() |
void |
setValueFor(Field target,
Object value)
Set the value for this function.
|
abstract String |
tensorflowName()
The opName of this function tensorflow
|
String[] |
tensorflowNames()
The opName of this function tensorflow
|
protected SameDiff sameDiff
protected boolean inPlace
protected Number scalarValue
protected int[] dimensions
protected Object[] extraArgs
public DifferentialFunction()
public DifferentialFunction(SameDiff sameDiff, NodeDef nodeDef, Map<String,AttrValue> attributesForNode, GraphDef graph)
NodeDef
nodeDef
- public DifferentialFunction(SameDiff sameDiff, OnnxProto3.NodeProto node, Map<String,OnnxProto3.AttributeProto> attributesForNode, OnnxProto3.GraphProto graph)
OnnxProto3.NodeProto
node
- public DifferentialFunction(SameDiff sameDiff, boolean inPlace, Object[] extraArgs)
sameDiff
- extraArgs
- public DifferentialFunction(SameDiff sameDiff, Object[] extraArgs)
sameDiff
- extraArgs
- public DifferentialFunction(SameDiff sameDiff, SDVariable[] args)
sameDiff
- args
- public DifferentialFunction(SameDiff sameDiff, boolean inPlace, SDVariable[] args)
sameDiff
- inPlace
- args
- public Map<String,Map<String,AttributeAdapter>> attributeAdaptersForFunction()
AttributeAdapter
s for each of the
possible ops for import (typically tensorflow and onnx)
See AttributeAdapter
for more information on what the
adapter does.
Similar to mappingsForFunction()
, the returned map
contains a AttributeAdapter
for each field name
when one is present. (It is optional for one to exist)_public Map<String,Map<String,PropertyMapping>> mappingsForFunction()
public Map<String,Object> propertiesForFunction()
public Object getValue(Field property)
property
- the property to getpublic void setValueFor(Field target, Object value)
ND4JIllegalStateException
will be thrown.target
- the target fieldvalue
- the value to setpublic boolean isConfigProperties()
public String configFieldName()
isConfigProperties()
to facilitate mapping fields for model import.public FunctionProperties asProperties()
public SDVariable[] outputVariables()
public abstract SDVariable[] outputVariables(String baseName)
public abstract List<SDVariable> doDiff(List<SDVariable> f1)
f1
- public DifferentialFunctionFactory f()
DifferentialFunctionFactory
public boolean hasPlaceHolderInputs()
public SDVariable[] args()
public void resolvePropertiesFromSameDiffBeforeExecution()
public SDVariable arg()
public List<SDVariable> diff(List<SDVariable> i_v1)
i_v1
- the input variablesprotected void setInstanceId()
public String opName()
public Op.Type opType()
public int opNum()
Op
)public abstract void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String,AttrValue> attributesForNode, GraphDef graph)
NodeDef
nodeDef
- initWith
- attributesForNode
- graph
- public abstract void initFromOnnx(OnnxProto3.NodeProto node, SameDiff initWith, Map<String,OnnxProto3.AttributeProto> attributesForNode, OnnxProto3.GraphProto graph)
OnnxProto3.NodeProto
node
- initWith
- attributesForNode
- graph
- public SDVariable larg()
public SDVariable rarg()
ND4JIllegalStateException
public DifferentialFunction dup()
public List<int[]> calculateOutputShape()
public String[] onnxNames()
public String[] tensorflowNames()
public abstract String onnxName()
public abstract String tensorflowName()
Copyright © 2018. All rights reserved.