Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Keras模型不';不接受输入层_R_Python 2.7_Deep Learning_Keras - Fatal编程技术网

Keras模型不';不接受输入层

Keras模型不';不接受输入层,r,python-2.7,deep-learning,keras,R,Python 2.7,Deep Learning,Keras,我是一个深入学习的新手,我正在尝试使用Keras在R中建立一个模型。我有20000个32x32x3图像存储在一个阵列中,用于模型训练。当我运行时: model = keras_model_sequential() model %>% layer_input(shape = c(32,32,3)) 我得到以下错误: Error in py_call_impl(callable, dots$args, dots$keywords) : TypeError: int() argument m

我是一个深入学习的新手,我正在尝试使用Keras在R中建立一个模型。我有20000个32x32x3图像存储在一个阵列中,用于模型训练。当我运行时:

model = keras_model_sequential()
model %>% layer_input(shape = c(32,32,3))
我得到以下错误:

Error in py_call_impl(callable, dots$args, dots$keywords) : 
TypeError: int() argument must be a string or a number, not 'Sequential'

Detailed traceback: 
File "/home/abhijit331/.virtualenvs/r-tensorflow/lib/python2.7/site-packages/tensorflow/contrib/keras/python/keras/engine/topology.py", line 1380, in Input
input_tensor=tensor)
File "/home/abhijit331/.virtualenvs/r-tensorflow/lib/python2.7/site-packages/tensorflow/contrib/keras/python/keras/engine/topology.py", line 1287, in __init__
name=self.name)
File "/home/abhijit331/.virtualenvs/r-tensorflow/lib/python2.7/site-packages/tensorflow/contrib/keras/python/keras/backend.py", line 545, in placeholder
x = array_ops.placeholder(dtype, shape=shape, name=name)
File "/home/abhijit331/.virtualenvs/r-tensorflow/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1499, in placeholder
shape = tensor_shape.as_shape(shape)
File "/home/abhijit331/.virtualenvs/r-tensorflow/lib/python2.7/site-packages/tensorflow/python/framework/tensor_shape.py", line 80

有人能帮我找出如何为我的模型设置输入层吗?

当使用顺序API时,您不使用
层输入功能。
您的第一层需要有一个
input\u shape
参数,该参数将充当
layer\u input
。例如:

model %>% 
  layer_dense(units = 32, input_shape = c(784)) %>%
  layer_activation('relu') %>% 
  layer_dense(units = 10) %>% 
  layer_activation('softmax')
使用函数式API时,可以使用
layer\u input
函数。看更多