tensorflow - Keras: difference of InputLayer and Input -


i made model using keras tensorflow. use inputlayer these lines of code:

img1 = tf.placeholder(tf.float32, shape=(none, img_width, img_heigh, img_ch)) first_input = inputlayer(input_tensor=img1, input_shape=(img_width, img_heigh, img_ch))  first_dense = conv2d(16, 3, 3, activation='relu', border_mode='same', name='1st_conv1')(first_input) 

but error:

valueerror: layer 1st_conv1 called input isn't symbolic tensor. received type: <class 'keras.engine.topology.inputlayer'>. full input: [<keras.engine.topology.inputlayer object @ 0x00000000112170f0>]. inputs layer should tensors. 

when use input this, works fine:

first_input = input(tensor=img1, shape=(224, 224, 3), name='1st_input') first_dense = conv2d(16, 3, 3, activation='relu', border_mode='same', name='1st_conv1')(first_input) 

what difference between inputlayer , input?

  • inputlayer layer.
  • input tensor.

you can call layers passing tensors them.

the idea is:

outputtensor = somelayer(inputtensor) 

so, input can passed because it's tensor.

honestly, have no idea reason existence of inputlayer. maybe it's supposed used internally. never used it, , seems i'll never need it.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -