【发布时间】:2019-02-18 04:25:48
【问题描述】:
使用 R 包设置 keras 和 tensorflow 以开始试用 mnist 模型拟合一直很乏味。我在哪里可以检查这些软件包的常见问题?
我已经卸载并重新安装了 Anaconda 并激活了 3.5 Python,开始从 GitHub 代表而不是 CRAN 获取 keras 和 tensorflow 包,并确保 tensorflow 1.9 是正在安装的版本。 (跳过下面代码中的mnist数据准备)
devtools::install_github("rstudio/keras")
devtools::install_github("rstudio/tensorflow")
install_keras(tensorflow= "1.9")
install_tensorflow(version="1.9")
library(keras)
library(tensorflow)
model <- keras_model_sequential()
model %>% layer_dense(units = 784)
Error in py_call_impl(callable, dots$args, dots$keywords) :
AttributeError: 'Sequential' object has no attribute 'get_shape'
Detailed traceback:
File "C:\Users\LENOVO\ANACON~1\envs\R-RETI~1\lib\site-
packages\tensorflow\python\keras\_impl\keras\engine\topology.py", line 258,
in __call__
output = super(Layer, self).__call__(inputs, **kwargs)
File "C:\Users\LENOVO\ANACON~1\envs\R-RETI~1\lib\site-packages\tensorflow\python\layers\base.py", line 629, in __call__
self._assert_input_compatibility(inputs)
File "C:\Users\LENOVO\ANACON~1\envs\R-RETI~1\lib\site-packages\tensorflow\python\layers\base.py", line 1120, in _assert_input_compatibility
if x.get_shape().ndims is None:
【问题讨论】:
标签: r tensorflow keras rstudio