lamppp
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
lmp::autograd::VariableImpl Struct Reference

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
 

Detailed Description

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.

See also
function.hpp, forward_function.hpp

The documentation for this struct was generated from the following file: