Skip to content

Commit c897d3f

Browse files
committed
Remove unnecessary to_ref
1 parent 37e6003 commit c897d3f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

stan/math/rev/constraint/simplex_constrain.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ inline auto simplex_constrain(const T& y) {
4242
}
4343

4444
reverse_pass_callback([arena_y, arena_x]() mutable {
45-
const auto& res_val = to_ref(arena_x.val());
45+
auto&& res_val = arena_x.val();
4646

4747
// backprop for softmax
4848
Eigen::VectorXd x_pre_softmax_adj = -res_val * arena_x.adj().dot(res_val)
@@ -85,7 +85,7 @@ inline auto simplex_constrain(const T& y, scalar_type_t<T>& lp) {
8585
}
8686

8787
reverse_pass_callback([arena_y, arena_x, lp]() mutable {
88-
const auto& res_val = to_ref(arena_x.val());
88+
auto&& res_val = arena_x.val();
8989

9090
// backprop for log jacobian contribution to log density
9191
arena_x.adj().array() += lp.adj() / res_val.array();

0 commit comments

Comments
 (0)