Skip to content

Commit 6ab72bd

Browse files
committed
Add underscores to applychain and extraChain to mark them as internal
1 parent 7398a03 commit 6ab72bd

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/layers/basic.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@ end
4848

4949
@functor Chain
5050

51-
(c::Chain)(x) = applychain(c.layers, x)
51+
(c::Chain)(x) = _applychain(c.layers, x)
5252

5353
# Calculates the forward results of the complete chain provided as a `Tuple`, `AbstractVector`,
5454
# or a `NamedTuple` of layers with `x` as model input. Users are encouraged to call a chain
5555
# instead of using this function directly.
56-
@generated function applychain(layers::Tuple{Vararg{<:Any,N}}, x) where {N}
56+
@generated function _applychain(layers::Tuple{Vararg{<:Any,N}}, x) where {N}
5757
symbols = vcat(:x, [gensym() for _ in 1:N])
5858
calls = [:($(symbols[i+1]) = layers[$i]($(symbols[i]))) for i in 1:N]
5959
Expr(:block, calls...)
6060
end
6161

62-
applychain(layers::NamedTuple, x) = applychain(Tuple(layers), x)
62+
_applychain(layers::NamedTuple, x) = _applychain(Tuple(layers), x)
6363

64-
function applychain(layers::AbstractVector, x) # type-unstable path, helps compile times
64+
function _applychain(layers::AbstractVector, x) # type-unstable path, helps compile times
6565
for f in layers
6666
x = f(x)
6767
end
@@ -102,14 +102,14 @@ julia> activations(c, 1)
102102
(2, 4, 64)
103103
```
104104
"""
105-
activations(c::Chain, input) = extraChain(Tuple(c.layers), input)
105+
activations(c::Chain, input) = _extraChain(Tuple(c.layers), input)
106106

107107
# Calculates the forward results of each layer provided in a `Tuple` with `x` as model input.
108-
function extraChain(fs::Tuple, x)
108+
function _extraChain(fs::Tuple, x)
109109
res = first(fs)(x)
110-
return (res, extraChain(Base.tail(fs), res)...)
110+
return (res, _extraChain(Base.tail(fs), res)...)
111111
end
112-
extraChain(::Tuple{}, x) = ()
112+
_extraChain(::Tuple{}, x) = ()
113113

114114

115115
"""

src/layers/conv.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,9 @@ Keywords to control initialization of the layer:
7676
* `bias` - The initial bias vector is all zero by default. Trainable bias can be disabled entirely
7777
by setting this to `false`, or another vector can be provided such as `bias = randn(Float32, out)`.
7878
79-
Convolutional layers can also be constructed with given weights and biases. This constructor accepts the
80-
same keywords (and has the same defaults) as the `Conv((4,4), 3 => 7, relu)` method.
79+
Convolutional layer can also be manually constructed by passing in weights and
80+
biases. This constructor accepts the same keywords (and has the same defaults)
81+
as the `Conv((4,4), 3 => 7, relu)` method.
8182
8283
See also [`ConvTranspose`](@ref), [`DepthwiseConv`](@ref), [`CrossCor`](@ref).
8384
@@ -212,7 +213,7 @@ Note that `pad=SamePad()` here tries to ensure `size(output,d) == size(x,d) * st
212213
Parameters are controlled by additional keywords, with defaults
213214
`init=glorot_uniform` and `bias=true`.
214215
215-
ConvTranspose layer can also be manually constructed with passing in weights and
216+
ConvTranspose layer can also be manually constructed by passing in weights and
216217
biases. This constructor accepts the same keywords (and has the same defaults) as the
217218
`ConvTranspose((4,4), 3 => 7, relu)` method.
218219
@@ -351,7 +352,7 @@ specifying the size of the convolutional kernel;
351352
Parameters are controlled by additional keywords, with defaults
352353
`init=glorot_uniform` and `bias=true`.
353354
354-
CrossCor layer can also be manually constructed with passing in weights and
355+
CrossCor layer can also be manually constructed by passing in weights and
355356
biases. This constructor accepts the layer accepts the same keywords (and has
356357
the same defaults) as the `CrossCor((4,4), 3 => 7, relu)` method.
357358

0 commit comments

Comments
 (0)