如何从r-bloggers运行keras示例?

时间:2019-02-07 22:57:38

标签: r keras lstm

我正在尝试运行r-bloggers帖子“ Time Series Deep Learning: Forecasting Sunspots With Keras Stateful LSTM In R”中发布的代码。但是我在keras包生效的步骤中收到一条错误消息。在下面,我将粘贴从结尾开始失败的代码部分,并显示错误消息。 keras软件包或系统设置是否有问题?预先感谢您的帮助。

model %>%
 layer_lstm(units             = 50, 
             input_shape      = c(tsteps, 1), 
             batch_size       = batch_size,
             return_sequences = TRUE, 
             stateful         = TRUE) %>% 
  layer_lstm(units            = 50, 
             return_sequences = FALSE, 
             stateful         = TRUE) %>% 
  layer_dense(units = 1)

这是我收到的错误消息

    Error in py_call_impl(callable, dots$args, dots$keywords) : 
  ValueError: Layer lstm_3 was called with an input that isn't a symbolic tensor. Received type: <class 'keras.engine.sequential.Sequential'>. Full input: [<keras.engine.sequential.Sequential object at 0x2aab3cd14588>]. All inputs to the layer should be tensors.

0 个答案:

没有答案