Skip to content

Commit

Permalink
try this change
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Oct 3, 2024
1 parent 0948cfc commit 3d8a80a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ private static void buildFromTensorFloat(TFloat32 tensor, String memoryName) thr

SharedMemoryArray shma = SharedMemoryArray.readOrCreate(memoryName, arrayShape, new FloatType(), false, true);
ByteBuffer buff = shma.getDataBufferNoHeader();
long tt = System.currentTimeMillis();
ByteDataBuffer tensorData = tensor.asRawTensor().data();
long tt = System.currentTimeMillis();
for (int i = 0; i < buff.capacity(); i ++) {
buff.put(tensorData.getByte(i));
}
Expand All @@ -150,7 +150,7 @@ private static void buildFromTensorFloat(TFloat32 tensor, String memoryName) thr
tt = System.currentTimeMillis();
byte[] flat = new byte[buff.capacity()];
ByteBuffer buff2 = ByteBuffer.wrap(flat);
tensor.asRawTensor().data().read(flat, 0, buff.capacity());
tensorData.read(flat, 0, buff.capacity());
buff = buff2;
System.out.println("TIME 2: " + (System.currentTimeMillis() - tt));
if (PlatformDetection.isWindows()) shma.close();
Expand Down

0 comments on commit 3d8a80a

Please sign in to comment.