Add an exception to avoid adapting matrix shape when both has the same shape.