在创建列表的ANN时,FANNJ崩溃了

时间:2017-08-29 13:55:32

标签: neural-network fann fannj

FANNJ的构造函数接受了提供图层列表的方法,但是当我尝试构建一个包含2层的简单ANN时,编译器崩溃

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);

程序停在&#34; fann = new Fann(列表)&#34;命令。这听起来与&#34; fann_create_sparse_array&#34;有关。这被指向&#34;有问题的框架&#34;:

# 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

我已经检查了ulimit,但它只是关于转储错误的配置,听起来没有解决任何问题,只是允许更多地了解崩溃。有谁知道如何解决它?

1 个答案:

答案 0 :(得分:2)

报告解决方案:必须通过静态方式访问方法create,因此解决方法应该是这样的:

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);