I’m not well versed in CNN models for edge detection, but perhaps you could look at deconvolution layers using torch.nn.ConvTranspose2d?
Note, technically it’s not a deconvolution operation, but it can be used when you want to ‘decode’ after ‘encoding’, and so could be useful for your image-to-image task.
https://pytorch.org/docs/stable/generated/torch.nn.ConvTranspose2d.html 1