Skip to content

Commit

Permalink
Test fix asan error
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Oct 7, 2023
1 parent 50acf60 commit c1cbe26
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions stan/math/rev/fun/hypergeometric_pFq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ inline var hypergeometric_pFq(const Ta& a, const Tb& b, const Tz& z) {
arena_t<Ta> arena_a = a;
arena_t<Tb> arena_b = b;
auto pfq_val = hypergeometric_pFq(a.val(), b.val(), value_of(z));
auto grad_tuple
= grad_pFq<GradA, GradB, GradZ>(pfq_val, a.val(), b.val(), value_of(z));
return make_callback_var(
pfq_val, [arena_a, arena_b, z, grad_tuple](auto& vi) mutable {
pfq_val, [arena_a, arena_b, z, pfq_val](auto& vi) mutable {
auto grad_tuple = grad_pFq<GradA, GradB, GradZ>(pfq_val, arena_a.val(),
arena_b.val(),
value_of(z));
if (GradA) {
forward_as<promote_scalar_t<var, Ta>>(arena_a).adj()
+= vi.adj() * std::get<0>(grad_tuple);
Expand Down

0 comments on commit c1cbe26

Please sign in to comment.