In your forward pass out = out.view(-1) to flatten output to 1D.
In backward pass d_out = d_out.view(1, 1, 16, 16)
For backpropagation, do a quick google search you will find the complete derivation. I don’t have the picture of it right now.