29 [[nodiscard]]
float value()
const {
return value_; }
32 [[nodiscard]]
float grad()
const {
return grad_; }
49 void step(
float learning_rate);
A bare learnable scalar (e.g. a GFlowNet loss's log Z), outside the Module/LRP hierarchy entirely.
Definition learnable_scalar.hpp:23
void step(float learning_rate)
Plain SGD update: value_ -= learning_rate * grad_.
float value() const
Current value.
Definition learnable_scalar.hpp:29
LearnableScalar(float initial_value=0.0f)
Constructs a scalar with the given initial value and zero gradient.
void zero_grad()
Resets the accumulated gradient to zero. Does not change value().
float grad() const
Accumulated gradient since the last zero_grad().
Definition learnable_scalar.hpp:32
void accumulate_grad(float grad)
Adds to the accumulated gradient – mirrors Tensor::accumulate()'s across-multiple-contributions conve...
Definition acquisition_functions.hpp:16