What is average unpooling?
When you go backward for max-pooling you keep track of the position of the maximum:

$$ X = \begin{bmatrix}
1 &amp;&amp; 2 \\
3 &amp;&amp; 4
\end{bmatrix} \quad \rightarrow \quad dZ *\begin{bmatrix}
0 &amp;&amp; 0 \\
0 &amp;&amp; 1
\end{bmatrix}$$

This gives you the position of the input value that ultimately influenced the cost/output. The gradient will then be "propagated" back to this value.

For average pooling, all values influence the cost equally and therefore it should look like this:

$$ dZ = z \quad \rightarrow  \quad \begin{bmatrix}
z/n &amp;&amp; z/n \\
z/n &amp;&amp; z/n
\end{bmatrix}$$

where $n$ depends on the filter size, here $n=4$. 

The gradient gets distributed evenly back to all input values.