Class BaseCompatOp
- java.lang.Object
-
- org.nd4j.autodiff.functions.DifferentialFunction
-
- org.nd4j.linalg.api.ops.DynamicCustomOp
-
- org.nd4j.linalg.api.ops.impl.controlflow.compat.BaseCompatOp
-
- All Implemented Interfaces:
CustomOp
public abstract class BaseCompatOp extends DynamicCustomOp
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.nd4j.linalg.api.ops.DynamicCustomOp
DynamicCustomOp.DynamicCustomOpsBuilder
-
-
Field Summary
Fields Modifier and Type Field Description protected StringframeName-
Fields inherited from class org.nd4j.linalg.api.ops.DynamicCustomOp
axis, bArguments, dArguments, iArguments, inplaceCall, inputArguments, outputArguments, outputVariables, sArguments, tArguments
-
Fields inherited from class org.nd4j.autodiff.functions.DifferentialFunction
dimensions, extraArgs, inPlace, ownName, ownNameSetWithDefault, sameDiff, scalarValue
-
-
Constructor Summary
Constructors Constructor Description BaseCompatOp()BaseCompatOp(SameDiff sameDiff, SDVariable[] inputs)BaseCompatOp(INDArray... inputs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSArgument(String... args)Map<String,Map<String,AttributeAdapter>>attributeAdaptersForFunction()Returns theAttributeAdapters for each of the possible ops for import (typically tensorflow and onnx) SeeAttributeAdapterfor more information on what the adapter does.List<LongShapeDescriptor>calculateOutputShape()Calculate the output shape for this opvoidcomputeArrays()voidconfigureFromArguments()This allows a custom op to configure relevant fields from its arguments.voidconfigureWithSameDiff(SameDiff sameDiff)StringgetFrameName()voidinitFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String,AttrValue> attributesForNode, GraphDef graph)Initialize the function from the givenNodeDefMap<String,Map<String,PropertyMapping>>mappingsForFunction()Returns the mappings for a given function ( for tensorflow and onnx import mapping properties of this function).Map<String,Object>propertiesForFunction()Returns the properties for a given functionvoidsetFrameName(@NonNull String frameName)voidsetPropertiesForFunction(Map<String,Object> properties)-
Methods inherited from class org.nd4j.linalg.api.ops.DynamicCustomOp
addBArgument, addDArgument, addIArgument, addIArgument, addInputArgument, addOutputArgument, addOutputsToOp, addTArgument, assertValidForExecution, bArgs, builder, calculateOutputShape, clearArrays, dArgs, doDiff, generateFake, generateFake, getBArgument, getDescriptor, getIArgument, getInputArgument, getOutputArgument, getSArgument, getTArgument, getValue, iArgs, initFromOnnx, inputArguments, numBArguments, numDArguments, numIArguments, numInputArguments, numOutputArguments, numSArguments, numTArguments, onnxName, opHash, opName, opNum, opType, outputArguments, outputVariables, outputVariables, removeIArgument, removeInputArgument, removeOutputArgument, removeSArgument, removeTArgument, sArgs, setInputArgument, setInputArguments, setOutputArgument, setValueFor, tArgs, tensorflowName, toString, wrapFilterNull, wrapOrNull, wrapOrNull
-
Methods inherited from class org.nd4j.autodiff.functions.DifferentialFunction
arg, arg, argNames, args, calculateOutputDataTypes, configFieldName, diff, dup, equals, getBooleanFromProperty, getDoubleValueFromProperty, getIntValueFromProperty, getLongValueFromProperty, getNumOutputs, getStringFromProperty, hashCode, isConfigProperties, larg, onnxNames, outputs, outputVariable, outputVariablesNames, rarg, replaceArg, setInstanceId, tensorflowNames
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.nd4j.linalg.api.ops.CustomOp
isInplaceCall
-
-
-
-
Field Detail
-
frameName
protected String frameName
-
-
Constructor Detail
-
BaseCompatOp
public BaseCompatOp(SameDiff sameDiff, SDVariable[] inputs)
-
BaseCompatOp
public BaseCompatOp(INDArray... inputs)
-
BaseCompatOp
public BaseCompatOp()
-
-
Method Detail
-
getFrameName
public String getFrameName()
-
setFrameName
public void setFrameName(@NonNull @NonNull String frameName)
-
initFromTensorFlow
public void initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String,AttrValue> attributesForNode, GraphDef graph)
Description copied from class:DifferentialFunctionInitialize the function from the givenNodeDef- Overrides:
initFromTensorFlowin classDynamicCustomOp
-
propertiesForFunction
public Map<String,Object> propertiesForFunction()
Description copied from class:DifferentialFunctionReturns the properties for a given function- Overrides:
propertiesForFunctionin classDynamicCustomOp- Returns:
-
configureFromArguments
public void configureFromArguments()
Description copied from interface:CustomOpThis allows a custom op to configure relevant fields from its arguments. This is needed when ops are created via reflection for things like model import.- Specified by:
configureFromArgumentsin interfaceCustomOp- Overrides:
configureFromArgumentsin classDynamicCustomOp
-
setPropertiesForFunction
public void setPropertiesForFunction(Map<String,Object> properties)
- Overrides:
setPropertiesForFunctionin classDynamicCustomOp
-
configureWithSameDiff
public void configureWithSameDiff(SameDiff sameDiff)
- Overrides:
configureWithSameDiffin classDifferentialFunction
-
mappingsForFunction
public Map<String,Map<String,PropertyMapping>> mappingsForFunction()
Description copied from class:DifferentialFunctionReturns the mappings for a given function ( for tensorflow and onnx import mapping properties of this function). The mapping is indexed by field name. If the function has no properties, this returned map will be empty. Note that some functions have multiple names. This function returns a map indexed by each alias it has for a given name. These names include both onnx and tensorflow names (which might be 1 or more)- Overrides:
mappingsForFunctionin classDynamicCustomOp- Returns:
-
computeArrays
public void computeArrays()
- Overrides:
computeArraysin classDynamicCustomOp
-
addSArgument
public void addSArgument(String... args)
- Specified by:
addSArgumentin interfaceCustomOp- Overrides:
addSArgumentin classDynamicCustomOp
-
attributeAdaptersForFunction
public Map<String,Map<String,AttributeAdapter>> attributeAdaptersForFunction()
Description copied from class:DifferentialFunctionReturns theAttributeAdapters for each of the possible ops for import (typically tensorflow and onnx) SeeAttributeAdapterfor more information on what the adapter does. Similar toDifferentialFunction.mappingsForFunction(), the returned map contains aAttributeAdapterfor each field name when one is present. (It is optional for one to exist)_- Overrides:
attributeAdaptersForFunctionin classDifferentialFunction- Returns:
-
calculateOutputShape
public List<LongShapeDescriptor> calculateOutputShape()
Description copied from class:DifferentialFunctionCalculate the output shape for this op- Specified by:
calculateOutputShapein interfaceCustomOp- Overrides:
calculateOutputShapein classDynamicCustomOp- Returns:
- List of output shape descriptors
-
-