scientific-computing/FKB

corrupted size vs. prev_size

lkampoli opened this issue · 2 comments

Hello,
I'm trying to load a simple network and do a prediction but I get the following message:

corrupted size vs. prev_size

More specifically, I use the following network mytest.txt
to be renamed mytest.py and run with python3 mytest.py with the data dataset_STS_kd_kr_N2.txt Then, I adapted a test test_simpleNN.txt to be renamed test_simpleNN.F90 and compiled.

Do you have some hints about its origin?
Thank you,
Lorenzo

My initial finding is that this error results from your input dimension being equal to 1.
I'm trying to fix it but haven't quite cracked it yet. A short term fix is to pad your input with an additional input which you could always set to zero.

Hello, I see, thanks a lot for help!
As a little follow up, I would like to ask you an expert opinion.

I'm, let's say, investing some time to interface my scikit or tensorflow/keras networks with fortran or c/c++ main code solvers. The main hope is to be able to use the trained network to predict something which could be directly injected in the fortran or C/C++ solvers. Nevertheless, after a long literature review and hands-on experience I have the feeling that nobody does this because it will be hardly competitive with pure python/tensorflow applications.
This is particularly true when the prediction is done inside some intensive loop (many times), for example, since the communication cost becomes considerable even if the prediction time is much less than the computation without ML/NN.
And I see that even by using other approaches like CFFI, Cython, SWIG, Babel, f2py and so on, will not satisfactorily fix the issue.

Clearly, the situation may be different if the prediction is done just once outside of the computationally intensive parts.

What do you think about it? Am I right?

Thank you,
Lorenzo