I'm getting this warning and can't figure out how to remove it.
This is the full warning,
WARNING:tensorflow:From C:Usersgeneranaconda3envsfreqlibsite-packagesensorflow_corepythonops
esource_variable_ops.py:1630: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
2021-01-25 16:10:27.289896: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
WARNING:tensorflow:From C:Usersgeneranaconda3envsfreqlibsite-packagesensorflow_corepythonops
n_impl.py:183: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
Here is the code.
import tensorflow
import crepe
from scipy.io import wavfile
import csv
import numpy as np
def get_freq(filename):
outputDict = {}
sr, audio = wavfile.read(filename)
time, frequency, confidence, activation = crepe.predict(audio, sr, viterbi=True, step_size = 10)
for stamp in time:
index = np.where(time == stamp)[0][0]
outputDict[stamp] = frequency[index]
with open("../csv/output.csv", "w", newline="") as file:
writer = csv.writer(file)
writer.writerow(["time", "freq"])
for stamp in outputDict:
writer.writerow([stamp, outputDict[stamp]])
print("Done get_freq.")
My tensorflow is 2.4.0 and I tried putting tf.where in place of np.where but that just made my code stop working. The first warning Im not sure what it even means. I saw online that these error are harmless to the code, but their difficult to code with, so if there is a way to get rid of them it would be greatly appreciated.
question from:
https://stackoverflow.com/questions/65892650/deprecation-warning-how-to-remove-warningcalling-baseresourcevariable-init 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…