Skip to content
Snippets Groups Projects
Commit c1c05d0e authored by Franck Dary's avatar Franck Dary
Browse files

Fixed predicted action choice in decode

parent bbe7862d
Branches
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment