public abstract class BaseAccumulation extends BaseOp implements Accumulation
Modifier and Type | Field and Description |
---|---|
protected boolean |
applyFinalTransform |
protected Number |
finalResult |
protected IComplexNumber |
finalResultComplex |
extraArgs, n, numProcessed, passThrough, x, y, z
Constructor and Description |
---|
BaseAccumulation() |
BaseAccumulation(INDArray x) |
BaseAccumulation(INDArray x,
INDArray y) |
BaseAccumulation(INDArray x,
INDArray y,
INDArray z,
long n)
Initialize with the given
input, pairwise transform, result, and number
of elements
|
BaseAccumulation(INDArray x,
INDArray y,
long n) |
Modifier and Type | Method and Description |
---|---|
boolean |
applyFinalTransform()
Whether to apply the final
transform or not
|
double |
calculateFinalResult(double accum,
long n)
Calculate the final result.
|
float |
calculateFinalResult(float accum,
long n) |
double |
combineSubResults(double first,
double second)
Combine sub-results, when the Accumulation operation is split and executed in
parallel.
Sometimes this is the same as the update operation (i.e., in sum operation), but often it is not (for example, in L2 norm, sqrt(1/n * sum_i x_i^2). |
float |
combineSubResults(float first,
float second) |
IComplexNumber |
combineSubResults(IComplexNumber first,
IComplexNumber second) |
Number |
currentResult()
Essentially identical to
Accumulation.getFinalResult() , maintained to avoid breaking
implementations created before Accumulation ops were refactored. |
double |
getAndSetFinalResult(double accum)
Get and set the final result.
The final result is also stored in the Accumulation op itself (and can be retrieved by getFinalResult()) In some Accumulation operations, a final operation must be done on the accumulated result. |
float |
getAndSetFinalResult(float accum) |
IComplexNumber |
getAndSetFinalResult(IComplexNumber accum)
Complex version of getAndSetFinalResult().
|
Number |
getFinalResult()
Get the final result (may return null if getAndSetFinalResult has not
been called, or for accumulation ops on complex arrays)
|
IComplexNumber |
getFinalResultComplex() |
void |
init(INDArray x,
INDArray y,
INDArray z,
long n)
Initialize the operation based on the parameters
|
INDArray |
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.
|
long |
numProcessed()
Number processed
|
double |
op(double origin)
Transform an individual element
|
double |
op(double origin,
double other)
Pairwise op (applicable with an individual element in y)
|
float |
op(float origin)
Transform an individual element
|
float |
op(float origin,
float other)
Pairwise op (applicable with an individual element in y)
|
IComplexNumber |
op(IComplexNumber origin)
Transform an individual element
|
IComplexNumber |
op(IComplexNumber origin,
double other)
Pairwise op (applicable with an individual element in y)
|
IComplexNumber |
op(IComplexNumber origin,
float other)
Pairwise op (applicable with an individual element in y)
|
IComplexNumber |
op(IComplexNumber origin,
IComplexNumber other)
Pairwise op (applicable with an individual element in y)
|
void |
setApplyFinalTransform(boolean applyFinalTransform)
Setter for final transform
|
void |
setFinalResult(Number number) |
void |
setFinalResultComplex(IComplexNumber number) |
IComplexNumber |
zeroComplex()
Complex initial value
|
double |
zeroDouble()
Initial value (used to initialize the accumulation op)
|
float |
zeroFloat()
Initial value (used to initialize the accumulation op)
|
exec, exec, extraArgs, extraArgsBuff, extraArgsDataBuff, getOpType, isExecSpecial, isPassThrough, n, setN, setX, setY, setZ, toString, x, y, z
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
update, update, update, update, update, update, update, update, update
exec, exec, extraArgs, extraArgsBuff, extraArgsDataBuff, isExecSpecial, isPassThrough, n, name, opForDimension, opForDimension, opNum, setN, setX, setY, setZ, x, y, z
protected Number finalResult
protected IComplexNumber finalResultComplex
protected boolean applyFinalTransform
public BaseAccumulation()
public BaseAccumulation(INDArray x, INDArray y, INDArray z, long n)
x
- the inputy
- the pairwise transformz
- the resultn
- the number of elementspublic BaseAccumulation(INDArray x)
public INDArray noOp()
Accumulation
noOp
in interface Accumulation
public boolean applyFinalTransform()
Accumulation
applyFinalTransform
in interface Accumulation
public void setApplyFinalTransform(boolean applyFinalTransform)
Accumulation
setApplyFinalTransform
in interface Accumulation
public IComplexNumber op(IComplexNumber origin, double other)
Op
op
in interface Accumulation
op
in interface Op
origin
- the origin numberother
- the other numberpublic IComplexNumber op(IComplexNumber origin, float other)
Op
op
in interface Accumulation
op
in interface Op
origin
- the origin numberother
- the other numberpublic IComplexNumber op(IComplexNumber origin, IComplexNumber other)
Op
op
in interface Accumulation
op
in interface Op
origin
- the origin numberother
- the other numberpublic float op(float origin, float other)
Op
public double op(double origin, double other)
Op
public double op(double origin)
Op
public float op(float origin)
Op
public IComplexNumber op(IComplexNumber origin)
Op
op
in interface Accumulation
op
in interface Op
origin
- the origin elementpublic double zeroDouble()
Accumulation
zeroDouble
in interface Accumulation
public float zeroFloat()
Accumulation
zeroFloat
in interface Accumulation
public IComplexNumber zeroComplex()
Accumulation
zeroComplex
in interface Accumulation
public long numProcessed()
Op
numProcessed
in interface Op
numProcessed
in class BaseOp
public void init(INDArray x, INDArray y, INDArray z, long n)
Op
public double combineSubResults(double first, double second)
Accumulation
combineSubResults
in interface Accumulation
first
- The first sub-value to be combinedsecond
- The second sub-value to be combinedpublic float combineSubResults(float first, float second)
combineSubResults
in interface Accumulation
Accumulation.combineSubResults(double, double)
public IComplexNumber combineSubResults(IComplexNumber first, IComplexNumber second)
combineSubResults
in interface Accumulation
Accumulation.combineSubResults(double, double)
public double getAndSetFinalResult(double accum)
Accumulation
getAndSetFinalResult
in interface Accumulation
accum
- The accumulated resultpublic float getAndSetFinalResult(float accum)
getAndSetFinalResult
in interface Accumulation
Accumulation.getAndSetFinalResult(double)
public IComplexNumber getAndSetFinalResult(IComplexNumber accum)
Accumulation
getAndSetFinalResult
in interface Accumulation
Accumulation.getAndSetFinalResult(double)
public double calculateFinalResult(double accum, long n)
Accumulation
Accumulation.getAndSetFinalResult(double)
, the result is
merely calculated and returned, not stored in the Accumulation op itself.calculateFinalResult
in interface Accumulation
accum
- The accumulated resultn
- the number of elements accumulatedpublic float calculateFinalResult(float accum, long n)
calculateFinalResult
in interface Accumulation
#calculateFinalResult(double, int)
public Number currentResult()
Accumulation
Accumulation.getFinalResult()
, maintained to avoid breaking
implementations created before Accumulation ops were refactored.
May be removed in a future release.currentResult
in interface Accumulation
public void setFinalResult(Number number)
setFinalResult
in interface Accumulation
public void setFinalResultComplex(IComplexNumber number)
setFinalResultComplex
in interface Accumulation
public Number getFinalResult()
Accumulation
getFinalResult
in interface Accumulation
public IComplexNumber getFinalResultComplex()
getFinalResultComplex
in interface Accumulation
Copyright © 2016. All Rights Reserved.