Reputation: 182
I am a newbie to Deep Learning, and am trying to build a model in R using Keras. I have 20,000 32x32x3 images stored in an array for model training.When I run:
model = keras_model_sequential()
model %>% layer_input(shape = c(32,32,3))
I get the following error :
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
can anyone help me figure out how to setup an input layer for my model?
Upvotes: 2
Views: 1250
Reputation: 1723
When using Sequential API you don't use the layer_input
function.
Your first layer will need to have an input_shape
argument that will act as layer_input
. For example:
model %>%
layer_dense(units = 32, input_shape = c(784)) %>%
layer_activation('relu') %>%
layer_dense(units = 10) %>%
layer_activation('softmax')
You can use the layer_input
function when using the Functional API. See more here.
Upvotes: 4