@ Override public INDArray createFromNpyFile ( File file ) { /*Pointer pointer = nativeOps.numpyFromFile(new BytePointer(file.getAbsolutePath().getBytes())); log.info("Pointer here: {}", pointer.address()); return createFromNpyPointer(pointer); */ byte [ ] pathBytes = file . getAbsolutePath ( ) . getBytes ( Charset . forName ( "UTF-8" ) ) ; String otherBytes = new String ( pathBytes ) ; System . out . println ( otherBytes ) ; ByteBuffer directBuffer = ByteBuffer . allocateDirect ( pathBytes . length ) . order ( ByteOrder . nativeOrder ( ) ) ; directBuffer . put ( pathBytes ) ; directBuffer . rewind ( ) ; directBuffer . position ( 0 ) ; Pointer pointer = nativeOps . numpyFromFile ( new BytePointer ( directBuffer ) ) ; INDArray result = createFromNpyPointer ( pointer ) ; // releasing original pointer here nativeOps . releaseNumpy ( pointer ) ; return result ; }
Create from a given numpy file .