Suppose there are two set of kernels with a same shape and almost half elements in the kernels are zeros. For the same input x, the kernels are used to calculate convolution respectively. See example code blow:
initial
conv=nn.conv2d(c,n,k) # shape(n,c,k,k)
forward
kernel1=F.relu(conv.weight)
kernel2=F.relu(-conv.weight)
out1=F.conv2d(x,kernel1)
out2=F.conv2d(x,kernel2)
As 0 multiple anything is 0, near half of the multiplications in the convolutions are unnecessary. My question is:
Is there possible to speed up the two convolutions ? Can the two convolutions calculate in parallel ?