title: why am I getting warning/error when working with tensorflow (use functional API and not implemented error)
body: <p>I am trying to follow this tutorial but with my data: <a href="https://www.tensorflow.org/tutorials/structured_data/feature_columns" rel="nofollow noreferrer">https://www.tensorflow.org/tutorials/structured_data/feature_columns</a></p>
  <p>All of my data is numerical values.</p>
  <p>when I ran this part of code:</p>
  <pre><code>model.compile(optimizer='adam',
                loss='binary_crossentropy',
                metrics=['accuracy'])
  
  
  history = model.fit(train_ds, validation_data=test_ds, epochs=100, use_multiprocessing=True)
  </code></pre>
  <p>I am getting this type of warning for all of the parameters:</p>
  <pre><code>WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a &lt;class 'dict'&gt; input: {'age': &lt;tf.Tensor 'ExpandDims_8:0' shape=(None, 1) dtype=int64&gt;,
  </code></pre>
  <p>I am getting this warning twice for each variable!</p>
  <p>and then I am getting this error:</p>
  <pre><code>UnimplementedError:  Cast string to float is not supported
   [[node sequential_7/dense_features_7/calprotectin/Cast (defined at &lt;ipython-input-103-5689ba5df442&gt;:5) ]] [Op:__inference_train_function_4860]
  </code></pre>
  <p>What is the problem and how can I fix it?</p>
  <h1>Edit1</h1>
  <p>I tried to mimic my code and error using sample data and I came up with this code.</p>
  <p>The code doesn't generate an error but generates a warning. so the problem is with the data that I am reading. What can go wrong with the input data that generate such an error?</p>
  <p>( it is a jupyter code, how can I post it here?) :</p>
  <pre><code>%reset
  import numpy as np
  import pandas as pd
  import tensorflow as tf
  from tensorflow import keras
  from tensorflow import feature_column
  from sklearn.model_selection import train_test_split
  
  RANDOM_SEED = 42
  
  data=pd.DataFrame()
  data['sex']=[1,2,2,1,2,2,1,1,2,1]
  data['age']=[10,11,13,45,67,34,23,62,82,78]
  data['bmi']=[22.5,28.8,19,23.3,26,18.4,27.5,29,30.3,25.9]
  data['smoker']=[1,2,2,3,3,2,2,1,1,1]
  data['lab1']=[144,124,126,146,130,124,171,147,131,138]
  data['lab2']=[71,82,75,65,56,89,55,74,78,69]
  data['result']=[1,2,2,4,3,2,1,3,2,4]
  
  feature_columns = []
  for header in ['sex','age', 'bmi','smoker', 'lab1', 'lab2']:
    feature_columns.append(tf.feature_column.numeric_column(header))
  
  def create_dataset(dataframe, batch_size=32):
      dataframe = dataframe.copy()
      labels = dataframe.pop('result')
      return tf.data.Dataset.from_tensor_slices((dict(dataframe), labels)) \
        .shuffle(buffer_size=len(dataframe)) \
        .batch(batch_size)
  
  train, test = train_test_split(data, test_size=0.2, random_state=RANDOM_SEED)
  train_ds = create_dataset(train)
  test_ds = create_dataset(test)
  
  model = tf.keras.models.Sequential([
    tf.keras.layers.DenseFeatures(feature_columns=feature_columns),
    tf.keras.layers.Dense(128, activation='relu'),
    tf.keras.layers.Dense(128, activation='relu'),
    tf.keras.layers.Dropout(.1),
    tf.keras.layers.Dense(1)
  ])
  
  model.compile(optimizer='adam',
            loss='binary_crossentropy',
            metrics=['accuracy'])
  
  history = model.fit(train_ds, validation_data=test_ds, epochs=100, use_multiprocessing=True)
  </code></pre>
  <p>when I run the above code, I am getting this warning:</p>
  <pre><code>Epoch 1/100
  WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a &lt;class 'dict'&gt; input: {'sex': &lt;tf.Tensor 'ExpandDims_4:0' shape=(None, 1) dtype=int64&gt;, 'age': &lt;tf.Tensor 'ExpandDims:0' shape=(None, 1) dtype=int64&gt;, 'bmi': &lt;tf.Tensor 'ExpandDims_1:0' shape=(None, 1) dtype=float64&gt;, 'smoker': &lt;tf.Tensor 'ExpandDims_5:0' shape=(None, 1) dtype=int64&gt;, 'lab1': &lt;tf.Tensor 'ExpandDims_2:0' shape=(None, 1) dtype=int64&gt;, 'lab2': &lt;tf.Tensor 'ExpandDims_3:0' shape=(None, 1) dtype=int64&gt;}
  Consider rewriting this model with the Functional API.
  WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a &lt;class 'dict'&gt; input: {'sex': &lt;tf.Tensor 'ExpandDims_4:0' shape=(None, 1) dtype=int64&gt;, 'age': &lt;tf.Tensor 'ExpandDims:0' shape=(None, 1) dtype=int64&gt;, 'bmi': &lt;tf.Tensor 'ExpandDims_1:0' shape=(None, 1) dtype=float64&gt;, 'smoker': &lt;tf.Tensor 'ExpandDims_5:0' shape=(None, 1) dtype=int64&gt;, 'lab1': &lt;tf.Tensor 'ExpandDims_2:0' shape=(None, 1) dtype=int64&gt;, 'lab2': &lt;tf.Tensor 'ExpandDims_3:0' shape=(None, 1) dtype=int64&gt;}
  Consider rewriting this model with the Functional API.
  1/1 [==============================] - ETA: 0s - loss: -22.8739 - accuracy: 0.2500WARNING:tensorflow:Layers in a Sequential model should only have a single input tensor, but we receive a &lt;class 'dict'&gt; input: {'sex': &lt;tf.Tensor 'ExpandDims_4:0' shape=(None, 1) dtype=int64&gt;, 'age': &lt;tf.Tensor 'ExpandDims:0' shape=(None, 1) dtype=int64&gt;, 'bmi': &lt;tf.Tensor 'ExpandDims_1:0' shape=(None, 1) dtype=float64&gt;, 'smoker': &lt;tf.Tensor 'ExpandDims_5:0' shape=(None, 1) dtype=int64&gt;, 'lab1': &lt;tf.Tensor 'ExpandDims_2:0' shape=(None, 1) dtype=int64&gt;, 'lab2': &lt;tf.Tensor 'ExpandDims_3:0' shape=(None, 1) dtype=int64&gt;}
  Consider rewriting this model with the Functional API.
  </code></pre>
  <p>When model fit finished, the accuracy is zero. I know that the data is not valid, bit having an accuracy of zero is also not expected.</p>