MCPcopy Create free account
hub / github.com/OriginQ/QPanda-2 / _back

Method _back

Core/Variational/var.cpp:564–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562}
563
564std::vector<MatrixXd> var::_back(const MatrixXd & dx, const std::vector<var>& nonconsts)
565{
566 auto operands = getChildren();
567 std::vector<MatrixXd> derivatives;
568 for (size_t i = 0; i < operands.size(); i++) {
569
570 if (std::end(nonconsts) == std::find(std::begin(nonconsts), std::end(nonconsts), operands[i]))
571 derivatives.push_back(zeros_like(operands[i])); // no gradient flow.
572 else
573 derivatives.push_back(_back_single(dx, i));
574 }
575 return derivatives;
576}
577
578std::vector<MatrixXd> var::_back(const MatrixXd & dx)
579{

Callers 1

backpropagateMethod · 0.80

Calls 5

zeros_likeFunction · 0.85
findFunction · 0.50
sizeMethod · 0.45
push_backMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected