public INDArray getArr() {
        if(sameDiff.arrayAlreadyExistsForVarName(getVarName()))
            return sameDiff.getArrForVarName(getVarName());

        //initialize value if it's actually a scalar constant (zero or 1 typically...)
        if(getScalarValue() != null && ArrayUtil.prod(getShape()) == 1) {
            INDArray arr = Nd4j.valueArrayOf(getShape(),
                    getScalarValue().doubleValue());
            sameDiff.associateArrayWithVariable(arr,this);
        }
        else if(sameDiff.getShapeForVarName(getVarName()) == null)
            return null;

        else {
            INDArray newAlloc = getWeightInitScheme().create(sameDiff.getShapeForVarName(getVarName()));
            sameDiff.associateArrayWithVariable(newAlloc,this);

        }

        return sameDiff.getArrForVarName(getVarName());
    }
public INDArray getArr() {
        if(sameDiff.arrayAlreadyExistsForVarName(getVarName()))
            return sameDiff.getArrForVarName(getVarName());

        
        if(getScalarValue() != null && ArrayUtil.prod(getShape()) == 1) {
            INDArray arr = Nd4j.valueArrayOf(getShape(),
                    getScalarValue().doubleValue());
            sameDiff.associateArrayWithVariable(arr,this);
        }
        else if(sameDiff.getShapeForVarName(getVarName()) == null)
            return null;

        else {
            INDArray newAlloc = getWeightInitScheme().create(sameDiff.getShapeForVarName(getVarName()));
            sameDiff.associateArrayWithVariable(newAlloc,this);

        }

        return sameDiff.getArrForVarName(getVarName());
    }
public INDArray getArr ( ) { if ( sameDiff . arrayAlreadyExistsForVarName ( getVarName ( ) ) ) return sameDiff . getArrForVarName ( getVarName ( ) ) ; //initialize value if it's actually a scalar constant (zero or 1 typically...) if ( getScalarValue ( ) != null && ArrayUtil . prod ( getShape ( ) ) == 1 ) { INDArray arr = Nd4j . valueArrayOf ( getShape ( ) , getScalarValue ( ) . doubleValue ( ) ) ; sameDiff . associateArrayWithVariable ( arr , this ) ; } else if ( sameDiff . getShapeForVarName ( getVarName ( ) ) == null ) return null ; else { INDArray newAlloc = getWeightInitScheme ( ) . create ( sameDiff . getShapeForVarName ( getVarName ( ) ) ) ; sameDiff . associateArrayWithVariable ( newAlloc , this ) ; } return sameDiff . getArrForVarName ( getVarName ( ) ) ; }
A getter for the allocated ndarray
with this {@link SDVariable}.

This getter will lazy initialize an array if one is not found
based on the associated shape and {@link WeightInitScheme}
if neither are found, an {@link ND4JIllegalStateException}
is thrown.

If a {@link DifferentialFunction} is defined, note that
its getArr() method is called instead.
@return the {@link INDArray} associated with this variable.
A getter for the allocated ndarray with this { @link SDVariable } .