3 #include <torch/csrc/WindowsTorchApiMacro.h> 4 #include <torch/csrc/autograd/variable_version.h> 12 namespace torch {
namespace autograd {
17 TORCH_API
extern const char* ERR_BACKWARD_TWICE;
31 Variable unpack(std::shared_ptr<Function> saved_for =
nullptr)
const;
37 void reset_grad_function() {
48 std::shared_ptr<Function> grad_fn_;
49 std::weak_ptr<Function> grad_accumulator_;
52 uint32_t saved_version_ = 0;
53 uint32_t output_nr_ = 0;
54 bool was_default_constructed_ =
true;
55 bool requires_grad_ =
false;
56 bool has_grad_fn_ =
false;
A snapshot of a variable at a certain version.
Variable A Variable augments a Tensor with the ability to interact in our autograd machinery...