title: Tensor conversion requested dtype string for Tensor with dtype float32 (lambda input)
body: <p>I am using Keras' Lambda layer with TensorFlow Hub to download word embeddings from a pre-built embedder.</p>
  
  <pre><code>import tensorflow_hub as hub
  from tensorflow.dtypes import as_string
  def embedding(x):
      print(x.shape)
      module = hub.Module("https://tfhub.dev/google/nnlm-en-dim128/1")
      return module(x)
  answers_network_rnn = Sequential()
  print(trainingData["question"].shape)
  answers_network_rnn.add(Lambda(embedding,output_shape=(128,)))
  answers_network_rnn.add(Dense(16))
  answers_network_rnn.add(Dense(Y_2_train_num.shape[1]))
  answers_network_rnn.summary()
  answers_network_rnn.compile("adam","categorical_crossentropy",metrics=['accuracy',f1]) answers_network_rnn_checkpoint = ModelCheckpoint('answers_network-rnn-best.h5', verbose=1, monitor='val_f1',save_best_only=True, mode='auto') answers_network_rnn.fit(x=X_2_train_text.values,y=Y_2_train_num) 
  </code></pre>
  
  <p>I expect Keras to have built a model with a list of 128 word embeddings for each word in my inputs. In reality, the Lambda layer causes the following error when it runs on the "embedding" function.</p>
  
  <p>"ValueError: Tensor conversion requested dtype string for Tensor with dtype float32: 'Tensor("sequential_5_input:0", shape=(?, 2), dtype=float32)'"</p>
  
  <p>According to user nuric on a GitHub issue (<a href="https://github.com/keras-team/keras/issues/10021" rel="nofollow noreferrer">https://github.com/keras-team/keras/issues/10021</a>) this problem is caused by Keras attempting to infer the output shape. As you can see, I have attempted to resolve this issue by specifying the desired output shape.</p>
  
  <p>Here's the input and desired output for the neural network:</p>
  
  <p><strong>Input</strong></p>
  
  <pre><code>[['to whom did the virgin mary allegedly appear in 1858 in lourdes france?'
    'architecturally, the school has a catholic character. atop the main building\'s gold dome is a golden statue of the virgin mary. immediately in front of the main building and facing it, is a copper statue of christ with arms upraised with the legend "venite ad me omnes". next to the main building is the basilica of the sacred heart. immediately behind the basilica is the grotto, a marian place of prayer and reflection. it is a replica of the grotto at lourdes, france where the virgin mary reputedly appeared to saint bernadette soubirous in 1858. at the end of the main drive (and in a direct line that connects through 3 statues and the gold dome), is a simple, modern stone statue of mary.']
   ['what is in front of the notre dame main building?'
    'architecturally, the school has a catholic character. atop the main building\'s gold dome is a golden statue of the virgin mary. immediately in front of the main building and facing it, is a copper statue of christ with arms upraised with the legend "venite ad me omnes". next to the main building is the basilica of the sacred heart. immediately behind the basilica is the grotto, a marian place of prayer and reflection. it is a replica of the grotto at lourdes, france where the virgin mary reputedly appeared to saint bernadette soubirous in 1858. at the end of the main drive (and in a direct line that connects through 3 statues and the gold dome), is a simple, modern stone statue of mary.']
   ['the basilica of the sacred heart at notre dame is beside to which structure?'
    'architecturally, the school has a catholic character. atop the main building\'s gold dome is a golden statue of the virgin mary. immediately in front of the main building and facing it, is a copper statue of christ with arms upraised with the legend "venite ad me omnes". next to the main building is the basilica of the sacred heart. immediately behind the basilica is the grotto, a marian place of prayer and reflection. it is a replica of the grotto at lourdes, france where the virgin mary reputedly appeared to saint bernadette soubirous in 1858. at the end of the main drive (and in a direct line that connects through 3 statues and the gold dome), is a simple, modern stone statue of mary.']
  </code></pre>
  
  <p><strong>Desired output:</strong></p>
  
  <pre><code>[[0. 0. 0. ... 0. 0. 0.]
   [0. 0. 0. ... 0. 0. 0.]
   [0. 0. 0. ... 0. 0. 0.]
   ...
   [0. 0. 0. ... 0. 0. 0.]
   [0. 0. 0. ... 0. 0. 0.]
   [1. 0. 0. ... 0. 0. 0.]]
  </code></pre>