Make input data contiguous if necessary