I have been trying to use Keras tuner for a Keras model built by my collegues (apologies, I am a pytorch user) and when I apply Keras tuner to this model I get AttributeError: 'HyperParameters' object has no attribute 'shape'
def my_function(hp, input_size: int, dense_spec: dict):
inp = tf.keras.layers.Input((input_size,))
x = inp
for units_val in dense_spec:
x = tf.keras.layers.Dense(units=hp.Int('units_' + str(units_val), min_value=16, max_value=units_val, step=16, default=units_val), activation="relu") (x)
x = tf.keras.layers.Lambda(
lambda tensor: K.l2_normalize(tensor, axis=1), name="vector"
)(x)
model0 = tf.keras.models.Model(inp, x, name="model0")
return model0