I was trying to use Keras to classify movie reviews into their respective sentiment classes (positive or negative).
import tensorflow as tffrom tensorflow import kerasimport numpy as np# Preprocessing the DataX = np.array(X) / 255.0y = keras.utils.to_categorical(y)
But it gives me following error when i run the code:
---------------------------------------------------------------------------AttributeError Traceback (most recent call last)Input In [41], in <cell line: 2>() 1 # Importing Required Libraries----> 2 import tensorflow as tf 3 from tensorflow import keras 4 import numpy as npFile ~\anaconda3\lib\site-packages\keras\applications\inception_resnet_v2.py:324, in <module> 320 x = layers.Activation(activation, name=ac_name)(x) 321 return x--> 324 @keras.utils.register_keras_serializable() 325 class CustomScaleLayer(keras_layers.Layer): 326 def __init__(self, scale, **kwargs): 327 super().__init__(**kwargs)AttributeError: module 'keras' has no attribute 'utils'
versions that i use:
Python - 3.9.12keras - 2.12.0tensorflow - 2.12.0