Closed
Description
FluxML/Flux.jl#1776 subsitutes tanh
by tanh_fast
, howeer, the latter gives NaN
for large numbers:
I am on Julia 1.7.2 and Flux 0.13.
using Flux
julia> tanh_fast(1e10)
NaN
julia> tanh_fast(-1e10)
-1.0
julia> d = Dense(1=>1, tanh)
Dense(1 => 1, tanh) # 2 parameters
julia> d([-1.e16])
1-element Vector{Float64}:
NaN
julia> d([1.e16])
1-element Vector{Float64}:
-1.0
NaN
would then propagate down the network....