Skip to content

Commit 059225b

Browse files
authored
Merge pull request #84 from axelparmentier/fix-softsparsemax
Fix fallbacks for sparse argmax and soft argmax regularizations
2 parents 44a3055 + 54e0457 commit 059225b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/regularized/soft_argmax.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ function soft_argmax(z::AbstractVector)
1616
end
1717

1818
function soft_argmax_regularization(y::AbstractVector)
19-
return isprobadist(y) ? negative_shannon_entropy(y) : typemax(R)
19+
return isprobadist(y) ? negative_shannon_entropy(y) : typemax(eltype(y))
2020
end

src/regularized/sparse_argmax.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function sparse_argmax(z::AbstractVector; kwargs...)
1616
end
1717

1818
function sparse_argmax_regularization(y::AbstractVector)
19-
return isprobadist(y) ? half_square_norm(y) : typemax(R)
19+
return isprobadist(y) ? half_square_norm(y) : typemax(eltype(y))
2020
end
2121

2222
"""

0 commit comments

Comments
 (0)