|
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 |
|
◆ Operation()
The operation class serves as an abstract object, which all tensors operations descend from. It is used to build a computation tree.
◆ _eval()
Sets this->output_tensor to the value of this operation
- Returns
- Tensor<T>* the evaluated tensor
Implemented in magmadnn::op::ProductOp< T >, magmadnn::op::DivOp< T >, magmadnn::op::AddOp< T >, magmadnn::op::SigmoidOp< T >, magmadnn::op::MatmulOp< T >, magmadnn::op::Variable< T >, magmadnn::op::SumOp< T >, magmadnn::op::TanhOp< T >, magmadnn::op::ReluOp< T >, magmadnn::op::CrossEntropyOp< T >, magmadnn::op::DropoutOp< T >, magmadnn::op::SoftmaxOp< T >, magmadnn::op::ReduceSumOp< T >, magmadnn::op::ScalarProductOp< T >, magmadnn::op::LinearForwardOp< T >, magmadnn::op::Conv2DForwardOp< T >, magmadnn::op::LogOp< T >, magmadnn::op::PowOp< T >, magmadnn::op::NegativeOp< T >, magmadnn::op::PoolingOp< T >, magmadnn::op::TransposeOp< T >, and magmadnn::op::FlattenOp< T >.
◆ _grad()
Computes the gradient of this operation wrt the output of consumer.
- Parameters
-
consumer | |
var | |
grad | |
recompute | |
- Returns
- Tensor<T>*
Implemented in magmadnn::op::ProductOp< T >, magmadnn::op::DivOp< T >, magmadnn::op::AddOp< T >, magmadnn::op::SigmoidOp< T >, magmadnn::op::MatmulOp< T >, magmadnn::op::Variable< T >, magmadnn::op::SumOp< T >, magmadnn::op::TanhOp< T >, magmadnn::op::ReluOp< T >, magmadnn::op::CrossEntropyOp< T >, magmadnn::op::DropoutOp< T >, magmadnn::op::SoftmaxOp< T >, magmadnn::op::ReduceSumOp< T >, magmadnn::op::ScalarProductOp< T >, magmadnn::op::LinearForwardOp< T >, magmadnn::op::Conv2DForwardOp< T >, magmadnn::op::LogOp< T >, magmadnn::op::PowOp< T >, magmadnn::op::NegativeOp< T >, magmadnn::op::PoolingOp< T >, magmadnn::op::TransposeOp< T >, and magmadnn::op::FlattenOp< T >.
◆ add_consumer()
◆ eval()
Returns the operation's evaluated tensor.
- Parameters
-
recompute | whether to use previous value or recalculate |
- Returns
- Tensor<T>*
◆ get_consumers()
Returns a vector of operations that need this operation as input.
- Returns
- std::vector<Operation<T> *> vector of consumer operations
◆ get_grad_tensor()
Gets the current grad_tensor wrt to wrt.
- Parameters
-
- Returns
- Tensor<T>*
◆ get_inputs()
Returns a vector the input operations to this one.
- Returns
- std::vector<Operation<T> *> vector of input operations
◆ get_memory_type()
The memory type used to compute this operation.
- Returns
- memory_t
◆ get_name()
◆ get_output_shape() [1/2]
Returns the expected output shape of this operation.
- Returns
- std::vector<unsigned int>
◆ get_output_shape() [2/2]
- Parameters
-
- Returns
- std::vector<unsigned int>
◆ get_output_size()
The total number of elements outputted by operation.
- Returns
- unsigned int
◆ get_output_tensor()
Gets a pointer to the output tensor this returns
- Returns
- Tensor<T>*
◆ grad()
Computes the gradient with respect to the outputs and var.
- Parameters
-
consumer | the operation that consumes this that needs the gradient |
grad | the gradient of the loss w.r.t. the consumers output |
- Returns
- Tensor<T>*
◆ reset()
Clears the operation so that it will be recomputed.
◆ to_string()
string form of the given operation. Expands on input.
- Returns
- std::string
Implemented in magmadnn::op::ProductOp< T >, magmadnn::op::DivOp< T >, magmadnn::op::AddOp< T >, magmadnn::op::SigmoidOp< T >, magmadnn::op::MatmulOp< T >, magmadnn::op::Variable< T >, magmadnn::op::SumOp< T >, magmadnn::op::TanhOp< T >, magmadnn::op::ReluOp< T >, magmadnn::op::CrossEntropyOp< T >, magmadnn::op::DropoutOp< T >, magmadnn::op::SoftmaxOp< T >, magmadnn::op::ReduceSumOp< T >, magmadnn::op::ScalarProductOp< T >, magmadnn::op::LinearForwardOp< T >, magmadnn::op::Conv2DForwardOp< T >, magmadnn::op::LogOp< T >, magmadnn::op::PowOp< T >, magmadnn::op::NegativeOp< T >, magmadnn::op::PoolingOp< T >, magmadnn::op::TransposeOp< T >, and magmadnn::op::FlattenOp< T >.
The documentation for this class was generated from the following file: