# How to plug holes in an Image (with partial convolutions)?

NVIDIA recently published a new way to reconstruct images with holes. They use a new type of convolutional layer which is described in the paper Image Inpainting for Irregular Holes Using Partial Convolutions.

I'm trying to implement this in Mathematica. The crucial part is the Partial Convolutional Layer (described in section 3.1 on page 5) defined as follows:

What I've tried so far:

partialConv = NetInitialize @ NetGraph[
<|
"c1" -> ConvolutionLayer[10, {3, 3}, "Weights" -> NetSharedArray["c"]],
"c2" -> ConvolutionLayer[10, {3, 3}, "Weights" -> NetSharedArray["c"]],
|>,
{
{"c1", "c2"} -> "thread" -> NetPort["Output"]
},
"Output" -> NetDecoder["Image"]
]

img = ImageResize[ExampleData[{"TestImage", "Lena"}], 70];