Muhammad Abdullah
Muhammad Abdullah

Reputation: 1

layers.Dense - AttributeError: 'tuple' object has no attribute 'rank' "

Getting the error "AttributeError: ‘tuple’ object has no attribute ‘rank’ " on the line : dense = layers.Dense(4, activation=act_func)(inputs), in the following function :

def gen_model(act_func = 'relu'):
    inputs = keras.Input(shape=(4,))
    dense = layers.Dense(4, activation=act_func)(inputs)
    dense = layers.Dense(4, activation=act_func)(dense)
    outputs = layers.Dense(1)(dense)
    model = keras.Model(inputs=inputs, outputs=outputs, name="NN_heat_controller")
    return model

if I just print out variable “inputs”, it is : “<KerasTensor shape=(None, 4), dtype=float32, sparse=None, name=keras_tensor_1>”

As far as I understand, the layers.Dense function is expecting a symbolic tensor and that is what is being input as well.

Upvotes: 0

Views: 103

Answers (0)

Related Questions