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
No related branches found
No related tags found
No related merge requests found
...@@ -34,13 +34,19 @@ void Decoder::decode(BaseConfig & config, std::size_t beamSize, bool debug) ...@@ -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++) for (unsigned int i = 0; i < prediction.size(0); i++)
{ {
float score = prediction[i].item<float>(); 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; chosenTransition = i;
bestScore = score;
}
} }
} catch(std::exception & e) {util::myThrow(e.what());} } catch(std::exception & e) {util::myThrow(e.what());}
if (chosenTransition == -1) if (chosenTransition == -1)
{
config.printForDebug(stderr);
util::myThrow("No transition appliable !"); util::myThrow("No transition appliable !");
}
auto * transition = machine.getTransitionSet().getTransition(chosenTransition); 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