From 2a120884ea9f31de2b31d69fd2b3b7b2fd036aa0 Mon Sep 17 00:00:00 2001 From: carlosuc3m <100329787@alumnos.uc3m.es> Date: Sun, 24 Nov 2024 23:50:58 +0100 Subject: [PATCH] tiro en los wevos --- .../bioimage/modelrunner/pytorch/javacpp/shm/ShmBuilder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/bioimage/modelrunner/pytorch/javacpp/shm/ShmBuilder.java b/src/main/java/io/bioimage/modelrunner/pytorch/javacpp/shm/ShmBuilder.java index 8df7fdb..13c76d6 100644 --- a/src/main/java/io/bioimage/modelrunner/pytorch/javacpp/shm/ShmBuilder.java +++ b/src/main/java/io/bioimage/modelrunner/pytorch/javacpp/shm/ShmBuilder.java @@ -26,6 +26,7 @@ import java.io.IOException; import java.nio.ByteBuffer; +import java.nio.ByteOrder; import java.nio.DoubleBuffer; import java.nio.FloatBuffer; import java.nio.IntBuffer; @@ -134,7 +135,7 @@ private static void buildFromTensorFloat(Tensor tensor, String memoryName) throw long flatSize = 1; for (long l : arrayShape) {flatSize *= l;} float[] flat = new float[(int) flatSize]; - ByteBuffer byteBuffer = ByteBuffer.allocateDirect((int) (flatSize * Float.BYTES)); + ByteBuffer byteBuffer = ByteBuffer.allocateDirect((int) (flatSize * Float.BYTES)).order(ByteOrder.LITTLE_ENDIAN); FloatBuffer floatBuffer = byteBuffer.asFloatBuffer(); tensor.data_ptr_float().get(flat); floatBuffer.put(flat);