Arturas_Druteika:

why dephwise convs use the the same set of weights for all channels.


It doesn’t and each filter is used for a particular input channel in my example.
If you check the weight, input, and output, you’ll see:
filters:
Parameter containing:
tensor([[[[1., 1., 1.],
            [1., 1., 1.],
            [1., 1., 1.]]],


          [[[2., 2., 2.],
            [2., 2., 2.],
            [2., 2., 2.]]],


          [[[3., 3., 3.],
            [3., 3., 3.],
            [3., 3., 3.]]]], requires_grad=True)

input:
tensor([[[[1., 1., 1.],
            [1., 1., 1.],
            [1., 1., 1.]],

           [[2., 2., 2.],
            [2., 2., 2.],
            [2., 2., 2.]],

           [[3., 3., 3.],
            [3., 3., 3.],
            [3., 3., 3.]]]])

output:
tensor([[[[ 4.,  6.,  4.],
            [ 6.,  9.,  6.],
            [ 4.,  6.,  4.]],

           [[16., 24., 16.],
            [24., 36., 24.],
            [16., 24., 16.]],

           [[36., 54., 36.],
            [54., 81., 54.],
            [36., 54., 36.]]]], grad_fn=<MkldnnConvolutionBackward>)

Based on the output you can see that only filter0 is applied to input_channel0, filter1 to input_channel1, and filter2 to input_channel2.
The center output value indicates it most clearly and you can manually recompute it.