Skip to content

Commit

Permalink
just copy it
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Nov 23, 2024
1 parent b006f0b commit 58bd149
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,15 @@ private static void buildFromTensorFloat(Tensor tensor, String memoryName) throw
throw new IllegalArgumentException("Model output tensor with shape " + Arrays.toString(arrayShape)
+ " is too big. Max number of elements per float output tensor supported: " + Integer.MAX_VALUE / 4);
SharedMemoryArray shma = SharedMemoryArray.readOrCreate(memoryName, arrayShape, new FloatType(), false, true);
/*long flatSize = 1;
long flatSize = 1;
for (long l : arrayShape) {flatSize *= l;}
ByteBuffer byteBuffer = ByteBuffer.allocate((int) (flatSize * Float.BYTES));
tensor.data_ptr_float().get(byteBuffer.asFloatBuffer().array());
float[] flat = new float[(int) flatSize];
ByteBuffer byteBuffer = ByteBuffer.allocateDirect((int) (flatSize * Float.BYTES));
FloatBuffer floatBuffer = byteBuffer.asFloatBuffer();
tensor.data_ptr_float().get(flat);
floatBuffer.put(flatSize);
byteBuffer.rewind();
shma.getDataBufferNoHeader().put(byteBuffer);
*/
RandomAccessibleInterval<?> rai = shma.getSharedRAI();
rai = ImgLib2Builder.build(tensor);
if (PlatformDetection.isWindows()) shma.close();
}

Expand Down

0 comments on commit 58bd149

Please sign in to comment.