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

Set neural network to eval mode in decode

parent 5715dda9
Branches
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ Decoder::Decoder(ReadingMachine & machine) : machine(machine) ...@@ -7,6 +7,7 @@ Decoder::Decoder(ReadingMachine & machine) : machine(machine)
void Decoder::decode(BaseConfig & config, std::size_t beamSize, bool debug) void Decoder::decode(BaseConfig & config, std::size_t beamSize, bool debug)
{ {
machine.getClassifier()->getNN()->train(false);
config.addPredicted(machine.getPredicted()); config.addPredicted(machine.getPredicted());
try try
...@@ -63,6 +64,8 @@ void Decoder::decode(BaseConfig & config, std::size_t beamSize, bool debug) ...@@ -63,6 +64,8 @@ void Decoder::decode(BaseConfig & config, std::size_t beamSize, bool debug)
if (debug) if (debug)
fmt::print(stderr, "Forcing EOS transition\n"); fmt::print(stderr, "Forcing EOS transition\n");
} }
machine.getClassifier()->getNN()->train(true);
} }
float Decoder::getMetricScore(const std::string & metric, std::size_t scoreIndex) const float Decoder::getMetricScore(const std::string & metric, std::size_t scoreIndex) const
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment