My code is:
import tensorflow as tf
keras_model = tf.keras.Sequential([
tf.keras.layers.Embedding(1000, 16),
tf.keras.layers.LSTM(32),
])
I have an error:
NotImplementedError: Cannot convert a symbolic Tensor (lstm/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
Call stack:
Tensor.__array__ in ops line 848 Python
_wrapreduction in fromnumeric line 90 Python
prod in fromnumeric line 2962 Python
prod in C:\Users\FA\Google Drive\Colab Notebooks\PoetryTransformer\Accentizer\<__array_function__ internals> line 6 Python
_constant_if_small in array_ops line 2732 Python
zeros in array_ops line 2794 Python
wrapped in _tag_zeros_tensor in array_ops line 2747 Python
wrapper in add_dispatch_support in dispatch line 201 Python
create_zeros in _generate_zero_filled_state in recurrent line 2981 Python
<listcomp> in nest line 635 Python
map_structure in nest line 635 Python
_generate_zero_filled_state in recurrent line 2984 Python
_generate_zero_filled_state_for_cell in recurrent line 2968 Python
LSTMCell.get_initial_state in recurrent line 2524 Python
RNN.get_initial_state in recurrent line 646 Python
RNN._process_inputs in recurrent line 862 Python
LSTM.call in recurrent_v2 line 1108 Python
Layer._functional_construction_call in base_layer line 1117 Python
Layer.__call__ in base_layer line 926 Python
RNN.__call__ in recurrent line 663 Python
Sequential.add in sequential line 221 Python
_method_wrapper in no_automatic_dependency_tracking in base line 457 Python
Sequential.__init__ in sequential line 142 Python
_method_wrapper in no_automatic_dependency_tracking in base line 457 Python
ragged module line 5 Python
I can not add LSTM layer neither with Sequentional API nor with Functional API. Custom model works well. What could be a reason of that ?
Tensorflow version is 2.3.0. Python version 3.6.
The error relates to Visual Studio (no error when I am running w/o VS).