File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -243,13 +243,8 @@ const std::unordered_map<std::string, Attribute> &OpDesc::GetAttrMap() const {
243
243
}
244
244
245
245
void OpDesc::Rename (const std::string &old_name, const std::string &new_name) {
246
- for (auto &input : inputs_) {
247
- std::replace (input.second .begin (), input.second .end (), old_name, new_name);
248
- }
249
- for (auto &output : outputs_) {
250
- std::replace (output.second .begin (), output.second .end (), old_name,
251
- new_name);
252
- }
246
+ RenameInput (old_name, new_name);
247
+ RenameOutput (old_name, new_name);
253
248
need_update_ = true ;
254
249
}
255
250
@@ -274,6 +269,13 @@ void OpDesc::RenameInput(const std::string &old_name,
274
269
for (auto &input : inputs_) {
275
270
std::replace (input.second .begin (), input.second .end (), old_name, new_name);
276
271
}
272
+
273
+ auto it = attrs_.find (framework::OpProtoAndCheckerMaker::OpRoleVarAttrName ());
274
+ if (it != attrs_.end ()) {
275
+ auto &op_vars = boost::get<std::vector<std::string>>(it->second );
276
+ std::replace (op_vars.begin (), op_vars.end (), old_name, new_name);
277
+ }
278
+
277
279
need_update_ = true ;
278
280
}
279
281
You can’t perform that action at this time.
0 commit comments