Skip to content

Commit

Permalink
Change to broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
roflmaostc committed Jun 4, 2024
1 parent 71fcb13 commit b392b4c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/loss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ end
function (l::LossThresholdSparsity)(x::AbstractArray{T}, target, patterns) where T
return @inbounds (sum(l.sum_f.(NNlib.relu.(T(l.thresholds[2]) .- x) .* target) .+
l.sum_f.(NNlib.relu.(x .- T(1)) .* target) .+
l.sum_f.(NNlib.relu.(x .- T(l.thresholds[1])) .* (T(1) .- target))) +
T(l.λ) * sum(l.sparsity_sum_f, patterns))
l.sum_f.(NNlib.relu.(x .- T(l.thresholds[1])) .* (T(1) .- target))) .+
T(l.λ) .* sum(l.sparsity_sum_f, patterns))
end


Expand Down

0 comments on commit b392b4c

Please sign in to comment.