mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-22 06:11:27 +08:00
Turn more functions and variables into static if they are not used outside the cpp files. Unused functions are removed. Pull Request resolved: https://github.com/pytorch/pytorch/pull/150930 Approved by: https://github.com/Skylion007 Co-authored-by: Aaron Gokaslan <aaronGokaslan@gmail.com>
30 lines
930 B
C++
30 lines
930 B
C++
#include <torch/csrc/autograd/engine.h>
|
|
#include <torch/csrc/dynamo/compiled_autograd.h>
|
|
|
|
namespace torch::dynamo::autograd {
|
|
|
|
static std::unique_ptr<PyCompilerInterface> kActivePyCompilerInterface;
|
|
|
|
const std::unique_ptr<PyCompilerInterface>& getPyCompilerInterface() {
|
|
TORCH_INTERNAL_ASSERT(kActivePyCompilerInterface != nullptr);
|
|
return kActivePyCompilerInterface;
|
|
}
|
|
|
|
PyCompilerGuard::PyCompilerGuard(std::unique_ptr<PyCompilerInterface>&& impl) {
|
|
TORCH_INTERNAL_ASSERT(
|
|
kActivePyCompilerInterface == nullptr && impl != nullptr);
|
|
kActivePyCompilerInterface = std::move(impl);
|
|
}
|
|
|
|
PyCompilerGuard::~PyCompilerGuard() {
|
|
TORCH_INTERNAL_ASSERT(kActivePyCompilerInterface != nullptr);
|
|
kActivePyCompilerInterface.reset();
|
|
}
|
|
|
|
std::vector<std::optional<InputMetadata>> get_input_metadata(
|
|
const edge_list& edges) {
|
|
return torch::autograd::collect_input_metadata(edges);
|
|
}
|
|
|
|
} // namespace torch::dynamo::autograd
|