Not able to run the code

Course Name: Neural Networks in Trading, Section No: 6, Unit No: 14, Unit type: Notebook



Not able to run the below code :



model = Sequential()

model.add(LSTM(4, input_shape=(

    X_train.shape[1], X_train.shape[2]), return_sequences=True))

model.add(Dense(neurons, activation=act))

model.add(Dropout(dropout_ratio))

model.add(Dense(neurons2, activation=act))

model.add(Dropout(dropout_ratio))

model.add(Dense(neurons
3, activation=act))

model.add(Dropout(dropout_ratio))

model.add(Dense(neurons4, activation=act))

model.add(Dropout(dropout_ratio))

model.add(Dense(neurons
5, activation=act))

model.add(Dropout(dropout_ratio))

model.add(Dense(1))

model.compile(loss='mean_squared_error', optimizer='adam', metrics=['mse'])



Here is the 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

Hello Ankit,



I suppose this error is due to the incompatible NumPy/TensorFlow version.



Please set up your environment with the correct version. You may refer to this blog for the same.



Thanks,

Gaurav