И этот код выполняется, когда я добавляю каждую функцию по частям.
Код: Выделить всё
#include
#include
#include
#include
using namespace std;
class Variable{
private:
double value;
double grad;
function _backward;
vector _parents;
bool visited;
public:
Variable(double value){
this->value = value;
this->grad = 0.0;
this->_backward = [](){};
this->visited = false;
}
Variable operator + (const Variable& other){
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79173406/memory-deallocation-issue-with-parent-nodes-in-c-reverse-mode-autodiff[/url]