Skip to content

Commit

Permalink
fixed findmax unconsistency (#521)
Browse files Browse the repository at this point in the history
* fixed Base.findmax unconsistency

* Update src/ReinforcementLearningCore/src/utils/base.jl

Co-authored-by: Jun Tian <[email protected]>

Co-authored-by: Jun Tian <[email protected]>
  • Loading branch information
3rdCore and findmyway authored Oct 8, 2021
1 parent e2c4673 commit c6c5053
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/ReinforcementLearningCore/src/utils/base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ end
# _rf_findmax((fm, m), (fx, x)) = isless(fm, fx) ? (fx, x) : (fm, m)

# !!! type piracy
Base.findmax(A::AbstractVector, mask::AbstractVector{Bool}) =
findmax(i -> A[i], view(keys(A), mask))
Base.findmax(A::AbstractVector{T}, mask::AbstractVector{Bool}) where T = findmax(ifelse.(mask, A, typemin(T)))


const VectorOrMatrix = Union{AbstractMatrix,AbstractVector}
Expand Down

0 comments on commit c6c5053

Please sign in to comment.