mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Use fmt::format for debug strings in Library init (#151629)
Observed several ms taken during `import torch` by c10::str here. Differential Revision: [D73129453](https://our.internmc.facebook.com/intern/diff/D73129453/) Pull Request resolved: https://github.com/pytorch/pytorch/pull/151629 Approved by: https://github.com/cyyever, https://github.com/Skylion007, https://github.com/albanD, https://github.com/malfet ghstack dependencies: #151626, #151627, #151628
This commit is contained in:
parent
313ceb4da3
commit
cac8d35503
|
|
@ -1,6 +1,7 @@
|
||||||
#include <torch/library.h>
|
#include <torch/library.h>
|
||||||
|
|
||||||
#include <ATen/core/dispatch/Dispatcher.h>
|
#include <ATen/core/dispatch/Dispatcher.h>
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
namespace torch {
|
namespace torch {
|
||||||
|
|
||||||
|
|
@ -11,7 +12,7 @@ namespace {
|
||||||
#ifdef STRIP_ERROR_MESSAGES
|
#ifdef STRIP_ERROR_MESSAGES
|
||||||
return std::string();
|
return std::string();
|
||||||
#else
|
#else
|
||||||
return c10::str("registered at ", file, ":", line);
|
return fmt::format("registered at {}:{}", file, line);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user