You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/multivariate/dirichlet.jl
+3-12Lines changed: 3 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -377,17 +377,17 @@ function fit_mle(::Type{<:Dirichlet}, P::AbstractMatrix{Float64},
377
377
end
378
378
379
379
## Differentiation
380
-
function ChainRulesCore.frule((_, Δalpha)::Tuple{Any,Any}, DT::Union{Type{Dirichlet{T}}, Type{Dirichlet}}, alpha::AbstractVector{T}; check_args =true) where {T}
380
+
function ChainRulesCore.frule((_, Δalpha), ::Type{DT}, alpha::AbstractVector{T}; check_args::Bool=true) where {T<:Real, DT <:Union{Dirichlet{T}, Dirichlet}}
381
381
d =DT(alpha; check_args=check_args)
382
382
Δalpha = ChainRulesCore.unthunk(Δalpha)
383
383
∂alpha0 =sum(Δalpha)
384
-
∂lmnB::typeof(∂alpha0)=sum(Δalpha[i] * (SpecialFunctions.digamma(alpha[i]) - SpecialFunctions.digamma(d.alpha0)) for i ineachindex(alpha))
384
+
∂lmnB =sum(Δalpha[i] * (SpecialFunctions.digamma(alpha[i]) - SpecialFunctions.digamma(d.alpha0)) for i ineachindex(alpha))
0 commit comments