mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE]: Add a few more missing move from return indices (#163456)
@ezyang A follow up where I found a few more missing returns of this style in the codebase. Follow up to #163416 Pull Request resolved: https://github.com/pytorch/pytorch/pull/163456 Approved by: https://github.com/cyyever, https://github.com/albanD
This commit is contained in:
committed by
PyTorch MergeBot
parent
fd785b1762
commit
e065d35fd3
@ -65,7 +65,7 @@ class DistAccumulateGradCaptureHook
|
||||
for (const auto& hook : accumulateGrad_->post_hooks()) {
|
||||
(*hook)(kEmptyOutput, inputGrads);
|
||||
}
|
||||
return inputGrads[0];
|
||||
return std::move(inputGrads[0]);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -109,7 +109,7 @@ at::Tensor parseCppCommHookResult(const c10::IValue& result) {
|
||||
if (result.isPyObject()) {
|
||||
std::vector<at::Tensor> tensors =
|
||||
result.toPyObjectHolder()->extractTensors();
|
||||
return tensors[0];
|
||||
return std::move(tensors[0]);
|
||||
}
|
||||
TORCH_INTERNAL_ASSERT(
|
||||
result.isTensor() || result.isTensorList(),
|
||||
|
@ -885,7 +885,7 @@ ExprPtr PolynomialTransformer::insertIntoTerm(
|
||||
bool merged{false};
|
||||
for (const auto& component : term->variables()) {
|
||||
if (auto roundoff = isRoundOff(component, expr)) {
|
||||
vars.push_back(roundoff);
|
||||
vars.push_back(std::move(roundoff));
|
||||
merged = true;
|
||||
} else {
|
||||
vars.push_back(component);
|
||||
@ -897,10 +897,10 @@ ExprPtr PolynomialTransformer::insertIntoTerm(
|
||||
}
|
||||
|
||||
if (vars.size() == 1 && immediateEquals(term->scalar(), 1)) {
|
||||
return vars[0];
|
||||
return std::move(vars[0]);
|
||||
}
|
||||
|
||||
return alloc<Term>(hasher_, term->scalar(), vars);
|
||||
return alloc<Term>(hasher_, term->scalar(), std::move(vars));
|
||||
}
|
||||
|
||||
ExprPtr PolynomialTransformer::mutate(const MulPtr& v) {
|
||||
|
Reference in New Issue
Block a user