Skip to content

Commit

Permalink
build based on 4b28583
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Dec 14, 2023
1 parent 7fb15b3 commit c725e84
Show file tree
Hide file tree
Showing 16 changed files with 153 additions and 146 deletions.
39 changes: 23 additions & 16 deletions dev/api/Lux/contrib.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Training State containing:
* `step`: Number of updates of the parameters made.


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/training.jl#L3-L13' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/training.jl#L3-L13' class='documenter-source'>source</a><br>

</div>
<br>
Expand Down Expand Up @@ -104,7 +104,7 @@ A 4-Tuple containing:
* `ts`: Updated Training State.


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/training.jl#L68-L92' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/training.jl#L68-L92' class='documenter-source'>source</a><br>

</div>
<br>
Expand All @@ -129,7 +129,7 @@ Update the parameters stored in `ts` using the gradients `grads`.
Updated `TrainState` object.


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/training.jl#L49-L62' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/training.jl#L49-L62' class='documenter-source'>source</a><br>

</div>
<br>
Expand Down Expand Up @@ -206,7 +206,7 @@ m = Lux.Experimental.FrozenLayer(Dense(2 => 2), (:weight,))
See also [`Lux.Experimental.freeze`](contrib#Lux.Experimental.freeze), [`Lux.Experimental.unfreeze`](contrib#Lux.Experimental.unfreeze).


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/freeze.jl#L1-L57' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/freeze.jl#L1-L57' class='documenter-source'>source</a><br>

</div>
<br>
Expand All @@ -222,7 +222,7 @@ freeze(l::AbstractExplicitLayer, which_params::Union{Tuple, Nothing} = nothing)
Constructs a version of `l` with `which_params` frozen. If `which_params` is nothing, then all parameters are frozen.


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/freeze.jl#L107-L112' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/freeze.jl#L107-L112' class='documenter-source'>source</a><br>


```
Expand All @@ -233,7 +233,7 @@ freeze(l::AbstractExplicitLayer, ps, st::NamedTuple,
Construct a [`Lux.Experimental.FrozenLayer`](contrib#Lux.Experimental.FrozenLayer) for `l` with the current parameters and states. If `which_params` is nothing, then all parameters are frozen.


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/freeze.jl#L117-L123' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/freeze.jl#L117-L123' class='documenter-source'>source</a><br>

</div>
<br>
Expand All @@ -249,7 +249,7 @@ unfreeze(l::FrozenLayer)
Unfreezes the layer `l`.


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/freeze.jl#L141-L145' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/freeze.jl#L141-L145' class='documenter-source'>source</a><br>


```
Expand All @@ -259,7 +259,7 @@ unfreeze(l::FrozenLayer, ps, st::NamedTuple)
Unwraps a [`Lux.Experimental.FrozenLayer`](contrib#Lux.Experimental.FrozenLayer) `l` with the current parameters and states.


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/freeze.jl#L148-L152' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/freeze.jl#L148-L152' class='documenter-source'>source</a><br>

</div>
<br>
Expand Down Expand Up @@ -320,7 +320,7 @@ Lux.layer_map(zero_dense_params, c, ps, st)
```


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/map.jl#L42' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/map.jl#L42' class='documenter-source'>source</a><br>

</div>
<br>
Expand Down Expand Up @@ -361,7 +361,7 @@ Lux.@layer_map zero_dense_params c ps st
```


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/map.jl#L4' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/map.jl#L4' class='documenter-source'>source</a><br>

</div>
<br>
Expand All @@ -387,7 +387,7 @@ Recurses into the `layer` and replaces the inner most non Container Layers with
See [`Lux.Experimental.DebugLayer`](contrib#Lux.Experimental.DebugLayer) for details about the Keyword Arguments.


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/debug.jl#L158-L165' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/debug.jl#L158-L165' class='documenter-source'>source</a><br>

</div>
<br>
Expand Down Expand Up @@ -439,7 +439,7 @@ If `nan_check` is enabled and NaNs are detected then a `DomainError` is thrown.
See [`Lux.Experimental.@debug_mode`](contrib#Lux.Experimental.@debug_mode) to construct this layer.


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/debug.jl#L1-L49' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/debug.jl#L1-L49' class='documenter-source'>source</a><br>

</div>
<br>
Expand Down Expand Up @@ -485,7 +485,7 @@ ps = Lux.share_parameters(ps, (("d3.l2", "d1"), ("d2", "d3.l1")))
```


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/share_parameters.jl#L3-L38' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/share_parameters.jl#L3-L38' class='documenter-source'>source</a><br>

</div>
<br>
Expand Down Expand Up @@ -535,7 +535,7 @@ State is mutated in place. An additional caveat is that the updated state from `
* `y`: The output of the layer


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/stateful.jl#L1-L39' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/stateful.jl#L1-L39' class='documenter-source'>source</a><br>

</div>
<br>
Expand All @@ -553,11 +553,18 @@ State is mutated in place. An additional caveat is that the updated state from `
@compact(kw...) do x
...
end
@compact(forward::Function; name=nothing, parameters...)
@compact(forward::Function; name=nothing, dispatch=nothing, parameters...)
```

Creates a layer by specifying some `parameters`, in the form of keywords, and (usually as a `do` block) a function for the forward pass. You may think of `@compact` as a specialized `let` block creating local variables that are trainable in Lux. Declared variable names may be used within the body of the `forward` function. Note that unlike typical Lux models, the forward function doesn't need to explicitly manage states.

**Reserved Kwargs:**

1. `name`: The name of the layer.
2. `dispatch`: The constructed layer has the type `Lux.Experimental.CompactLuxLayer{dispatch}` which can be used for custom dispatches. Based on how Julia Types work, this must be a `isbits` type.

**Examples**

Here is a linear model:

```julia
Expand Down Expand Up @@ -654,7 +661,7 @@ Array Parameter don't print the number of parameters on the side. However, they
:::


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/contrib/compact.jl#L16-L126' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/contrib/compact.jl#L16-L135' class='documenter-source'>source</a><br>

</div>
<br>
4 changes: 2 additions & 2 deletions dev/api/Lux/flux_to_lux.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ m2(x, ps, st)
```


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/extensions.jl#L2-L44' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/extensions.jl#L2-L44' class='documenter-source'>source</a><br>

</div>
<br>
Expand Down Expand Up @@ -105,7 +105,7 @@ Introducing this Layer in your model will lead to type instabilities, given the
* `p`: Flattened parameters of the `layer`


<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/e2affe72482c1ea170a491cd329b288c5a6dad47/src/extensions.jl#L49-L76' class='documenter-source'>source</a><br>
<a target='_blank' href='https://github.com/LuxDL/Lux.jl/blob/4b28583819587f79bdc9b990a47f4fe563ad0418/src/extensions.jl#L49-L76' class='documenter-source'>source</a><br>

</div>
<br>
Loading

0 comments on commit c725e84

Please sign in to comment.