Skip to content

Commit

Permalink
fix std::move warnings from gcc (pytorch#105780)
Browse files Browse the repository at this point in the history
Pull Request resolved: pytorch#105780
Approved by: https://github.com/Skylion007
  • Loading branch information
cyyever authored and pytorchmergebot committed Sep 22, 2023
1 parent 4ff2945 commit cd99cdc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ class SequentialImpl : public Cloneable<SequentialImpl> {
explicit SequentialImpl(std::initializer_list<NamedAnyModule> named_modules) {
modules_.reserve(named_modules.size());
for (const auto& named_module : named_modules) {
push_back(
std::move(named_module.name()), std::move(named_module.module()));
push_back(named_module.name(), named_module.module());
}
}

Expand Down Expand Up @@ -385,8 +384,7 @@ class Sequential : public torch::nn::ModuleHolder<SequentialImpl> {
/// It enables the following use case:
/// `Sequential sequential({{"m1", M(1)}, {"m2", M(2)}})`
Sequential(std::initializer_list<NamedAnyModule> named_modules)
: ModuleHolder(
std::make_shared<SequentialImpl>(std::move(named_modules))) {}
: ModuleHolder(std::make_shared<SequentialImpl>(named_modules)) {}
};
} // namespace nn
} // namespace torch
2 changes: 1 addition & 1 deletion torch/csrc/jit/mobile/parse_bytecode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ IValue expect_field(
expected_name,
" found ",
row->elements().at(0).toStringRef());
return std::move(row->elements().at(1));
return std::move(row)->elements().at(1);
}

namespace mobile {
Expand Down

0 comments on commit cd99cdc

Please sign in to comment.