The source and destination array must have the same shape (see section 4.4). The shape of the shift array must be obtained from the shape of the source array by deleting dimension dim.