From 89fc89fe60d93963d0e271fbf7b01902a5a5abc7 Mon Sep 17 00:00:00 2001 From: Carlo Lucibello Date: Fri, 13 Dec 2024 17:32:41 +0100 Subject: [PATCH] fix doctest --- .github/workflows/ci.yml | 2 +- docs/make.jl | 1 + docs/src/guide/models/basics.md | 4 ++-- docs/src/reference/models/layers.md | 1 + src/layers/recurrent.jl | 4 ++-- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acd279d709..dfa4a442f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,4 +75,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} - DATADEPS_ALWAYS_ACCEPT: true + diff --git a/docs/make.jl b/docs/make.jl index 4367639d8e..d74486936b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -2,6 +2,7 @@ using Documenter, Flux, NNlib, Functors, MLUtils, BSON, Optimisers, OneHotArrays, Zygote, ChainRulesCore, Plots, MLDatasets, Statistics, DataFrames, JLD2, MLDataDevices +ENV["DATADEPS_ALWAYS_ACCEPT"] = true DocMeta.setdocmeta!(Flux, :DocTestSetup, :(using Flux); recursive = true) diff --git a/docs/src/guide/models/basics.md b/docs/src/guide/models/basics.md index 7ad62ee207..7141fb0b28 100644 --- a/docs/src/guide/models/basics.md +++ b/docs/src/guide/models/basics.md @@ -185,7 +185,7 @@ These matching nested structures are at the core of how Flux works.

 Zygote.jl

``` -Flux's [`gradient`](@ref) function by default calls a companion packages called [Zygote](https://github.com/FluxML/Zygote.jl). +Flux's [`gradient`](@ref Flux.gradient) function by default calls a companion packages called [Zygote](https://github.com/FluxML/Zygote.jl). Zygote performs source-to-source automatic differentiation, meaning that `gradient(f, x)` hooks into Julia's compiler to find out what operations `f` contains, and transforms this to produce code for computing `∂f/∂x`. @@ -372,7 +372,7 @@ How does this `model3` differ from the `model1` we had before? Its contents is stored in a tuple, thus `model3.layers[1].weight` is an array. * Flux's layer [`Dense`](@ref Flux.Dense) has only minor differences from our `struct Layer`: - 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. - - Its initialisation uses not `randn` (normal distribution) but [`glorot_uniform`](@ref) by default. + - Its initialisation uses not `randn` (normal distribution) but [`glorot_uniform`](@ref Flux.glorot_uniform) by default. - It reshapes some inputs (to allow several batch dimensions), and produces more friendly errors on wrong-size input. - And it has some performance tricks: making sure element types match, and re-using some memory. * The function [`σ`](@ref NNlib.sigmoid) is calculated in a slightly better way, diff --git a/docs/src/reference/models/layers.md b/docs/src/reference/models/layers.md index 355d3e7833..562304de70 100644 --- a/docs/src/reference/models/layers.md +++ b/docs/src/reference/models/layers.md @@ -104,6 +104,7 @@ PairwiseFusion Much like the core layers above, but can be used to process sequence data (as well as other kinds of structured data). ```@docs +Recurrence RNNCell RNN LSTMCell diff --git a/src/layers/recurrent.jl b/src/layers/recurrent.jl index 616dfc83b3..5b88768ad1 100644 --- a/src/layers/recurrent.jl +++ b/src/layers/recurrent.jl @@ -12,7 +12,7 @@ function scan(cell, x, state) end """ - Recurrent(cell) + Recurrence(cell) Create a recurrent layer that processes entire sequences out of a recurrent `cell`, such as an [`RNNCell`](@ref), [`LSTMCell`](@ref), or [`GRUCell`](@ref), @@ -52,7 +52,7 @@ stack(out, dims = 2) # Examples ```jldoctest -julia> rnn = Recurrent(RNNCell(2 => 3)) +julia> rnn = Recurrence(RNNCell(2 => 3)) julia> x = rand(Float32, 2, 3, 4); # in x len x batch_size