diff --git a/decoder/src/Decoder.cpp b/decoder/src/Decoder.cpp index 291da6b5de7de8c8b0ff2b0b17a0007ee491a289..e7b2285363208b1607f5143aa9ba7d092e4e20c7 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);