TypeError: Inputs to a layer should be tensors. Got: last_hidden_state
Author: gumowangfei
Pull request: no

```
def build_model():        
      auto_layer = TFLongformerModel.from_pretrained(PRE_TRAINED_MODEL_NAME, return_dict=False)
    
      context_input_ids = Input(shape=(max_len,), dtype=tf.int32, name="context_input_ids")
      context_attention_mask = Input(shape=(max_len,), dtype=tf.int32, name="context_attention_mask")
      context_position_ids = Input(shape=(max_len,), dtype=tf.int32, name="context_position_ids")
    
      context_sequence_output, context_clf_output = auto_layer(context_input_ids, 
                                                               attention_mask=context_attention_mask,
                                                             token_type_ids=context_position_ids
                                                            )
    
      reponse_input_ids = Input(shape=(max_len,), dtype=tf.int32, name="reponse_input_ids")
      reponse_attention_mask = Input(shape=(max_len,), dtype=tf.int32, name="reponse_attention_mask")
      reponse_position_ids = Input(shape=(max_len,), dtype=tf.int32, name="reponse_position_ids")
    
      reponse_sequence_output, reponse_clf_output = auto_layer(reponse_input_ids, 
                                                               attention_mask=reponse_attention_mask,
                                                               token_type_ids=reponse_position_ids
                                                              )
      cnn_layer_response = Conv1D(
          filters=256,
          kernel_size=3,
          activation='relu',
          # Use 'same' padding so outputs have the same shape as inputs.
          padding='same')
      
      cnn_layer_context = Conv1D(
          filters=256,
          kernel_size=3,
          activation='relu',
          # Use 'same' padding so outputs have the same shape as inputs.
          padding='same')
    
      query_seq_encoding = cnn_layer_response(reponse_sequence_output)
      value_seq_encoding = cnn_layer_context(context_sequence_output)
    
      query_encoding = GlobalAveragePooling1D()(query_seq_encoding)
      value_encoding = GlobalAveragePooling1D()(value_seq_encoding)
    
      aoa_kv_clf_output = AOA()([query_seq_encoding, value_seq_encoding]) # AOA Attention
    
      conc = concatenate([query_encoding, value_encoding, aoa_kv_clf_output])
    
      conc = Dropout(0.2)(conc)
      out = Dense(1, activation='sigmoid')(conc)
      model = Model(inputs=[context_input_ids, context_attention_mask, context_position_ids, reponse_input_ids, reponse_attention_mask, reponse_position_ids], outputs=out)
      return model
```

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-42-fd334eefe081> in <module>()
      1 with strategy.scope():
----> 2   model = build_model()
      3 
      4   METRICS = [
      5       tf.keras.metrics.BinaryAccuracy(),

2 frames
<ipython-input-41-c3d20d15e326> in build_model()
     50 
     51   # Query encoding of shape [batch_size, Tq, filters].
---> 52   query_seq_encoding = cnn_layer_response(reponse_sequence_output)
     53   # Value encoding of shape [batch_size, Tv, filters].
     54   value_seq_encoding = cnn_layer_context(context_sequence_output)

/usr/local/lib/python3.7/dist-packages/keras/engine/base_layer.py in __call__(self, *args, **kwargs)
   1018         training=training_mode):
   1019 
-> 1020       input_spec.assert_input_compatibility(self.input_spec, inputs, self.name)
   1021       if eager:
   1022         call_fn = self.call

/usr/local/lib/python3.7/dist-packages/keras/engine/input_spec.py in assert_input_compatibility(input_spec, inputs, layer_name)
    194     # have a `shape` attribute.
    195     if not hasattr(x, 'shape'):
--> 196       raise TypeError('Inputs to a layer should be tensors. Got: %s' % (x,))
    197 
    198   if len(inputs) != len(input_spec):

TypeError: Inputs to a layer should be tensors. Got: last_hidden_state

Comments:
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md) are likely to be ignored.