From 781f3162dda790d0d4d00431204ef49b326cd699 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 28 Mar 2019 15:49:19 +0000 Subject: [PATCH] [Fix] Neural: Fix training Issue: #2793 --- src/plugins/lua/neural.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/lua/neural.lua b/src/plugins/lua/neural.lua index 4e268962c..b75adf468 100644 --- a/src/plugins/lua/neural.lua +++ b/src/plugins/lua/neural.lua @@ -620,7 +620,10 @@ local function train_ann(rule, _, ev_base, elt, worker) local n = rspamd_config:get_symbols_count() + meta_functions.rspamd_count_metatokens() local filt = function(elts) - return #elts == n + -- Basic sanity checks: vector has good length + there are no + -- 'bad' values such as NaNs or infinities in its elements + return #elts == n and + not fun.any(function(e) return e ~= e or e == math.huge or e == -math.huge end, elts) end -- Now we can train ann -- 2.39.5