def prefix_sum_inc(weights):
    """ Compute an inclusive prefix sum.

    Example:
        >>> prefix_sum_inc([3,4,5])
        [3, 7, 12]
    """
    weights_ = [w for w in weights]
    for x in range(1, len(weights_)):
        weights_[x] += weights_[x - 1]
    return weights_
Compute an inclusive prefix sum.

Example:
>>> prefix_sum_inc([3,4,5])
[3, 7, 12]
opensora/adaptor/utils.py