25 for (
const auto& w :
W)
30 ArrayXf update_value = ArrayXf::Ones(state.
f[0].size());
31 for(
const ArrayXf& g : gradients) {
40 vector<float> W_temp(
W);
41 vector<float> V_temp(
V);
45 for (
int i = 0;
i <
arity[
'f']; ++
i) {
50 V_temp[
i] = - n/update_value.size() * (d_w * update_value).sum();
57 for (
int i = 0;
i <
W.size(); ++
i)
61 this->
W[
i] += V_temp[
i];
62 this->
V[
i] = V_temp[
i];
73 std::cout << this->
name <<
"|W has value";
74 for (
int i = 0;
i < this->
arity[
'f'];
i++) {
75 std::cout <<
" " << this->
W[
i];
bool isNodeDx()
check of node type
void update(vector< ArrayXf > &gradients, Trace &state, float n, float a)
virtual ArrayXf getDerivative(Trace &state, int loc)=0
void derivative(vector< ArrayXf > &gradients, Trace &state, int loc)
std::map< char, unsigned int > arity
arity of the operator
ArrayXb isnan(const ArrayXf &x)
returns true for elements of x that are NaN
used for tracing stack outputs for backprop algorithm.