Skip to content

Commit 7214731

Browse files
committed
fix docs
1 parent 51b1088 commit 7214731

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

stan/math/opencl/prim/multinomial_logit_glm_lpmf.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,28 @@ inline return_type_t<T_x, T_alpha, T_beta> multinomial_logit_glm_lpmf(
5757
std::forward<T_alpha>(alpha), std::forward<T_beta>(beta));
5858
}
5959

60+
/** \ingroup opencl
61+
* Returns the log PMF of the Generalized Linear Model (GLM)
62+
* with multinomial distribution and softmax (logit) link function.
63+
* This is an OpenCL overload of
64+
* `prim/prob/multinomial_logit_glm_lpmf.hpp`.
65+
* Alpha can be either a shared 1×K row vector or an N×K per-instance matrix.
66+
* @tparam T_y expression of the outcome count matrix (N×K kernel expression)
67+
* @tparam T_x expression of the design matrix (N×M kernel expression)
68+
* @tparam T_alpha expression of the intercept (1×K or N×K kernel expression)
69+
* @tparam T_beta expression of the weight matrix (M×K kernel expression)
70+
* @param y outcome count matrix. Each row is of length-K non-negative
71+
* integer counts for instance n
72+
* @param x design matrix (N×M) on OpenCL device
73+
* @param alpha intercept: 1×K broadcast row or N×K per-instance matrix
74+
* @param beta weight matrix (M×K) on OpenCL device
75+
* @return log sum of multinomial log PMFs over all N instances
76+
* @throw std::domain_error if any element of x or beta is infinite or NaN,
77+
* or if alpha contains `+inf` or NaN (`-inf` forces the corresponding softmax
78+
* probability to zero and is allowed)
79+
* @throw std::domain_error if any count in y is negative
80+
* @throw std::invalid_argument if container sizes mismatch
81+
*/
6082
template <bool propto = false, typename T_y, typename T_x, typename T_alpha,
6183
typename T_beta,
6284
require_all_prim_or_rev_kernel_expression_t<T_y, T_x, T_alpha,

stan/math/prim/prob/multinomial_logit_glm_lpmf.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,6 @@ inline return_type_t<T_x, T_alpha, T_beta> multinomial_logit_glm_lpmf(
126126

127127
decltype(auto) x_val = to_ref_if<is_autodiff_v<T_beta>>(value_of(x_ref));
128128
decltype(auto) beta_val = to_ref_if<is_autodiff_v<T_x>>(value_of(beta_ref));
129-
// partials_return_t strips one autodiff level from each argument, matching
130-
// x_val/beta_val/value_of(alpha_ref). Pass alpha's full type T_alpha here:
131-
// value_of(alpha_ref) is already stripped once, so passing it would strip
132-
// alpha twice and under-type eta (e.g. var instead of fvar<var>).
133129
using eta_ret_t = partials_return_t<T_x, T_beta, T_alpha>;
134130
Array<eta_ret_t, Dynamic, Dynamic> eta;
135131
if constexpr (T_alpha_rows == 1) {

0 commit comments

Comments
 (0)