def _unpad(self, a, axis, out):
        """Undo padding in an array.

        Parameters
        ----------
        a : (..., N, ...) ndarray
            array to be trimmed to size `Nin`
        axis : int
            axis along which to unpad
        out : bool
            trim the output if True, otherwise the input; the two cases have
            their left and right pad sizes reversed
        """

        assert a.shape[axis] == self.N

        Npad = self.N - self.Nin
        if out:
            _Npad, Npad_ = Npad - Npad//2, Npad//2
        else:
            _Npad, Npad_ = Npad//2, Npad - Npad//2

        return np.take(a, range(_Npad, self.N - Npad_), axis=axis)
Undo padding in an array.

        Parameters
        ----------
        a : (..., N, ...) ndarray
            array to be trimmed to size `Nin`
        axis : int
            axis along which to unpad
        out : bool
            trim the output if True, otherwise the input; the two cases have
            their left and right pad sizes reversed