Skip to content

Commit 167d5d4

Browse files
committed
Improve docs for PairwiseFusion
1 parent e842e7b commit 167d5d4

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

src/layers/basic.jl

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -523,18 +523,6 @@ end
523523
"""
524524
PairwiseFusion(connection, layers...)
525525
526-
```
527-
x1 --> layer1 --> y1
528-
|
529-
|--> connection --> layer2 --> y2
530-
| |
531-
x2 |--> connection --> layer3 --> y3
532-
| |
533-
x3 |--> connection --> y4
534-
|
535-
x4
536-
```
537-
538526
## Arguments
539527
540528
- `connection`: Takes 2 inputs and combines them
@@ -544,21 +532,31 @@ x1 --> layer1 --> y1
544532
545533
This layer behaves differently based on input type:
546534
547-
1. Input `x` is a tuple of length `N`. Then `layers` must be a tuple of length `N`. The computation is as follows:
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:
540+
```
541+
x1 → layer1 → y1 ↘
542+
connection → layer2 → y2 ↘
543+
x2 ↗ connection → layer3 → y3
544+
x3 ↗
545+
```
548546
547+
In code:
549548
```julia
550-
y = x[1]
551-
for i in 1:N
552-
y = connection(x[i], layers[i](y))
553-
end
549+
y1 = layer1(x1)
550+
y2 = layer2(connection(x2, y1))
551+
y3 = layer3(connection(x3, y2))
554552
```
555553
556554
2. Any other kind of input:
557555
558556
```julia
559-
y = x
557+
y = x
560558
for i in 1:N
561-
y = connection(x, layers[i](y))
559+
yᵢ₊₁ = connection(x, layers[i](yᵢ))
562560
end
563561
```
564562

0 commit comments

Comments
 (0)