mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Add missing moves to torch autograd (#92772)
Applies some additional std::move functions to torch/csrc/autograd to opportunities that were found via static analysis. Pull Request resolved: https://github.com/pytorch/pytorch/pull/92772 Approved by: https://github.com/ezyang
This commit is contained in:
committed by
PyTorch MergeBot
parent
2a8669c54c
commit
8c8cd9539d
@ -22,6 +22,7 @@
|
||||
|
||||
#include <memory> // for unique_ptr
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
|
||||
using namespace torch::autograd;
|
||||
|
||||
@ -108,7 +109,7 @@ void PythonEngine::thread_on_exception(
|
||||
if (python_err) {
|
||||
python_err->persist();
|
||||
}
|
||||
Engine::thread_on_exception(graph_task, fn, e);
|
||||
Engine::thread_on_exception(std::move(graph_task), fn, e);
|
||||
}
|
||||
|
||||
std::unique_ptr<AnomalyMetadata> PythonEngine::make_anomaly_metadata() {
|
||||
@ -148,7 +149,7 @@ c10::intrusive_ptr<at::ivalue::Future> PythonEngine::execute_with_graph_task(
|
||||
InputBuffer&& input_buffer) {
|
||||
try {
|
||||
return Engine::execute_with_graph_task(
|
||||
graph_task, graph_root, std::move(input_buffer));
|
||||
graph_task, std::move(graph_root), std::move(input_buffer));
|
||||
} catch (python_error& e) {
|
||||
pybind11::gil_scoped_acquire gil;
|
||||
if (!PyErr_Occurred()) {
|
||||
|
Reference in New Issue
Block a user