Skip to content

Commit 06d6e9a

Browse files
committed
keep correcting
1 parent d15cc3e commit 06d6e9a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/io/bioimage/modelrunner/tensorflow/v1/shm/ShmBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,14 @@ private static void buildFromTensorFloat(Tensor<Float> tensor, String memoryName
124124
SharedMemoryArray shma = SharedMemoryArray.readOrCreate(memoryName, arrayShape, new FloatType(), false, true);
125125
ByteBuffer buff = shma.getDataBufferNoHeader();
126126
tensor.writeTo(buff);
127-
ByteBuffer buffer = ByteBuffer.allocate(buff.capacity());
128-
tensor.writeTo(buffer);
129127
try (FileOutputStream fos = new FileOutputStream("/home/carlos/git/interp_out" + UUID.randomUUID().toString() + ".npy");
130128
FileChannel fileChannel = fos.getChannel()) {
129+
ByteBuffer buffer = shma.getDataBuffer();
131130
// Write the buffer's content to the file
132131
while (buffer.hasRemaining()) {
133132
fileChannel.write(buffer);
134133
}
134+
buffer.rewind();
135135
} catch (IOException e) {
136136
// TODO Auto-generated catch block
137137
e.printStackTrace();

0 commit comments

Comments
 (0)