Java Code Examples for org.nd4j.linalg.api.ndarray.INDArray#isR()

The following examples show how to use org.nd4j.linalg.api.ndarray.INDArray#isR() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MaxOut.java    From deeplearning4j with Apache License 2.0 6 votes vote down vote up
@Override
public boolean validateDataTypes(OpContext oc, boolean experimentalMode) {
    INDArray x = oc != null ? oc.getInputArray(0) : x();
    INDArray y = oc != null ? oc.getInputArray(1) : y();
    INDArray z = oc != null ? oc.getOutputArray(0) : z();

    if (!x.isR())
        return false;

    if (y != null && !y().isR())
        return false;

    if (z != null && z().dataType() != x().dataType())
        return false;

    return true;
}
 
Example 2
Source File: Variance.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public DataType resultType(OpContext oc){
    INDArray x = oc != null ? oc.getInputArray(0) : x();
    if (x != null && x.isR())
        return x.dataType();

    if(this.arg() != null){
        return this.arg().dataType();
    }

    return Nd4j.defaultFloatingPointType();
}
 
Example 3
Source File: Variance.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public boolean validateDataTypes(OpContext oc) {
    INDArray x = oc != null ? oc.getInputArray(0) : x();
    if (x != null && !x.isR()) {
        return false;
    }

    INDArray y = oc != null ? oc.getInputArray(1) : y();
    if (y != null && !y.isR())
        return false;

    INDArray z = oc != null ? oc.getOutputArray(0) : z();
    return !(z != null && !z.isR());
}
 
Example 4
Source File: BaseReduceFloatOp.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
@Override
public DataType resultType(OpContext oc) {
    INDArray x = oc != null ? oc.getInputArray(0) : x();
    if (x != null && x.isR())
        return x.dataType();

    return Nd4j.defaultFloatingPointType();
}