lamppp
|
Main autograd object for Lamppp. More...
#include <variable.hpp>
Public Member Functions | |
VariableImpl (const tensor::Tensor &data, bool requires_grad=false) | |
VariableImpl (const tensor::Tensor &data, const tensor::Tensor &grad, bool requires_grad, std::shared_ptr< Function > grad_fn) | |
Public Attributes | |
tensor::Tensor | data |
tensor::Tensor | grad |
std::shared_ptr< Function > | _grad_fn |
bool | requires_grad |
Main autograd object for Lamppp.
The main autograd object (called Variable) involves four main members: two tensors denoting the data and the gradient, a pointer to a gradient function, and a requires_grad flag. If requires_grad = false, then both "grad" and "_grad_fn" are empty. When an operation is created, the resulting value will store data related to the operation, in the form of a Function. i.e. if Variable c = a + b, then c->grad_fn will be Add.