diff --git a/common/src/util.cpp b/common/src/util.cpp index 1e2501805b6f11b8fc404d37d8da2c748c125b5b..379056f99f611d77bb77b311d749b85691f413b1 100644 --- a/common/src/util.cpp +++ b/common/src/util.cpp @@ -153,7 +153,6 @@ bool util::doIfNameMatch(const std::regex & reg, std::string_view name, const st return true; } -//TODO : test this std::string util::strip(const std::string & s) { std::string striped; diff --git a/decoder/src/Decoder.cpp b/decoder/src/Decoder.cpp index 3191cbf054860846afd27ed39e8ee503fbfe0586..eea1ef73ac01fce82332d19e1e715ffe77878df2 100644 --- a/decoder/src/Decoder.cpp +++ b/decoder/src/Decoder.cpp @@ -17,10 +17,7 @@ void Decoder::decode(BaseConfig & config, std::size_t beamSize) auto context = config.extractContext(5,5,machine.getDict(config.getState())); machine.getDict(config.getState()).setState(dictState); - //TODO : check if clone is mandatory - auto neuralInput = torch::from_blob(context.data(), {(long)context.size()}, at::kLong).clone(); - //TODO : check if NoGradGuard does anything - torch::NoGradGuard guard; + auto neuralInput = torch::from_blob(context.data(), {(long)context.size()}, at::kLong); auto prediction = machine.getClassifier()->getNN()(neuralInput); int chosenTransition = -1; diff --git a/trainer/src/Trainer.cpp b/trainer/src/Trainer.cpp index 059da2baacf46fb17d61facbcf15286655e48031..51d1a3bb878c885cc18b823e0f8049a48da5bcf2 100644 --- a/trainer/src/Trainer.cpp +++ b/trainer/src/Trainer.cpp @@ -21,9 +21,8 @@ void Trainer::createDataset(SubConfig & config) util::myThrow("No transition appliable !"); } - //TODO : check if clone is mandatory auto context = config.extractContext(5,5,machine.getDict(config.getState())); - contexts.push_back(torch::from_blob(context.data(), {(long)context.size()}, at::kLong).clone()); + contexts.emplace_back(torch::from_blob(context.data(), {(long)context.size()}, at::kLong).clone()); int goldIndex = machine.getTransitionSet().getTransitionIndex(transition); auto gold = torch::zeros(1, at::kLong);