when I use the tf version of 2.5.0
I have this problem when construct the model:
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-13-05003f69572f> in <module>()
1 model = Sequential()
2 model.add(Embedding(total_words, 64, input_length=max_sequence_len-1)) # 64 dimensions
----> 3 model.add(Bidirectional(LSTM(20))) # 20 units
4 model.add(Dense(total_words, activation='softmax'))
5 model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
25 frames
<__array_function__ internals> in prod(*args, **kwargs)
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py in __array__(self)
868 "Cannot convert a symbolic Tensor ({}) to a numpy array."
869 " This error may indicate that you're trying to pass a Tensor to"
--> 870 " a NumPy call, which is not supported".format(self.name))
871
872 def __len__(self):
NotImplementedError: Cannot convert a symbolic Tensor (bidirectional_1/forward_lstm_1/strided_slice:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported
when I used tf version of 2.8.0, I can pass the previous code but
I have the following problem when predict the sequence:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-24-53a7062ef087> in <module>()
5 token_list = tokenizer.texts_to_sequences([seed_text])[0]
6 token_list = pad_sequences([token_list], maxlen=max_sequence_len-1, padding='pre')
----> 7 predicted = model.predict_classes(token_list, verbose=0)
8 output_word = ""
9 for word, index in tokenizer.word_index.items():
AttributeError: 'Sequential' object has no attribute 'predict_classes'
How to solve this problem?
Thanks in advance.