Hello,
I am trying to convert an EagerTensor to a Numpy array using the code below,
tensor.numpy()
but I got an error, “AttributeError: ‘Tensor’ object has no attribute ‘numpy’”
Also when I used the below code, it shows this error, “NotImplementedError: Cannot convert a symbolic Tensor (concat:0) to a numpy array. This error may indicate that you’re trying to pass a Tensor to a NumPy call, which is not supported”
np.add(tensor,1)
I have searched a lot regarding this error all solutions state that it is related to eager execution is enabled, or the version of numpy. however, I have disabled the eager and downgraded the Numpy but the problem is still firing.
I am trying to implement a CNN model for speech recognition using Cochleagram waveform, I have used the simple speech recognition of TensorFlow, below is my code to run it
def get_cochleagram(waveform):
input_len = 16000
waveform = waveform[:input_len]
zero_padding = tf.zeros([16000] - tf.shape(waveform), dtype=tf.float32)
waveform = tf.cast(waveform, dtype=tf.float32)
equal_length = tf.concat([waveform, zero_padding], 0)
cochleagram = np.add(equal_length,1) // here I got the error
cochleagram = cgram.cochleagram(cochleagram, sr = 16000, n=40,low_lim=50, hi_lim=8000, sample_factor=1)
cochleagram = tf.multiply(cochleagram, 42)
return cochleagram
All your suggestions are appreciated.