Skip to content

Commit cf758eb

Browse files
theabhirathmcabbottCarloLucibello
committed
Doc tweaks
Co-Authored-By: Michael Abbott <[email protected]> Co-Authored-By: Carlo Lucibello <[email protected]>
1 parent 167d5d4 commit cf758eb

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/layers/basic.jl

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -525,38 +525,37 @@ end
525525
526526
## Arguments
527527
528-
- `connection`: Takes 2 inputs and combines them
528+
- `connection`: A function taking 2 inputs and combining them into a single output
529529
- `layers`: The layers whose outputs are combined
530530
531531
## Inputs
532532
533533
This layer behaves differently based on input type:
534534
535-
1. Input `x` is a tuple of length `N`. Then `layers` must be a tuple of length `N`.
536-
537-
With 3 layers, it takes 3 inputs and returns 3 outputs.
538-
`(y1, y2, y3) = PairwiseFusion(connection, layer1, layer2, layer3)((x1, x2, x3))`
539-
may be drawn as:
535+
1. If input `x` is a tuple of length `N`, matching the number of `layers`,
536+
then each layer receives a new input `x[i]` combined with the previous output `y[i-1]` using `connection`.
537+
Thus `(y1, y2, y3) = PairwiseFusion(connection, layer1, layer2, layer3)((x1, x2, x3))`
538+
may be drawn as:
540539
```
541540
x1 → layer1 → y1 ↘
542541
connection → layer2 → y2 ↘
543542
x2 ↗ connection → layer3 → y3
544543
x3 ↗
545544
```
546-
547-
In code:
545+
... or written as:
548546
```julia
549547
y1 = layer1(x1)
550548
y2 = layer2(connection(x2, y1))
551549
y3 = layer3(connection(x3, y2))
552550
```
553551
554-
2. Any other kind of input:
552+
2. With just one input, each layer receives the same `x` combined with the previous output.
553+
Thus `y = PairwiseFusion(connection, layers...)(x)` obeys:
555554
556555
```julia
557-
y₁ = x
558-
for i in 1:N
559-
yᵢ₊₁ = connection(x, layers[i](yᵢ))
556+
y[1] == layers[1](x)
557+
for i in 2:length(layers)
558+
y[i] == connection(x, layers[i](y[i-1]))
560559
end
561560
```
562561

0 commit comments

Comments
 (0)