I have some libtorch code which runs a forward and gets me the result like so:
torch::Tensor output = module.forward(inputs_f).toTensor();
the problem I am facing is that I am not able to write this to an output in a clean way. The best I could do is this:
std::fstream res("result.out", std::ios::out | std::ios::binary);
res << output;
res.close();
and while this works. it writes me a bit of nonsense like so:
Columns 1 to 10-0.0474 -0.0582 0.0047 -0.0048 -0.0018 -0.0153 0.0084 -0.0178 -0.0336 -0.0082
Columns 11 to 20 0.0119 -0.0617 -0.0218 0.0003 0.0205 -0.0086 0.0285 -0.0193 0.0052 -0.0009
Columns 21 to 30 0.0014 -0.0140 -0.0333 0.0931 0.0562 0.0246 0.0674 -0.0256 0.0018 0.0125
Columns 31 to 40 0.0015 -0.0564 -0.0016 0.0185 -0.0028 -0.0436 -0.0289 -0.0729 -0.0255 0.0550
Columns 41 to 50 0.1132 0.0346 -0.0030 -0.0842 0.0433 0.1089 0.0023 -0.0148 -0.0411 0.0094
It looks like this is a string represnetation of some sort - I REALLY dont want these Columns 11 to 20
etc… I just want the tensor in a file line after line
How does one go about doing this?