The constructor of FANNJ accepts the way to give a list of layers, but when I try to build a simple ANN with 2 layers the compiler crashes
Layer lhidden1 = new Layer();
lhidden1.create(num_neurons_hidden, ActivationFunction.FANN_SIGMOID_SYMMETRIC_STEPWISE);
Layer loutput = new Layer();
loutput.create(num_neurons_output, ActivationFunction.FANN_SIGMOID_STEPWISE);
List<Layer> list = new ArrayList<Layer>();
list.add(lhidden1);
list.add(loutput);
fann = new Fann(list);
The program stops at "fann = new Fann(list)" command. It sounds to be related to "fann_create_sparse_array" which is pointed as a "Problematic frame":
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGFPE (0x8) at pc=0x00007f2f7b3434c6, pid=6926, tid=0x00007f2f992ed700
#
# JRE version: OpenJDK Runtime Environment (8.0_131-b11) (build 1.8.0_131-8u131-b11-1~bpo8+1-b11)
# Java VM: OpenJDK 64-Bit Server VM (25.131-b11 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libfann.so+0x54c6] fann_create_sparse_array+0x2ca
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
I've checked about ulimit, but it is only about a dump error configuration, it sounds to do not solve any problem, only is about to allow to know more about the crash. Does anyone knows how to solve it?
Just reporting the solution: The method create must be accessed by static way, so the way to solve it should be like this:
List<Layer> list = new ArrayList<Layer>();
list.add(Layer.create(num_neurons_hidden, ActivationFunction.FANN_SIGMOID_SYMMETRIC_STEPWISE));
list.add(Layer.create(num_neurons_output, ActivationFunction.FANN_SIGMOID_STEPWISE));
Fann fann = new Fann(list);