Your code self.conv2.weight[0,0] = self.conv1.weight[0,0].t() only transposes the weight matrix for the part of the convolution that takes the first channel of the input to the first channel of the output, it doesn’t do anything for the other parts of the convolution.
If you want to transpose the convolutional matrices for all channels you can use .transpose(2,3) to swap the last two dimensions of a 4D tensor.
It looks like my idea for weight sharing doesn’t work at all, and a quick search of the forum shows that the only easyish way to do it is to use the functional form of conv2d 23.
import torch
import torch.nn as nn

class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.conv_weight = nn.Parameter(torch.randn(1,1,5,5))
    
    def forward(self, x):
        x = nn.functional.conv2d(x, self.conv_weight, bias=None, stride=1, padding=2, dilation=1, groups=1)
        x = nn.functional.conv2d(x, self.conv_weight.transpose(2,3), bias=None, stride=1, padding=0, dilation=1, groups=1)
        return x