Stan Math Library
2.20.0
reverse mode automatic differentiation
stan
math
rev
core
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
4
#include <
stan/math/rev/core/vari.hpp
>
5
#include <
stan/math/rev/core/chainable_alloc.hpp
>
6
#include <
stan/math/rev/core/chainablestack.hpp
>
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
vari.hpp
stan
Definition:
log_sum_exp.hpp:8
stan::math::set_zero_all_adjoints
static void set_zero_all_adjoints()
Reset all adjoint values in the stack to zero.
Definition:
set_zero_all_adjoints.hpp:14
stan::math::AutodiffStackSingleton::instance_
static STAN_THREADS_DEF AutodiffStackStorage * instance_
Definition:
autodiffstackstorage.hpp:118
chainable_alloc.hpp
chainablestack.hpp
[
Stan Home Page
]
© 2011–2018, Stan Development Team.