SciML / SciMLBook

Parallel Computing and Scientific Machine Learning (SciML): Methods and Applications (MIT 18.337J/6.338J)
https://book.sciml.ai/
1.85k stars 334 forks source link

Two small issues #71

Closed andreasvarga closed 1 year ago

andreasvarga commented 1 year ago

In the 03: SciML Intro, I tried out the code snippets and examples. I came accross the following issues, which probably must be corrected:

  1. The code sequence
    using InteractiveUtils
    @which Dense(10,32,tanh)

    produced on my Windows 11 machine with Julia 1.8.3 the following output

    
    julia> using InteractiveUtils

julia> @which Dense(10,32,tanh) Dense(in::Integer, out::Integer, σ; kw...) in Flux at C:\Users\Andreas.julia\packages\Flux\ZdbJr\src\deprecations.jl:63

which is different from the present text (see also the `deprecations.jl` file mentioned) 

2. The code sequence 

f = Dense(32,32,tanh) f(rand(32))

generated no errors:

julia> f = Dense(32,32,tanh) Dense(32 => 32, tanh) # 1_056 parameters

julia> f(rand(32)) 32-element Vector{Float64}: 0.9062770976213805 0.8425807828837493 0.26792840252578065 0.666140647367476 0.4405276873148863 0.19332285187403578 -0.13799441384013086 0.7189609454578357 0.2718110166518423 -0.6121470269007114 0.1182030593450979 -0.5633580380133035 0.10511116299410357 ⋮ -0.6040242147542774 0.2563146309890773 -0.6861582833270895 -0.8277344376601083 -0.6012511813196918 0.27191114186414983 -0.01659445287046109 0.15963767325232198 0.6874323041110563 -0.7743081464822815 -0.11817069631320432 -0.43434795650833513

ChrisRackauckas commented 1 year ago

There was an update in Flux that made it change the syntax:

https://fluxml.ai/Flux.jl/stable/models/layers/#Flux.Dense

These notes need to be updated to the form f = Dense(32 => 32,tanh)