1 #ifndef STAN_MATH_FWD_SCAL_FUN_BINARY_LOG_LOSS_HPP
2 #define STAN_MATH_FWD_SCAL_FUN_BINARY_LOG_LOSS_HPP
3 
4 #include <stan/math/fwd/core.hpp>
5 #include <stan/math/prim/scal/fun/binary_log_loss.hpp>
6 
7 namespace stan {
8 namespace math {
9 
10 template <typename T>
binary_log_loss(int y,const fvar<T> & y_hat)11 inline fvar<T> binary_log_loss(int y, const fvar<T>& y_hat) {
12   if (y)
13     return fvar<T>(binary_log_loss(y, y_hat.val_), -y_hat.d_ / y_hat.val_);
14   else
15     return fvar<T>(binary_log_loss(y, y_hat.val_),
16                    y_hat.d_ / (1.0 - y_hat.val_));
17 }
18 }  // namespace math
19 }  // namespace stan
20 #endif
21