Package org.nd4j.linalg.api.ops
Class BaseReduceOp
- java.lang.Object
-
- org.nd4j.autodiff.functions.DifferentialFunction
-
- org.nd4j.linalg.api.ops.BaseOp
-
- org.nd4j.linalg.api.ops.BaseReduceOp
-
- Direct Known Subclasses:
BaseReduceBoolOp,BaseReduceFloatOp,BaseReduceLongOp,BaseReduceSameOp,Variance
public abstract class BaseReduceOp extends BaseOp implements ReduceOp
-
-
Field Summary
Fields Modifier and Type Field Description protected SDVariabledimensionVariableprotected booleanisComplexprotected booleanisEmptyReduceprotected booleankeepDims-
Fields inherited from class org.nd4j.linalg.api.ops.BaseOp
dimensionz, extraArgz, x, xVertexId, y, yVertexId, z, zVertexId
-
Fields inherited from class org.nd4j.autodiff.functions.DifferentialFunction
dimensions, extraArgs, inPlace, ownName, ownNameSetWithDefault, sameDiff, scalarValue
-
-
Constructor Summary
Constructors Constructor Description BaseReduceOp()BaseReduceOp(SameDiff sameDiff)BaseReduceOp(SameDiff sameDiff, SDVariable i_v)BaseReduceOp(SameDiff sameDiff, SDVariable i_v, boolean keepDims)BaseReduceOp(SameDiff sameDiff, SDVariable i_v, int[] dimensions)BaseReduceOp(SameDiff sameDiff, SDVariable i_v, int[] dimensions, boolean keepDims)BaseReduceOp(SameDiff sameDiff, SDVariable i_v, SDVariable i_v2)BaseReduceOp(SameDiff sameDiff, SDVariable i_v, SDVariable dimensions, boolean keepDims)BaseReduceOp(SameDiff sameDiff, SDVariable i_v, SDVariable i_v2, int[] dimensions)BaseReduceOp(SameDiff sameDiff, SDVariable i_v, SDVariable i_v2, int[] dimensions, boolean keepDims)BaseReduceOp(SameDiff sameDiff, SDVariable i_v, SDVariable i_v2, SDVariable dimensions)BaseReduceOp(INDArray x, boolean keepDims, int... dimensions)BaseReduceOp(INDArray x, int... dimensions)BaseReduceOp(INDArray x, INDArray y, int... dimensions)BaseReduceOp(INDArray x, INDArray y, INDArray z, boolean keepDims, int[] dimensions)BaseReduceOp(INDArray x, INDArray y, INDArray z, int... dimensions)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract List<LongShapeDescriptor>calculateOutputShape()Calculate the output shape for this opvoidconfigureWithSameDiff(SameDiff sameDiff)protected booleanhasReductionIndices(NodeDef nodeDef)voidinitFromOnnx(Onnx.NodeProto node, SameDiff initWith, Map<String,Onnx.AttributeProto> attributesForNode, Onnx.GraphProto graph)Iniitialize the function from the givenOnnx.NodeProtovoidinitFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String,AttrValue> attributesForNode, GraphDef graph)Initialize the function from the givenNodeDefbooleanisComplexAccumulation()booleanisKeepDims()This method returns TRUE if we're going to keep axis, FALSE otherwiseINDArraynoOp()Returns the no op version of the input Basically when a reduce can't happen (eg: sum(0) on a row vector) you have a no op state for a given reduction.voidsetDimensions(int... dimensions)voidsetPropertiesForFunction(Map<String,Object> properties)-
Methods inherited from class org.nd4j.linalg.api.ops.BaseOp
clearArrays, computeVariables, defineDimensions, dimensions, equals, extraArgs, extraArgsBuff, extraArgsDataBuff, getFinalResult, getInputArgument, getNumOutputs, getOpType, hashCode, onnxName, outputVariables, setX, setY, setZ, tensorflowName, toCustomOp, toString, x, y, z
-
Methods inherited from class org.nd4j.autodiff.functions.DifferentialFunction
arg, arg, argNames, args, attributeAdaptersForFunction, calculateOutputDataTypes, calculateOutputShape, configFieldName, diff, doDiff, dup, getBooleanFromProperty, getDoubleValueFromProperty, getIntValueFromProperty, getLongValueFromProperty, getStringFromProperty, getValue, isConfigProperties, larg, mappingsForFunction, onnxNames, opName, opNum, opType, outputs, outputVariable, outputVariables, outputVariablesNames, propertiesForFunction, rarg, replaceArg, setInstanceId, setValueFor, 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.Op
clearArrays, extraArgs, extraArgsBuff, extraArgsDataBuff, opName, opNum, setExtraArgs, setX, setY, setZ, toCustomOp, x, y, z
-
Methods inherited from interface org.nd4j.linalg.api.ops.ReduceOp
dimensions, getFinalResult, getOpType, resultType, resultType, validateDataTypes
-
-
-
-
Field Detail
-
keepDims
protected boolean keepDims
-
isComplex
protected boolean isComplex
-
isEmptyReduce
protected boolean isEmptyReduce
-
dimensionVariable
protected SDVariable dimensionVariable
-
-
Constructor Detail
-
BaseReduceOp
public BaseReduceOp(SameDiff sameDiff, SDVariable i_v, int[] dimensions, boolean keepDims)
-
BaseReduceOp
public BaseReduceOp(SameDiff sameDiff, SDVariable i_v, SDVariable i_v2, int[] dimensions, boolean keepDims)
-
BaseReduceOp
public BaseReduceOp(SameDiff sameDiff, SDVariable i_v)
-
BaseReduceOp
public BaseReduceOp(SameDiff sameDiff, SDVariable i_v, int[] dimensions)
-
BaseReduceOp
public BaseReduceOp(SameDiff sameDiff, SDVariable i_v, SDVariable i_v2, int[] dimensions)
-
BaseReduceOp
public BaseReduceOp(SameDiff sameDiff, SDVariable i_v, boolean keepDims)
-
BaseReduceOp
public BaseReduceOp(SameDiff sameDiff, SDVariable i_v, SDVariable dimensions, boolean keepDims)
-
BaseReduceOp
public BaseReduceOp(SameDiff sameDiff, SDVariable i_v, SDVariable i_v2)
-
BaseReduceOp
public BaseReduceOp()
-
BaseReduceOp
public BaseReduceOp(INDArray x, INDArray y, INDArray z, boolean keepDims, int[] dimensions)
-
BaseReduceOp
public BaseReduceOp(INDArray x, int... dimensions)
-
BaseReduceOp
public BaseReduceOp(INDArray x, boolean keepDims, int... dimensions)
-
BaseReduceOp
public BaseReduceOp(SameDiff sameDiff)
-
BaseReduceOp
public BaseReduceOp(SameDiff sameDiff, SDVariable i_v, SDVariable i_v2, SDVariable dimensions)
-
-
Method Detail
-
noOp
public INDArray noOp()
Description copied from interface:ReduceOpReturns the no op version of the input Basically when a reduce can't happen (eg: sum(0) on a row vector) you have a no op state for a given reduction. For most accumulations, this should return x but certain transformations should return say: the absolute value
-
isKeepDims
public boolean isKeepDims()
Description copied from interface:ReduceOpThis method returns TRUE if we're going to keep axis, FALSE otherwise- Specified by:
isKeepDimsin interfaceReduceOp- Returns:
-
calculateOutputShape
public abstract List<LongShapeDescriptor> calculateOutputShape()
Description copied from class:DifferentialFunctionCalculate the output shape for this op- Overrides:
calculateOutputShapein classDifferentialFunction- Returns:
- List of output shape descriptors
-
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 classBaseOp
-
hasReductionIndices
protected boolean hasReductionIndices(NodeDef nodeDef)
-
initFromOnnx
public void initFromOnnx(Onnx.NodeProto node, SameDiff initWith, Map<String,Onnx.AttributeProto> attributesForNode, Onnx.GraphProto graph)
Description copied from class:DifferentialFunctionIniitialize the function from the givenOnnx.NodeProto- Overrides:
initFromOnnxin classBaseOp
-
isComplexAccumulation
public boolean isComplexAccumulation()
- Specified by:
isComplexAccumulationin interfaceReduceOp
-
setDimensions
public void setDimensions(int... dimensions)
- Specified by:
setDimensionsin interfaceReduceOp
-
setPropertiesForFunction
public void setPropertiesForFunction(Map<String,Object> properties)
- Overrides:
setPropertiesForFunctionin classDifferentialFunction
-
configureWithSameDiff
public void configureWithSameDiff(SameDiff sameDiff)
- Overrides:
configureWithSameDiffin classDifferentialFunction
-
-