def stft_to_spectrogram(stft_signal):
    """
    Calculates the power spectrum (spectrogram) of an stft signal.
    The output is guaranteed to be real.

    :param stft_signal: Complex STFT signal with dimensions
        #time_frames times #frequency_bins.
    :return: Real spectrogram with same dimensions as input.

    Note: Special version of paderbox.math.scalar.abs_square
    """

    spectrogram = stft_signal.real**2 + stft_signal.imag**2
    return spectrogram