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 SDVariable
dimensionVariable
protected boolean
isComplex
protected boolean
isEmptyReduce
protected boolean
keepDims
-
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 opvoid
configureWithSameDiff(SameDiff sameDiff)
protected boolean
hasReductionIndices(NodeDef nodeDef)
void
initFromOnnx(Onnx.NodeProto node, SameDiff initWith, Map<String,Onnx.AttributeProto> attributesForNode, Onnx.GraphProto graph)
Iniitialize the function from the givenOnnx.NodeProto
void
initFromTensorFlow(NodeDef nodeDef, SameDiff initWith, Map<String,AttrValue> attributesForNode, GraphDef graph)
Initialize the function from the givenNodeDef
boolean
isComplexAccumulation()
boolean
isKeepDims()
This method returns TRUE if we're going to keep axis, FALSE otherwiseINDArray
noOp()
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.void
setDimensions(int... dimensions)
void
setPropertiesForFunction(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:ReduceOp
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. For most accumulations, this should return x but certain transformations should return say: the absolute value
-
isKeepDims
public boolean isKeepDims()
Description copied from interface:ReduceOp
This method returns TRUE if we're going to keep axis, FALSE otherwise- Specified by:
isKeepDims
in interfaceReduceOp
- Returns:
-
calculateOutputShape
public abstract List<LongShapeDescriptor> calculateOutputShape()
Description copied from class:DifferentialFunction
Calculate the output shape for this op- Overrides:
calculateOutputShape
in 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:DifferentialFunction
Initialize the function from the givenNodeDef
- Overrides:
initFromTensorFlow
in 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:DifferentialFunction
Iniitialize the function from the givenOnnx.NodeProto
- Overrides:
initFromOnnx
in classBaseOp
-
isComplexAccumulation
public boolean isComplexAccumulation()
- Specified by:
isComplexAccumulation
in interfaceReduceOp
-
setDimensions
public void setDimensions(int... dimensions)
- Specified by:
setDimensions
in interfaceReduceOp
-
setPropertiesForFunction
public void setPropertiesForFunction(Map<String,Object> properties)
- Overrides:
setPropertiesForFunction
in classDifferentialFunction
-
configureWithSameDiff
public void configureWithSameDiff(SameDiff sameDiff)
- Overrides:
configureWithSameDiff
in classDifferentialFunction
-
-