public static DataBuffer createShapeInformation ( int [ ] shape , int [ ] stride , long offset , int elementWiseStride , char order ) { if ( shape . length != stride . length ) throw new IllegalStateException ( "Shape and stride must be the same length" ) ; int rank = shape . length ; int shapeBuffer [ ] = new int [ rank * 2 + 4 ] ; shapeBuffer [ 0 ] = rank ; int count = 1 ; for ( int e = 0 ; e < shape . length ; e ++ ) shapeBuffer [ count ++ ] = shape [ ] ; for ( int e = 0 ; e < stride . length ; e ++ ) shapeBuffer [ count ++ ] = stride [ ] ; shapeBuffer [ count ++ ] = ( int ) offset ; shapeBuffer [ count ++ ] = elementWiseStride ; shapeBuffer [ count ] = ( int ) order ; DataBuffer ret = Nd4j . createBufferDetached ( shapeBuffer ) ; ret . setConstant ( true ) ; return ret ; }
Creates the shape information buffer given the shape stride