Formula: depthwise conv + LayerNorm + 1x1 conv
Details
Depthwise k x k convolution, channel-last LayerNorm, a pointwise expansion with GELU, a pointwise projection back, then a residual add scaled by gamma. ConvNeXt initialises the layer scale gamma at a small value; at gamma = 0 the block is EXACTLY the identity, which is the check that the residual path is wired the right way round.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Convnx(V)
#> $estimate
#> [1] 4.5
#>
#> $out
#> [,1]
#> [1,] 1
#> [2,] 2
#> [3,] 3
#> [4,] 4
#> [5,] 5
#> [6,] 6
#> [7,] 7
#> [8,] 8
#>
#> $residual_norm
#> [1] 0
#>
#> $H
#> [1] 8
#>
#> $W
#> [1] 1
#>
#> $C
#> [1] 1
#>
#> $method
#> [1] "ConvNeXt block"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
