lidehui:

One way to achieve this layer is using torch.nn.Conv2d to define a 3x3 normal convolution layer firstly (named NormalLayer), and then set the corresponding position as zero in NormalLayer.weight.data before every time I use NormalLayer. But the calculated amount will equal to 3x3 normal convolution (9 points) in this way, while the true calculated amount is 5 points (w1 to w5) in ‘T’ shape kernel. Apparently, this solution is not what I want.


Why do you think the calculated result is of 3x3 normal convolution? Since you are setting non ‘T’ elements to 0, don’t you think the convolution only calculates 5 multiplications effectively ?