Skip to content

Commit

Permalink
try fixing endianness
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Dec 19, 2024
1 parent 7048395 commit d170837
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.bioimage.modelrunner.utils.CommonUtils;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;

import org.bytedeco.pytorch.Tensor;
Expand Down Expand Up @@ -134,7 +135,7 @@ private static org.bytedeco.pytorch.Tensor buildFloat(SharedMemoryArray shmArray
+ " is too big. Max number of elements per ubyte tensor supported: " + Integer.MAX_VALUE);
if (!shmArray.isNumpyFormat())
throw new IllegalArgumentException("Shared memory arrays must be saved in numpy format.");
ByteBuffer buff = shmArray.getDataBufferNoHeader();
ByteBuffer buff = shmArray.getDataBufferNoHeader().order(ByteOrder.LITTLE_ENDIAN);
float[] flat = new float[buff.capacity() / 4];
buff.asFloatBuffer().get(flat);
Tensor ndarray = Tensor.create(flat, ogShape);
Expand Down

0 comments on commit d170837

Please sign in to comment.