def adapt_shape_array(X, shape_must_be):
    """
    This function takes care of the unspecified dimensions in the required shapes of data structures.
    The None elements in the shape tuple will be replaced with actual shape of the input array.

    Parameters
    ----------
    X: ndarray
        The input numpy array.

    shape_must_be: tuple
        The required shape of the input array, might contains None elements.

    Returns
    -------
    tuple
        The actual shape with no None elements.

    """
    if None in shape_must_be:
        copy_shape_must_be = list(shape_must_be)
        while None in copy_shape_must_be:
            ind = copy_shape_must_be.index(None)
            copy_shape_must_be[ind] = X.shape[ind]
        return tuple(copy_shape_must_be)
    else:
        return shape_must_be
