From bbfcee20fd8733c2e9ea5ec49e1963d62e777730 Mon Sep 17 00:00:00 2001 From: liaogang Date: Wed, 22 Feb 2017 17:42:08 +0800 Subject: [PATCH] Add const for Trainer::getLayerOutput --- paddle/api/PaddleAPI.h | 2 +- paddle/api/Trainer.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/paddle/api/PaddleAPI.h b/paddle/api/PaddleAPI.h index 10569a7170..59798796a2 100644 --- a/paddle/api/PaddleAPI.h +++ b/paddle/api/PaddleAPI.h @@ -953,7 +953,7 @@ public: Arguments* getForwardOutput(); - Arguments* getLayerOutput(const std::string& layerName); + Arguments* getLayerOutput(const std::string& layerName) const; }; /// the N-Best results generated from one input sequence. diff --git a/paddle/api/Trainer.cpp b/paddle/api/Trainer.cpp index c742614aff..29cf2aa450 100644 --- a/paddle/api/Trainer.cpp +++ b/paddle/api/Trainer.cpp @@ -131,7 +131,7 @@ void Trainer::testOneDataBatch(size_t batchSize, const Arguments& args) { void TrainerPrivate::finishTestPeriod() { tester_->finishTestPeriod(); } void Trainer::finishTestPeriod() { m->finishTestPeriod(); } -Arguments* Trainer::getLayerOutput(const std::string& layerName) { +Arguments* Trainer::getLayerOutput(const std::string& layerName) const { auto nn = this->m->getGradientMachine(); CHECK(nn) << "trainerInternal_.getGradientMachine() is not NeuralNetwork"; return Arguments::createByPaddleArgument(&nn->getLayerOutput(layerName)); -- GitLab