"import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.experimental import preprocessing
When I run the code above. I get ImportError: cannot import name 'preprocessing' from 'tensorflow.keras.experimental". And before you what version I am using. I am using tensorflow 2.4.1.
What am I doing wrong?
It's because you're using the wrong import. Try changing
from tensorflow.keras.experimental import preprocessing
to
from tensorflow.keras.layers.experimental import preprocessing
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.