def magphase(spec, power=1.):
    """
    Separate a complex-valued spectrogram with shape (*,2)
    into its magnitude and phase.
    """
    mag = spec.pow(2).sum(-1).pow(power/2)
    phase = angle(spec)
    return mag, phase

    Separate a complex-valued spectrogram with shape (*,2)
    into its magnitude and phase.
    
train/speech_enhancement/models/frcrn/utils.py