'tensorflow' has no attribute 'to_int32'

Viewed 3868

I am trying to implement CTC loss to audio files but I get the following error:

TensorFlow has no attribute 'to_int32'

I'm running tf.version 2.0.0.

I think it's with the version, I'm currently using, as we see the error is thrown in the package itself ' tensorflow_backend.py' code.

I have imported packages as "tensorflow.keras.class_name" with backend as K. Below is the screenshot.

enter image description here

2 Answers

After you make the import just write

tf.to_int=lambda x: tf.cast(x, tf.int32)

This is similar to writing the behavior of tf.to_int in everywhere in the code, so you don't have to manually edit a TF1.0 code

Related