nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java
public INDArray storeAndAllocateNewArray() {
        val shape = sameDiff.getShapeForVarName(getVarName());
        if(getArr() != null && Arrays.equals(getArr().shape(),shape))
            return getArr();

        if(varName == null)
            throw new ND4JIllegalStateException("Unable to store array for null variable name!");

        if(shape == null) {
            throw new ND4JIllegalStateException("Unable to allocate new array. No shape found for variable " + varName);
        }

        val arr = getWeightInitScheme().create(shape);
        sameDiff.putArrayForVarName(getVarName(),arr);
        return arr;
    }
public INDArray storeAndAllocateNewArray() {
        val shape = sameDiff.getShapeForVarName(getVarName());
        if(getArr() != null && Arrays.equals(getArr().shape(),shape))
            return getArr();

        if(varName == null)
            throw new ND4JIllegalStateException("Unable to store array for null variable name!");

        if(shape == null) {
            throw new ND4JIllegalStateException("Unable to allocate new array. No shape found for variable " + varName);
        }

        val arr = getWeightInitScheme().create(shape);
        sameDiff.putArrayForVarName(getVarName(),arr);
        return arr;
    }
public INDArray storeAndAllocateNewArray ( ) { val shape = sameDiff . getShapeForVarName ( getVarName ( ) ) ; if ( getArr ( ) != null && Arrays . equals ( getArr ( ) . shape ( ) , shape ) ) return getArr ( ) ; if ( varName == null ) throw new ND4JIllegalStateException ( "Unable to store array for null variable name!" ) ; if ( shape == null ) { throw new ND4JIllegalStateException ( "Unable to allocate new array. No shape found for variable " + varName ) ; } val arr = getWeightInitScheme ( ) . create ( shape ) ; sameDiff . putArrayForVarName ( getVarName ( ) , arr ) ; return arr ; }
Allocate and return a  new array
based on the vertex id and weight initialization.
@return the allocated array
Allocate and return a new array based on the vertex id and weight initialization .