From c1c05d0e1c1d54423cbee660decd57324219ef82 Mon Sep 17 00:00:00 2001 From: Franck Dary <franck.dary@lis-lab.fr> Date: Tue, 25 Feb 2020 18:25:47 +0100 Subject: [PATCH] Fixed predicted action choice in decode --- decoder/src/Decoder.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/decoder/src/Decoder.cpp b/decoder/src/Decoder.cpp index 291da6b..e7b2285 100644 --- a/decoder/src/Decoder.cpp +++ b/decoder/src/Decoder.cpp @@ -34,13 +34,19 @@ void Decoder::decode(BaseConfig & config, std::size_t beamSize, bool debug) for (unsigned int i = 0; i < prediction.size(0); i++) { float score = prediction[i].item<float>(); - if (score > bestScore and machine.getTransitionSet().getTransition(i)->appliable(config)) + if ((chosenTransition == -1 or score > bestScore) and machine.getTransitionSet().getTransition(i)->appliable(config)) + { chosenTransition = i; + bestScore = score; + } } } catch(std::exception & e) {util::myThrow(e.what());} if (chosenTransition == -1) + { + config.printForDebug(stderr); util::myThrow("No transition appliable !"); + } auto * transition = machine.getTransitionSet().getTransition(chosenTransition); -- GitLab