[Fix] type promotion (#3944)

dependabot/npm_and_yarn/demos/speech_web/web_client/nanoid-3.3.8
megemini 2 weeks ago committed by GitHub
parent e4038b4b6e
commit f0b7f5b995
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -37,7 +37,7 @@ def compute_amplitude(waveforms, lengths=None, amp_type="avg", scale="linear"):
out = paddle.mean(paddle.abs(waveforms), axis=1, keepdim=True) out = paddle.mean(paddle.abs(waveforms), axis=1, keepdim=True)
else: else:
wav_sum = paddle.sum(paddle.abs(waveforms), axis=1, keepdim=True) wav_sum = paddle.sum(paddle.abs(waveforms), axis=1, keepdim=True)
out = wav_sum / lengths out = wav_sum / lengths.astype(wav_sum.dtype)
elif amp_type == "peak": elif amp_type == "peak":
out = paddle.max(paddle.abs(waveforms), axis=1, keepdim=True) out = paddle.max(paddle.abs(waveforms), axis=1, keepdim=True)
else: else:

Loading…
Cancel
Save