#include <variable.h>
Public Member Functions | |
Variable (std::string name, std::vector< unsigned int > shape, tensor_filler_t< T > filler, memory_t mem_type) | |
Variable (std::string name, Tensor< T > *val) | |
std::string | to_string () |
std::string | get_name () |
![]() | |
Operation () | |
Operation (std::vector< Operation< T > *> inputs, bool needs_grad=true) | |
virtual std::vector< unsigned int > | get_output_shape () const |
virtual unsigned int | get_output_shape (unsigned int idx) const |
virtual unsigned int | get_output_size () const |
virtual memory_t | get_memory_type () const |
virtual Tensor< T > * | eval (bool recompute=true) |
virtual void | reset () |
virtual Tensor< T > * | grad (Operation< T > *consumer, Operation< T > *var, Tensor< T > *grad, bool recompute=true) |
virtual void | add_consumer (Operation< T > *consumer) |
virtual std::vector< Operation< T > * > | get_consumers () |
virtual std::vector< Operation< T > * > | get_inputs () |
virtual Tensor< T > * | get_output_tensor () |
virtual Tensor< T > * | get_grad_tensor (Operation< T > *wrt) |
Protected Member Functions | |
Tensor< T > * | _eval (bool recompute=true) |
Tensor< T > * | _grad (Operation< T > *consumer, Operation< T > *var, Tensor< T > *grad) |
Protected Attributes | |
std::string | name |
Tensor< T > * | val |
bool | delete_tensor |
![]() | |
std::vector< Operation< T > * > | inputs |
std::vector< Operation< T > * > | consumers |
std::vector< unsigned int > | output_shape |
memory_t | mem_type |
std::map< uintptr_t, Tensor< T > * > | _grad_cache |
std::string | name = "DefaultOpName" |
Tensor< T > * | output_tensor |
bool | needs_grad |
bool | has_been_computed |
bool | has_grad_been_computed |
Variable Operation. The most basic operation; it simply wraps around a tensor.
T |
|
protectedvirtual |
Sets this->output_tensor to the value of this operation
Implements magmadnn::op::Operation< T >.
|
protectedvirtual |
Computes the gradient of this operation wrt the output of consumer.
consumer | |
var | |
grad | |
recompute |
Implements magmadnn::op::Operation< T >.
|
inlinevirtual |
the name of this operation.
Reimplemented from magmadnn::op::Operation< T >.
|
inlinevirtual |
string form of the given operation. Expands on input.
Implements magmadnn::op::Operation< T >.