Skip to content

Commit

Permalink
fix: mark Utils.eltype as non-differentiable
Browse files Browse the repository at this point in the history
  • Loading branch information
avik-pal committed Sep 5, 2024
1 parent dce920d commit 7b96d5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/src/introduction/updating_to_v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ abstraction.
- `Lux.Experimental.@layer_map` is not longer needed and has been removed. The name of the
variable prevents writing generic functions and is no longer pre-pended to the `KeyPath`.
See the docstring of [`Lux.Experimental.layer_map`](@ref) for more details.
- `allow_fast_activation` kwarg has been removed completely. Pass an annonymous function
- `allow_fast_activation` kwarg has been removed completely. Pass an anonymous function
as the activation to prevent internal modivations to the activation function.

### Breaking Changes (Moved Functionality)
Expand Down
2 changes: 2 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ eltype(x) = eltype(Base.eltype(x))
eltype(::Type{T}) where {T} = T
eltype(::Type{<:Dual{T, V}}) where {T, V} = V

@non_differentiable eltype(::Any)

ofeltype_array(::Type{T}, x::AbstractArray) where {T} = broadcast(T, x)
function ofeltype_array(::Type{T}, x::AbstractArray{<:Dual{Tag, V, N}}) where {Tag, T, V, N}
return Dual{Tag, T, N}.(x)
Expand Down

0 comments on commit 7b96d5d

Please sign in to comment.