mirror of https://github.com/alibaba/MNN.git
[PATCH 24/24] [Train:Bugfix] Use input instead of replace for parameter update
This commit is contained in:
parent
32aea32cd1
commit
bae24a62d1
|
@ -336,7 +336,7 @@ const std::string& Variable::name() const {
|
|||
return mFrom->outputName(mFromIndex);
|
||||
}
|
||||
bool Variable::input(VARP src) {
|
||||
if (nullptr != mFrom->get() && VARP::INPUT != mFrom->mType) {
|
||||
if (nullptr != mFrom->get() || VARP::CONST == mFrom->mType) {
|
||||
MNN_ERROR("Can't input to no-input op\n");
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ bool ParameterOptimizer::step(Express::VARP loss) {
|
|||
iter.second.fix(Express::VARP::TRAINABLE);
|
||||
}
|
||||
for (auto iter : res) {
|
||||
Express::Variable::replace(iter.first, iter.second);
|
||||
iter.first->input(iter.second);
|
||||
}
|
||||
return !res.empty();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue