Stan Math Library  2.20.0
reverse mode automatic differentiation
set_zero_all_adjoints.hpp
Go to the documentation of this file.
1 #ifndef STAN_MATH_REV_CORE_SET_ZERO_ALL_ADJOINTS_HPP
2 #define STAN_MATH_REV_CORE_SET_ZERO_ALL_ADJOINTS_HPP
3 
7 
8 namespace stan {
9 namespace math {
10 
14 static void set_zero_all_adjoints() {
15  for (auto &x : ChainableStack::instance_->var_stack_)
16  x->set_zero_adjoint();
17  for (auto &x : ChainableStack::instance_->var_nochain_stack_)
18  x->set_zero_adjoint();
19 }
20 
21 } // namespace math
22 } // namespace stan
23 #endif
static void set_zero_all_adjoints()
Reset all adjoint values in the stack to zero.
static STAN_THREADS_DEF AutodiffStackStorage * instance_

     [ Stan Home Page ] © 2011–2018, Stan Development Team.