You can create a nn.Parameter 5 w with a size [out_channels, in_channels, kernel_size].
Then torch.diag_embed(w) 12 will have a size [out_channels, in_channels, kernel_size, kernel_size], in which each squared kernel is diagonal.
So you can use nn.functional.conv2d(x, torch.diag_embed(w)) 7.