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 .