C++ Xtensor increase floating point significant numbers

117 Views Asked by At

I am building a neural network and using xtensor for array multiplication in feed forward. The network takes in xt::xarray<double> and outputs a decimal number between 0 and 1. I have been given a sheet for expected output. when i compare my output with the provided sheet, I found that all the results differ after exactly 7 digits. for example if the required value is 0.1234567890123456, I am getting values like 0.1234567-garbage-numbers-so-that-total-numbers-equal-16, 0.1234567993344660, 0.1234567221155667.

I know I can not get that exact number 0.1234567890123456 due to floating point math. But how can I debug/ increase precision to be close to that required number. thanks

Update:

    xt::xarray<double> Layer::call(xt::xarray<double> input)
    {
        return xt::linalg::dot(input, this->weight) + this->bias;
    }

for code I am simply calling this call method a bunch of times where weight and bias are xt::xarray<double> arrays.

0

There are 0 best solutions below