Skip to content

Commit b64957c

Browse files
committed
Add class to lambda capture
1 parent 01a4f4f commit b64957c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

stan/math/rev/functor/adj_jac_apply.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ inline void build_y_adj(vari** y_vi, const std::array<int, size>& M,
3939
template <size_t size>
4040
inline void build_y_adj(vari** y_vi, const std::array<int, size>& M,
4141
std::vector<double>& y_adj) {
42+
y_adj.clear();
4243
y_adj.reserve(M[0]);
4344
for (size_t m = 0; m < M[0]; ++m) {
4445
y_adj[m] = y_vi[m]->adj_;
@@ -510,7 +511,7 @@ struct adj_jac_vari : public vari {
510511
internal::build_y_adj(y_vi_, M_, y_adj);
511512
auto y_adj_jacs = f_.multiply_adjoint_jacobian(is_var_, y_adj);
512513

513-
apply([&](auto&&... args) { accumulate_adjoints(args...); }, y_adj_jacs);
514+
apply([this](auto&&... args) { this->accumulate_adjoints(args...); }, y_adj_jacs);
514515
}
515516
};
516517

0 commit comments

Comments
 (0)