Search in sources :

Example 1 with StandardDeviation

use of org.nd4j.linalg.api.ops.impl.accum.StandardDeviation in project nd4j by deeplearning4j.

the class DefaultOpFactory method createAccum.

@Override
public Accumulation createAccum(String name, INDArray x, INDArray y, INDArray z, Object[] extraArgs) {
    Accumulation ret = null;
    switch(name) {
        case "mmul":
        case "std":
            ret = new StandardDeviation(x, y, z, x.length(), (boolean) extraArgs[0]);
            break;
        case "var":
            ret = new Variance(x, y, z, x.length(), (boolean) extraArgs[0]);
            break;
        default:
            try {
                ret = (Accumulation) DifferentialFunctionClassHolder.getInstance().getInstance(name).getClass().getConstructor(INDArray.class, INDArray.class, INDArray.class, long.class).newInstance(x, y, z, x.length());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
    }
    if (ret == null)
        throw new IllegalArgumentException("Illegal operation opName " + name);
    ret.setExtraArgs(extraArgs);
    return ret;
}
Also used : INDArray(org.nd4j.linalg.api.ndarray.INDArray) StandardDeviation(org.nd4j.linalg.api.ops.impl.accum.StandardDeviation) Variance(org.nd4j.linalg.api.ops.impl.accum.Variance)

Aggregations

INDArray (org.nd4j.linalg.api.ndarray.INDArray)1 StandardDeviation (org.nd4j.linalg.api.ops.impl.accum.StandardDeviation)1 Variance (org.nd4j.linalg.api.ops.impl.accum.Variance)1