-1

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

程序在“fann = new Fann(list)”命令处停止。这听起来与“fann_create_sparse_array”有关,它被指出为“有问题的框架”:

# 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,但它只是一个转储错误配置,听起来并没有解决任何问题,只是为了让更多地了解崩溃。有谁知道如何解决它?

4

1 回答 1

0

只报解决方法: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);
于 2017-08-29T16:51:15.503 回答