Skip to content

Commit

Permalink
keep truing to understand output
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Jan 2, 2025
1 parent b6d3826 commit d15cc3e
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,14 @@ private static void buildFromTensorFloat(Tensor<Float> tensor, String memoryName
SharedMemoryArray shma = SharedMemoryArray.readOrCreate(memoryName, arrayShape, new FloatType(), false, true);
ByteBuffer buff = shma.getDataBufferNoHeader();
tensor.writeTo(buff);

ByteBuffer buffer = ByteBuffer.allocate(buff.capacity());
tensor.writeTo(buffer);
try (FileOutputStream fos = new FileOutputStream("/home/carlos/git/interp_out" + UUID.randomUUID().toString() + ".npy");
FileChannel fileChannel = fos.getChannel()) {
fileChannel.write(ByteBuffer.wrap(tensor.bytesValue()));
// Write the buffer's content to the file
while (buffer.hasRemaining()) {
fileChannel.write(buffer);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Expand Down

0 comments on commit d15cc3e

Please sign in to comment.