我正在尝试在 rails 项目中使用 FANN(快速人工神经网络)库。因此,我安装了风扇(安装似乎没问题,我按照网上的一些指南进行了安装)。此外,我已将ruby-fann
gem 添加到我的 Gemfile 并已安装。但是,当我运行rspec
以测试我的代码时,我得到一个很长的错误,其开头如下:
/app/models/neural_network.rb:12: [BUG] Segmentation fault at 0x00000000000009
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-darwin14]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
-- Control frame information -----------------------------------------------
c:0044 p:---- s:0175 e:000174 CFUNC :initialize
c:0043 p:---- s:0173 e:000172 CFUNC :new
c:0040 p:---- s:0156 e:000155 CFUNC :instance_exec
c:0039 p:0021 s:0152 e:000151 BLOCK /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example.rb:177
c:0038 p:0006 s:0149 e:000148 BLOCK /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example.rb:385
c:0037 p:0006 s:0147 e:000146 BLOCK /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example.rb:343
c:0036 p:0006 s:0145 e:000144 BLOCK /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/hooks.rb:474
c:0035 p:0006 s:0143 e:000142 BLOCK /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/hooks.rb:614 [FINISH]
c:0034 p:---- s:0141 e:000140 CFUNC :call
c:0033 p:0022 s:0138 e:000137 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example.rb:247
c:0032 p:0014 s:0133 e:000132 BLOCK /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-rails-3.2.1/lib/rspec/rails/adapters.rb:113 [FINISH]
c:0031 p:---- s:0130 e:000129 CFUNC :instance_exec
c:0030 p:0015 s:0126 e:000125 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example.rb:333
c:0029 p:0013 s:0121 e:000120 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/hooks.rb:387
c:0028 p:0013 s:0116 e:000115 BLOCK /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/hooks.rb:616 [FINISH]
c:0027 p:---- s:0114 e:000113 CFUNC :call
c:0026 p:0022 s:0111 e:000110 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example.rb:247
c:0025 p:0060 s:0106 E:0019c8 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/hooks.rb:617
c:0024 p:0115 s:0100 E:0011f8 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/hooks.rb:474
c:0023 p:0014 s:0094 E:0020f8 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example.rb:343
c:0022 p:0026 s:0090 E:001468 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example.rb:385
c:0021 p:0132 s:0086 E:000b68 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example.rb:174
c:0020 p:0054 s:0080 e:000079 BLOCK /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example_group.rb:549 [FINISH]
c:0019 p:---- s:0075 e:000074 CFUNC :map
c:0018 p:0014 s:0072 e:000071 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example_group.rb:545
c:0017 p:0102 s:0068 e:000067 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/example_group.rb:512
c:0016 p:0011 s:0060 e:000059 BLOCK /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:110 [FINISH]
c:0015 p:---- s:0057 e:000056 CFUNC :map
c:0014 p:0009 s:0054 e:000053 BLOCK /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:110
c:0013 p:0046 s:0052 e:000051 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1526
c:0012 p:0009 s:0048 e:000047 BLOCK /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:109
c:0011 p:0017 s:0045 e:000044 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/reporter.rb:62
c:0010 p:0018 s:0041 e:000040 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:108
c:0009 p:0022 s:0037 E:000590 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:86
c:0008 p:0088 s:0032 E:0012c0 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70
c:0007 p:0024 s:0025 E:000e58 METHOD /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38
c:0006 p:0023 s:0021 E:0003a0 TOP /Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/exe/rspec:4 [FINISH]
c:0005 p:---- s:0019 e:000018 CFUNC :load
c:0004 p:0135 s:0015 E:002610 EVAL /Users/octavian/.rvm/gems/ruby-2.2.1/bin/rspec:23 [FINISH]
c:0003 p:---- s:0011 e:000010 CFUNC :eval
c:0002 p:0118 s:0005 E:0024b8 EVAL /Users/octavian/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15 [FINISH]
c:0001 p:0000 s:0002 E:002370 TOP [FINISH]
-- Ruby level backtrace information ----------------------------------------
/Users/octavian/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
/Users/octavian/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
/Users/octavian/.rvm/gems/ruby-2.2.1/bin/rspec:23:in `<main>'
/Users/octavian/.rvm/gems/ruby-2.2.1/bin/rspec:23:in `load'
/Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/exe/rspec:4:in `<top (required)>'
/Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
/Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
/Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:86:in `run'
/Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:108:in `run_specs'
/Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/reporter.rb:62:in `report'
/Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:109:in `block in run_specs'
/Users/octavian/.rvm/gems/ruby-2.2.1/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1526:in `with_suite_hooks'
以及以下结局:
1849 /Users/octavian/.rvm/gems/ruby-2.2.1/gems/activerecord-4.2.1/lib/active_record/relation/predicate_builder.rb
1850 /Users/octavian/.rvm/gems/ruby-2.2.1/gems/statsample-1.4.3/lib/statsample/test.rb
1851 /Users/octavian/.rvm/gems/ruby-2.2.1/gems/statsample-1.4.3/lib/statsample/bivariate/pearson.rb
1852 /Users/octavian/.rvm/gems/ruby-2.2.1/gems/statsample-1.4.3/lib/statsample/bivariate.rb
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
Don't forget to include the above Crash Report log file.
For details: http://www.ruby-lang.org/bugreport.html
Abort trap: 6
网上的代码/app/models/neural_network.rb:12
是
train = RubyFann::TrainData.new(inputs: inputs, desired_outputs: desired_outputs)