mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/63117 Test Plan: Imported from OSS Reviewed By: ngimel Differential Revision: D30388097 Pulled By: albanD fbshipit-source-id: f1bc777064645db1ff848bdd64af95bffb530984
15 lines
282 B
C++
15 lines
282 B
C++
#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
|