If I have a Convolutional Neural Network (without pooling and everything other than the convolutional filter, because I only want to apply blurring to my images) that looks like:
class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(in_channels=1, out_channels=1, kernel_size=5, padding=2)

    def forward(self, x):
        x = self.conv1(x)
        return x

model=Net()
model.train()
for batch_idx, (main, blur) in enumerate(train_loader):
    optimizer.zero_grad()
    output=model(main)
    loss = F.mse_loss(output, blur)
    loss.backward()
    optimizer.step()