Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-differentiability of ops on AbstractArray{Bool} #310

Merged
merged 13 commits into from
Dec 3, 2020
14 changes: 8 additions & 6 deletions src/rulesets/Base/nondiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@
@non_differentiable ==(::Any, ::Any)
@non_differentiable ===(::Any, ::Any)

# vcat
# hcat
# hvcat
# vect
# findprev
# promote_shape

@non_differentiable Bool(::Any)

@non_differentiable accumulate(::Any, ::AbstractArray{Bool})
@non_differentiable accumulate!(::Any, ::Any, ::AbstractArray{Bool})
@non_differentiable cat(::AbstractArray{Bool})
Expand All @@ -53,7 +50,11 @@
@non_differentiable findfirst(::Any, ::AbstractArray{Bool})
@non_differentiable findlast(::AbstractArray{Bool})
@non_differentiable findlast(::Any, ::AbstractArray{Bool})
@non_differentiable findprev(::AbstractArray{Bool}, ::Any)
@non_differentiable findprev(::Any, ::AbstractArray{Bool}, ::Any)
@non_differentiable getindex(::AbstractArray{Bool}, ::Any)
@non_differentiable hcat(::AbstractArray{Bool})
@non_differentiable hvcat(::Any, ::AbstractArray{Bool})
@non_differentiable isperm(::AbstractArray{Bool})
# reverseind
@non_differentiable invperm(::AbstractArray{Bool})
Expand Down Expand Up @@ -88,6 +89,7 @@
@non_differentiable similar(::AbstractArray{Bool}, ::Any)
@non_differentiable stride(::AbstractArray{Bool}, ::Any)
@non_differentiable strides(::AbstractArray{Bool})
@non_differentiable vcat(::AbstractArray{Bool})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be vcat(::AbstractArray{Bool}...) if that's accepted?

Also, many of these like strudes & isperm surely aren't differentiable with any input, but isperm([true]) is an error anyway.

similar also accepts further argumens.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think that should be the case. We'll wait on the implementation of support of Vararg's as its implemented in PR JuliaDiff/ChainRulesCore.jl#254 ?

@non_differentiable vec(::AbstractArray{Bool})
@non_differentiable Vector(::AbstractArray{Bool})

Expand Down