or you can use maybe to avoid the branching:

data = np.asarray(data, order='C')
data.resize((n_out,) + data.shape[1:], refcheck=False)