Just import keras
from tensorflow 2. The same syntax is available in tensorflow 2 -
from tensorflow import keras
x = keras.layers.Input(shape=(input_dim))
hp_units1 = hp.Int('units', min_value=1, max_value=15, step=1)
h1 = keras.layers.Dense(hp_units1, activation = 'sigmoid', name='dense_1')(x)
t = keras.layers.Dense(1, activation='sigmoid', name='time_prediction')(h1)
decoded = keras.layers.Dense(input_dim, activation='linear', name='decoded_mean')(h1)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…