Skip to content Skip to sidebar Skip to footer

Typeerror: 'nonetype' Object Is Not Callable Tensorflow

Currently working on a regression problem with tf2.0. In order to prepare my dataset, I have used the following code: train = tf.data.Dataset.from_tensor_slices(([train_X], [train_

Solution 1:

Problem is that when you stack multiple LSTMs, we should use the argument, return_sequences = True in LSTM Layer.

It is because if return_sequences = False (default behavior), LSTM will return the Output of the Last Time Step. But when we stack LSTMs, we will need the Output of the Complete Sequence rather than just the Last Time Step.

Changing your Model to

comp_lstm = tf.keras.models.Sequential([
    tf.keras.layers.LSTM(64, return_sequences = True),
    tf.keras.layers.LSTM(64, return_sequences = True),
    tf.keras.layers.LSTM(64),
    tf.keras.layers.Dense(1)
])

should resolve the error.

This way, you can use Bi-Directional LSTMs as well.

Please let me know if you face any other error and I will be Happy to help you.

Hope this helps. Happy Learning!

Post a Comment for "Typeerror: 'nonetype' Object Is Not Callable Tensorflow"