The problem I am stuck with is in cropping tensors at certain parts of the network to obtain specific dimensions.
I am trying to construct the U-net convolutional neural network. Almost all of the components of this are well covered in the MMA neural network framework; the contraction part of the network was straightforward but the expansion path is more difficult.
At several locations in the network I need to crop a layer to match that of another in a different part of the network. For example, I need to concatenate a layer with dimensions {1,568,568} with another of dimensions {1,392,392} and need to match the dimensions of the two by cropping from the first.
PaddingLayer
is close but (unlike ArrayPad
) does not permit negative padding values, that is, something like PaddingLayer[{-88,-88}]
would do the trick but it isn't possible. ResizeLayer
is not the answer because it introduces some form of interpolation.
Is there some other way of dealing with this?