How to set up convolution layers in Knet.jl vs Flux.jl?

I have trouble understaind the Knet.jl docs

For example

conv4(w, x; kwargs...)
Execute convolutions or cross-correlations using filters specified with w over tensor x.

If w has dimensions (W1,W2,...,Cx,Cy) and x has dimensions (X1,X2,...,Cx,N), the result y will have dimensions (Y1,Y2,...,Cy,N) where Cx is the number of input channels, Cy is the number of output channels, N is the number of instances, and Wi,Xi,Yi are spatial dimensions with Yi determined by:

to set up a convolution layer in Flux.jl it’s

Conv((2,2), 1=>16, relu)

I know that I am applying a 2x2 convolution and making 16 output channels (so 16 filters) from 1 channel. Whereas I can’t heads and tails of the doc in Knet.jl at all.

Flux.jl seems to be closer to Keras in design.

How do I a 2 by 2 convolution filter in Knet.jl?

1 Like

Looks like it’s based on the size of w
http://denizyuret.github.io/Knet.jl/v0.8/cnn.html#conv_dims-1