File tree 1 file changed +2
-1
lines changed
src/main/java/io/bioimage/modelrunner/pytorch/javacpp/shm
1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change 25
25
import io .bioimage .modelrunner .utils .CommonUtils ;
26
26
27
27
import java .nio .ByteBuffer ;
28
+ import java .nio .ByteOrder ;
28
29
import java .util .Arrays ;
29
30
30
31
import org .bytedeco .pytorch .Tensor ;
@@ -134,7 +135,7 @@ private static org.bytedeco.pytorch.Tensor buildFloat(SharedMemoryArray shmArray
134
135
+ " is too big. Max number of elements per ubyte tensor supported: " + Integer .MAX_VALUE );
135
136
if (!shmArray .isNumpyFormat ())
136
137
throw new IllegalArgumentException ("Shared memory arrays must be saved in numpy format." );
137
- ByteBuffer buff = shmArray .getDataBufferNoHeader ();
138
+ ByteBuffer buff = shmArray .getDataBufferNoHeader (). order ( ByteOrder . LITTLE_ENDIAN ) ;
138
139
float [] flat = new float [buff .capacity () / 4 ];
139
140
buff .asFloatBuffer ().get (flat );
140
141
Tensor ndarray = Tensor .create (flat , ogShape );
You can’t perform that action at this time.
0 commit comments