Caffe2 - C++ API
A deep learning, cross platform ML framework
Related Pages
Modules
Data Structures
Files
C++ API
Python API
GitHub
File List
Globals
torch
csrc
autograd
grad_mode.h
1
#pragma once
2
3
#include <torch/csrc/WindowsTorchApiMacro.h>
4
5
namespace
torch
{
namespace
autograd {
6
7
struct
TORCH_API
GradMode
{
8
static
bool
is_enabled();
9
static
void
set_enabled(
bool
enabled);
10
};
11
12
// A RAII, thread local (!) guard that enables or disables grad mode upon
13
// construction, and sets it back to the original value upon destruction.
14
struct
TORCH_API
AutoGradMode
{
15
AutoGradMode
(
bool
enabled) : prev_mode(GradMode::is_enabled()) {
16
GradMode::set_enabled(enabled);
17
}
18
~AutoGradMode() {
19
GradMode::set_enabled(prev_mode);
20
}
21
bool
prev_mode;
22
};
23
24
}}
torch::autograd::GradMode
Definition:
grad_mode.h:7
torch::autograd::AutoGradMode
Definition:
grad_mode.h:14
torch
Definition:
jit_type.h:17
Generated on Thu Mar 21 2019 13:06:22 for Caffe2 - C++ API by
1.8.11