|
381 | 381 |
|
382 | 382 | """
|
383 | 383 | CrossCor(filter, in => out, σ=identity; stride=1, pad=0, dilation=1, [bias, init])
|
384 |
| - CrossCor(weight::AbstractArray, [bias, activation; stride, pad, dilation]) |
385 | 384 |
|
386 |
| -Standard cross convolutional layer. `filter` is a tuple of integers |
| 385 | +Standard cross correlation layer. `filter` is a tuple of integers |
387 | 386 | specifying the size of the convolutional kernel;
|
388 | 387 | `in` and `out` specify the number of input and output channels.
|
389 | 388 |
|
@@ -420,6 +419,28 @@ struct CrossCor{N,M,F,A,V}
|
420 | 419 | dilation::NTuple{N,Int}
|
421 | 420 | end
|
422 | 421 |
|
| 422 | +""" |
| 423 | + CrossCor(weight::AbstractArray, [bias, activation; stride, pad, dilation]) |
| 424 | +
|
| 425 | +Constructs a CrossCor layer with the given weight and bias. |
| 426 | +Accepts the same keywords (and has the same defaults) as the `CrossCor((5,5), 3 => 6, relu)` method. |
| 427 | +
|
| 428 | +# Examples |
| 429 | +```jldoctest |
| 430 | +julia> weight = rand(3, 4, 5); |
| 431 | +
|
| 432 | +julia> bias = zeros(5); |
| 433 | +
|
| 434 | +julia> lay = CrossCor(weight, bias, relu) |
| 435 | +CrossCor((3,), 4 => 5, relu) # 65 parameters |
| 436 | +
|
| 437 | +julia> lay(randn(100, 4, 64)) |> size |
| 438 | +(98, 5, 64) |
| 439 | +
|
| 440 | +julia> Flux.params(lay) |> length |
| 441 | +2 |
| 442 | +``` |
| 443 | +""" |
423 | 444 | function CrossCor(w::AbstractArray{T,N}, bias = true, σ = identity;
|
424 | 445 | stride = 1, pad = 0, dilation = 1) where {T,N}
|
425 | 446 | stride = expand(Val(N-2), stride)
|
|
0 commit comments