提交 4d5a0b0a 编写于 作者: Y Yu Yang

Also add const to makeEvaluator

上级 22aacbfd
...@@ -181,7 +181,7 @@ public: ...@@ -181,7 +181,7 @@ public:
/** /**
* Create an evaluator which can be used for eval() * Create an evaluator which can be used for eval()
*/ */
virtual Evaluator* makeEvaluator() = 0; virtual Evaluator* makeEvaluator() const = 0;
/** /**
* evaluate using the given evaluator * evaluate using the given evaluator
......
...@@ -327,7 +327,7 @@ void MultiGradientMachine::finish() { ...@@ -327,7 +327,7 @@ void MultiGradientMachine::finish() {
} }
} }
Evaluator* MultiGradientMachine::makeEvaluator() { Evaluator* MultiGradientMachine::makeEvaluator() const {
return threads_[0]->getGradientMachine()->makeEvaluator(); return threads_[0]->getGradientMachine()->makeEvaluator();
} }
......
...@@ -193,7 +193,7 @@ public: ...@@ -193,7 +193,7 @@ public:
virtual void finish(); virtual void finish();
virtual Evaluator* makeEvaluator(); virtual Evaluator* makeEvaluator() const;
virtual void eval(Evaluator* evaluator) const; virtual void eval(Evaluator* evaluator) const;
......
...@@ -172,7 +172,7 @@ protected: ...@@ -172,7 +172,7 @@ protected:
std::vector<std::unique_ptr<Evaluator>> evaluators_; std::vector<std::unique_ptr<Evaluator>> evaluators_;
}; };
Evaluator* MultiNetwork::makeEvaluator() { Evaluator* MultiNetwork::makeEvaluator() const {
MultiCombinedEvaluator* multiCombinedEvaluator = new MultiCombinedEvaluator(); MultiCombinedEvaluator* multiCombinedEvaluator = new MultiCombinedEvaluator();
for (size_t i = 0; i < subNetworks_.size(); i++) { for (size_t i = 0; i < subNetworks_.size(); i++) {
std::unique_ptr<Evaluator> evaluator(subNetworks_[i]->makeEvaluator()); std::unique_ptr<Evaluator> evaluator(subNetworks_[i]->makeEvaluator());
......
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
virtual void onPassEnd(); virtual void onPassEnd();
virtual Evaluator* makeEvaluator(); virtual Evaluator* makeEvaluator() const;
virtual void eval(Evaluator* evaluator) const; virtual void eval(Evaluator* evaluator) const;
......
...@@ -348,7 +348,7 @@ protected: ...@@ -348,7 +348,7 @@ protected:
std::vector<std::unique_ptr<Evaluator>> evaluators_; std::vector<std::unique_ptr<Evaluator>> evaluators_;
}; };
Evaluator* NeuralNetwork::makeEvaluator() { Evaluator* NeuralNetwork::makeEvaluator() const {
CombinedEvaluator* combinedEvaluator = new CombinedEvaluator(); CombinedEvaluator* combinedEvaluator = new CombinedEvaluator();
auto subModelConfig = std::find_if(config_.sub_models().begin(), auto subModelConfig = std::find_if(config_.sub_models().begin(),
config_.sub_models().end(), config_.sub_models().end(),
......
...@@ -96,7 +96,7 @@ public: ...@@ -96,7 +96,7 @@ public:
virtual void onPassEnd(); virtual void onPassEnd();
virtual Evaluator* makeEvaluator(); virtual Evaluator* makeEvaluator() const;
virtual void eval(Evaluator* evaluator) const; virtual void eval(Evaluator* evaluator) const;
virtual void resetState(); virtual void resetState();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册