def _volumes(shape: Sequence[int]) -> list[int]:
    r"""Returns a list of the volume spanned by each dimension.

    Given a shape=[d_0, d_1, .., d_n] the volume spanned by each dimension is
        volume[i] = `\prod_{j=i+1}^n d_j`

    Args:
        shape: Sequence of the size of each dimension.

    Returns:
        Sequence of the volume spanned of each dimension.
    """
    volume = [0] * len(shape)
    v = 1
    for i in reversed(range(len(shape))):
        volume[i] = v
        v *= shape[i]
    return volume
Returns a list of the volume spanned by each dimension.

    Given a shape=[d_0, d_1, .., d_n] the volume spanned by each dimension is
        volume[i] = `\prod_{j=i+1}^n d_j`

    Args:
        shape: Sequence of the size of each dimension.

    Returns:
        Sequence of the volume spanned of each dimension.
    
cirq-core/cirq/linalg/transformations.py