9

I am using AUTOTUNE for audio processing.

import tensorflow as tf
AUTOTUNE = tf.data.AUTOTUNE

But i am getting attribute error which said "module 'tensorflow._api.v2.data' has no attribute 'AUTOTUNE'". Tensorflow version is 2.3.0. How to solve this?

1
  • Also, I'm not sure what you're expecting AUTOTUNE to do, as it seems to be used for automatic data pipelining for performance reasons. Commented Apr 6, 2021 at 3:16

4 Answers 4

26

According to the TensorFlow 2.3 documentation, AUTOTUNE lies under the tensorflow.data.experimental namespace. So using

AUTOTUNE = tf.data.experimental.AUTOTUNE

should avoid this error.

Sign up to request clarification or add additional context in comments.

Comments

2

With TF 2.3, Autotune was experimental and was in nightly build but in TF 2.5, it is in packages. We can do this if we want to train the model in TF 2.5 or TF 2.3.

try:
    AUTOTUNE = tf.data.AUTOTUNE     
except:
    AUTOTUNE = tf.data.experimental.AUTOTUNE 
  

Comments

0

At least TF 2.4 you should install.

Comments

0

Upgrade your TensorFlow using following comment

pip install --upgrade tensorflow

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.