Skip to content

Commit 616aa98

Browse files
committed
try directly using the buffer
1 parent f7e2908 commit 616aa98

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/io/bioimage/modelrunner/pytorch/shm/TensorBuilder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ private static NDArray buildFloat(SharedMemoryArray tensor, NDManager manager)
142142
throw new IllegalArgumentException("Shared memory arrays must be saved in numpy format.");
143143
ByteBuffer buff = tensor.getDataBufferNoHeader();
144144
FloatBuffer floatBuff = buff.asFloatBuffer();
145-
float[] floatArray = new float[floatBuff.capacity()];
146-
floatBuff.get(floatArray);
147-
NDArray ndarray = manager.create(floatBuff.array(), new Shape(ogShape));
145+
//float[] floatArray = new float[floatBuff.capacity()];
146+
//floatBuff.get(floatArray);
147+
NDArray ndarray = manager.create(floatBuff, new Shape(ogShape));
148148
return ndarray;
149149
}
150150

0 commit comments

Comments
 (0)