def _try_resize_dim_0_inplace(array, new_shape_0):
    """Try to resize 0-axis of array in-place or return a view otherwise."""
    if new_shape_0 >= array.shape[0]:
        return array
    try:
        array.resize((new_shape_0,) + array.shape[1:])
        return array
    except ValueError:
        return array[:new_shape_0]
