pytorch/torch/csrc/jit/runtime/print_handler.cpp
PyTorch MergeBot 28dc1a093f Revert "Remove some unnecessary <iostream> includes from headers (#106914)"
This reverts commit 60936e4c29.

Reverted https://github.com/pytorch/pytorch/pull/106914 on behalf of https://github.com/ZainRizvi due to Sorry, but this is breaking internal builds. Seems like a lot of internal code depends on some of the removed imports ([comment](https://github.com/pytorch/pytorch/pull/106914#issuecomment-1688605975))
2023-08-22 17:16:48 +00:00

29 lines
497 B
C++

#include <torch/csrc/jit/runtime/print_handler.h>
#include <iostream>
#include <string>
namespace torch {
namespace 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 jit
} // namespace torch