ptrblck:




 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.


I think I got it but I just wanna be sure. Below I declared 1 conv which is depthwise separable conv.
conv_1 = nn.Conv2d(3, 9, 3, 1, 1, groups=3)

The conv_1 weighrs are:
tensor([[[[-0.0161,  0.0004, -0.1099],
          [ 0.0736, -0.1180, -0.3216],
          [-0.0853,  0.0933, -0.1864]]],

        [[[ 0.1278, -0.1644,  0.2590],
          [-0.1445, -0.1871, -0.0343],
          [-0.0603,  0.3219, -0.0483]]],

        [[[-0.3080,  0.2339,  0.2711],
          [ 0.0146,  0.1944, -0.1174],
          [-0.1286,  0.0212, -0.0767]]],

        [[[ 0.1212, -0.1680,  0.0872],
          [-0.0935, -0.1477, -0.1296],
          [ 0.2756,  0.1593, -0.3307]]],

        [[[-0.2472, -0.2188,  0.0018],
          [-0.2081, -0.1654,  0.2874],
          [ 0.0344,  0.2792,  0.0798]]],

        [[[-0.2411,  0.3194, -0.1092],
          [ 0.1661, -0.1743, -0.1464],
          [ 0.2462,  0.2495,  0.2859]]],

        [[[ 0.2739, -0.3026, -0.1970],
          [-0.2544, -0.1160, -0.0240],
          [-0.0554,  0.0301,  0.2732]]],

        [[[-0.0789, -0.2924, -0.1171],
          [-0.0089, -0.1265, -0.3290],
          [ 0.2165,  0.3325,  0.0016]]],

        [[[-0.3004, -0.2152, -0.3310],
          [ 0.0623,  0.2407, -0.0975],
          [-0.0268,  0.3014,  0.3107]]]], requires_grad=True)

So the first 3 blocks of weights, specifically:
        [[[-0.0161,  0.0004, -0.1099],
          [ 0.0736, -0.1180, -0.3216],
          [-0.0853,  0.0933, -0.1864]]],

        [[[ 0.1278, -0.1644,  0.2590],
          [-0.1445, -0.1871, -0.0343],
          [-0.0603,  0.3219, -0.0483]]],

        [[[-0.3080,  0.2339,  0.2711],
          [ 0.0146,  0.1944, -0.1174],
          [-0.1286,  0.0212, -0.0767]]],

would be convolved on the input, and then the following 3 blocks and then the last 3? Do I now understand it the correct way?