TypeError: ‘KerasTensor’ object is not callable [closed]

  keras, python, tensorflow

The following code works without the attention thing, however when I add it as seen below I get the following error:

     61 
     62 decoder1 = layers.Reshape(target_shape=(4,512))(decoder1)
---> 63 attention = layers.Attention()([encoder,decoder1])(decoder1)
     64 attention = layers.Concatenate()([encoder, decoder1])(attention)
     65 

TypeError: 'KerasTensor' object is not callable

The code:

encoder = layers.Reshape(target_shape=(4,512))(encoder)

decoder1 = layers.LSTM(2048)(encoder)

decoder1 = layers.Reshape(target_shape=(4,512))(decoder1)
attention = layers.Attention()([encoder,decoder1])(decoder1)
attention = layers.Concatenate()([encoder, decoder1])(attention)

decoder2 = layers.LSTM(576)(attention)

How would I solve this?

Source: Python Questions

LEAVE A COMMENT