remove record_function_enter and record_function_exit from header (#37052)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/37052

These only need to be in the cpp as they are not referenced anywhere
else. These functions should only be used from the python operators
torch.opts.profiler.record_function_{enter, exit}.
ghstack-source-id: 102979051

Test Plan: CI

Differential Revision: D21171987

fbshipit-source-id: dfe8130d2b64de6179222327069ce1ab877829e3
This commit is contained in:
Rohan Varma 2020-04-27 21:18:53 -07:00 committed by Facebook GitHub Bot
parent 48b126f496
commit b37080d97a
2 changed files with 3 additions and 5 deletions

View File

@ -13,6 +13,8 @@ namespace torch {
namespace autograd {
namespace profiler {
// Creates a new profiling scope using RecordFunction and invokes its starting
// callbacks.
at::Tensor record_function_enter(const std::string& name) {
auto rec = std::make_unique<RecordFunction>(RecordScope::USER_SCOPE);
if (auto* current = rec->current()) {
@ -33,6 +35,7 @@ RecordFunction& getRecordFunctionFromTensor(const at::Tensor& handle) {
return rec;
}
// Ends the profiling scope created with record_function_enter.
void record_function_exit(const at::Tensor& handle) {
// We don't actually need to do anything with handle just need to persist the
// lifetime until now.

View File

@ -5,9 +5,6 @@
namespace torch {
namespace autograd {
namespace profiler {
// Creates a new profiling scope using RecordFunction and invokes its starting
// callbacks.
at::Tensor record_function_enter(const std::string& name);
// Cast Tensor that was created with at::cpp_custom_type_hack back to
// RecordFunction. This is a temporary workaround until RecordFunction is
@ -36,8 +33,6 @@ void _call_end_callbacks_on_fut(
});
}
// Ends the profiling scope created with record_function_enter.
void record_function_exit(const at::Tensor& handle);
} // namespace profiler
} // namespace autograd