报错:
AttributeError: module 'tensorflow.compat.v1' has no attribute 'contrib'
问题代码:
return tf.abs(tf.contrib.signal.stft(x, Nw, Ns, NFFT,
tf.contrib.signal.hamming_window, True)) # single-sided magnitude spectrum.
解决办法:
return tf.abs(tf.signal.stft(x, Nw, Ns, NFFT,
tf.contrib.signal.hamming_window, True)) # single-sided magnitude spectrum.
原因:
TensorFlow >= 2.4 取消了contrib库
遇到类似问题可以去TensorFlow官网查看对应函数