mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/63860 Test Plan: Imported from OSS Reviewed By: heitorschueroff Differential Revision: D30513253 Pulled By: albanD fbshipit-source-id: 97d76ed54dfbdf4ba3fc7051ce3b9bb636cefb4b
16 lines
318 B
C++
16 lines
318 B
C++
#include <c10/core/AutogradState.h>
|
|
#include <c10/core/GradMode.h>
|
|
|
|
#include <stdexcept>
|
|
|
|
namespace c10 {
|
|
|
|
bool GradMode::is_enabled() {
|
|
return AutogradState::get_tls_state().get_grad_mode();
|
|
}
|
|
|
|
void GradMode::set_enabled(bool enabled) {
|
|
AutogradState::get_tls_state().set_grad_mode(enabled);
|
|
}
|
|
} // namespace c10
|