Files
pytorch/torch/csrc/jit/runtime/print_handler.cpp
Nikita Shulga ad8aef0f98 [BE] [3/N] Use nested namespaces (#110314)
Mostly in torch/csrc/jit/runtime and in `ATen/cuda/`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/110314
Approved by: https://github.com/seemethere
2023-09-30 02:23:48 +00:00

28 lines
490 B
C++

#include <torch/csrc/jit/runtime/print_handler.h>
#include <atomic>
#include <iostream>
#include <string>
namespace torch::jit {
namespace {
std::atomic<PrintHandler> print_handler(getDefaultPrintHandler());
} // namespace
PrintHandler getDefaultPrintHandler() {
return [](const std::string& s) { std::cout << s; };
}
PrintHandler getPrintHandler() {
return print_handler.load();
}
void setPrintHandler(PrintHandler ph) {
print_handler.store(ph);
}
} // namespace torch::jit