Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/OpenNMT/OpenNMT.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/onmt
diff options
context:
space:
mode:
authorGuillaume Klein <guillaume.klein@systrangroup.com>2017-10-20 12:33:38 +0300
committerGuillaume Klein <guillaume.klein@systrangroup.com>2017-10-20 12:33:38 +0300
commit60b81f812451451c25c40651c4e3feb8c95953d7 (patch)
tree206942a5dfab8fa9777cedc5ce04c8830ae36460 /onmt
parentf445f4251aef9623ec476d93663f07f64fa0cb80 (diff)
Fix error on empty input vector during translation
Diffstat (limited to 'onmt')
-rw-r--r--onmt/translate/Translator.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/onmt/translate/Translator.lua b/onmt/translate/Translator.lua
index 9b67cd9c..e064624e 100644
--- a/onmt/translate/Translator.lua
+++ b/onmt/translate/Translator.lua
@@ -231,7 +231,8 @@ function Translator:buildData(src, gold)
local index = 1
for b = 1, #src do
- if src[b].words and #src[b].words == 0 then
+ if (src[b].words and #src[b].words == 0
+ or src[b].vectors and src[b].vectors:dim() == 0) then
table.insert(ignored, b)
else
indexMap[index] = b