class QPanda::Variational::expression

Overview

A proxy class for the Variational::var. More...

Detailed Documentation

A proxy class for the Variational::var.

Construction

Construct a new expression object.

Parameters:

root the root variable, denoting the y in dy/dx.

Methods

Get the root.

Returns:

var the root, denoting the y in dy/dx.

recursively finding the leaves for the root

Returns:

std::vector<var> the vector of the leaves

feed forward the expression, return the value

Returns:

MatrixXd The result

feed forward the expression with given leaves

Parameters:

leaves leaves either generated by expression::findLeaves or assigned by user (usually not including the training data placeholders).

Returns:

MatrixXd The reuslts.

find all non-constants variable for the given leaves. if there is some variable not related in the path from the root to the leaves, it will not be added into the set

Returns:

std::unordered_set<var> All non-constants variables.

backpropagation and evalute all gradients.

Parameters:

leaves The var-grad map. This function will update the gradients.

backpropagation and evalute all gradients.

Parameters:

leaves The var-grad map. This function will update the gradients.
nonconsts all non-constants. using this to remove unnecessary nodes from the gradient-evaluation.