commit 2570713: [Minor] Eliminate fann traces

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Jun 22 12:14:55 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-06-21 15:02:40 +0100
URL: https://github.com/rspamd/rspamd/commit/25707133ae54daec513c3f8e3a6090f74d6e3f67

[Minor] Eliminate fann traces

---
 src/plugins/lua/neural.lua | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/plugins/lua/neural.lua b/src/plugins/lua/neural.lua
index 30c4fee0f..dd1b94b3a 100644
--- a/src/plugins/lua/neural.lua
+++ b/src/plugins/lua/neural.lua
@@ -20,7 +20,6 @@ if confighelp then
 end
 
 local rspamd_logger = require "rspamd_logger"
-local rspamd_fann = require "rspamd_fann"
 local rspamd_util = require "rspamd_util"
 local lua_redis = require "lua_redis"
 local lua_util = require "lua_util"
@@ -320,14 +319,7 @@ local function create_ann(n, nlayers)
 
     return ann
   else
-    local layers = {}
-    local div = 1.0
-    for _ = 1, nlayers - 1 do
-      table.insert(layers, math.floor(n / div))
-      div = div * 2
-    end
-    table.insert(layers, 1)
-    return rspamd_fann.create(nlayers, layers)
+    assert(false)
   end
 end
 
@@ -378,7 +370,7 @@ local function load_or_invalidate_ann(rule, data, id, ev_base)
     if use_torch then
       ann = torch.MemoryFile(torch.CharStorage():string(tostring(ann_data))):readObject()
     else
-      ann = rspamd_fann.load_data(ann_data)
+      assert(false)
     end
   end
 
@@ -940,7 +932,7 @@ if not (opts and type(opts) == 'table') or not redis_params then
   return
 end
 
-if not rspamd_fann.is_enabled() and not use_torch then
+if not use_torch then
   rspamd_logger.errx(rspamd_config, 'neural networks support is not compiled in rspamd, this ' ..
     'module is eventually disabled')
   lua_util.disable_module(N, "fail")


More information about the Commits mailing list