You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -367,7 +370,7 @@ How does this `model3` differ from the `model1` we had before?
367
370
368
371
* Flux's [`Chain`](@ref Flux.Chain) works left-to-right, the reverse of Base's `∘`.
369
372
Its contents is stored in a tuple, thus `model3.layers[1].weight` is an array.
370
-
* Flux's layer [`Dense`](@ref Flux.Dense) has only minor differences:
373
+
* Flux's layer [`Dense`](@ref Flux.Dense) has only minor differences from our `struct Layer`:
371
374
- Like `struct Poly3{T}` above, it has type parameters for its fields -- the compiler does not know exactly what type `layer3s.W` will be, which costs speed.
372
375
- Its initialisation uses not `randn` (normal distribution) but [`glorot_uniform`](@ref) by default.
373
376
- It reshapes some inputs (to allow several batch dimensions), and produces more friendly errors on wrong-size input.
@@ -376,7 +379,8 @@ How does this `model3` differ from the `model1` we had before?
376
379
and has a rule telling Zygote how to differentiate it efficiently.
377
380
* Flux overloads `Base.show` so to give pretty printing at the REPL prompt.
378
381
Calling [`Flux.@layer Layer`](@ref Flux.@layer) will add this, and some other niceties.
379
-
* All Flux layers accept a batch of samples: Instead of mapping one sample `x::Vector` to one output `y::Vector`, they map columns of a matrix `xs::Matrix` to columns of the output. This looks like `f(xs) ≈ stack(f(x) for x in eachcol(xs))` but is done more efficiently.
382
+
383
+
All Flux layers accept a batch of samples: Instead of mapping one sample `x::Vector` to one output `y::Vector`, they map columns of a matrix `xs::Matrix` to columns of the output. This looks like `f(xs) ≈ stack(f(x) for x in eachcol(xs))` but is done more efficiently.
380
384
381
385
If what you need isn't covered by Flux's built-in layers, it's easy to write your own.
382
386
There are more details [later](@ref man-advanced), but the steps are invariably those shown for `struct Layer` above:
0 commit comments