mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
This reverts commit 0b81f700aa7eb20d4b9f20e9627dd1208e50ea58. Reverted https://github.com/pytorch/pytorch/pull/132765 on behalf of https://github.com/ezyang due to implementation is not correct, needs full rewrite ([comment](https://github.com/pytorch/pytorch/pull/132765#issuecomment-2364160452))
23 lines
551 B
C++
23 lines
551 B
C++
#include <torch/csrc/dynamo/cpp_shim.h>
|
|
|
|
#include <ATen/record_function.h>
|
|
|
|
struct _PytorchRecordFunctionState {
|
|
at::RecordFunction guard;
|
|
|
|
_PytorchRecordFunctionState() : guard(at::RecordScope::FUNCTION) {}
|
|
};
|
|
|
|
_PytorchRecordFunctionState* _pytorch_record_function_enter(const char* name) {
|
|
_PytorchRecordFunctionState* state = new _PytorchRecordFunctionState();
|
|
state->guard.before(name);
|
|
return state;
|
|
}
|
|
|
|
void _pytorch_record_function_exit(_PytorchRecordFunctionState* state) {
|
|
if (state == nullptr) {
|
|
return;
|
|
}
|
|
delete state;
|
|
}
|