@@ -532,31 +532,30 @@ end
532
532
533
533
This layer behaves differently based on input type:
534
534
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:
540
539
```
541
540
x1 → layer1 → y1 ↘
542
541
connection → layer2 → y2 ↘
543
542
x2 ↗ connection → layer3 → y3
544
543
x3 ↗
545
544
```
546
-
547
- In code:
545
+ ... or written as:
548
546
```julia
549
547
y1 = layer1(x1)
550
548
y2 = layer2(connection(x2, y1))
551
549
y3 = layer3(connection(x3, y2))
552
550
```
553
551
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:
555
554
556
555
```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] ))
560
559
end
561
560
```
562
561
0 commit comments