title: TypeError: Expected float32, but got auto of type 'str'. Tensorflow error , tell me how to fix it?
body: <p>I got <em><strong>TypeError: Expected float32, but got auto of type 'str'.</strong></em> error while fitting the sequential model.
  I checked my inputs both are numpy.ndarray.</p>
  <pre><code>type(xtrain),type(ytrain)
  (numpy.ndarray, numpy.ndarray)
  
  model = tf.keras.Sequential()
  
  model.add(tf.keras.layers.Flatten(input_shape = (28,28)))
  model.add(tf.keras.layers.Dense(32,activation='relu'))
  model.add(tf.keras.layers.Dense(32,activation='relu'))
  model.add(tf.keras.layers.Dense(10,activation=tf.keras.activations.softmax))
  
  model.compile(loss = tf.keras.losses.SparseCategoricalCrossentropy,optimizer = 
      tf.keras.optimizers.Adam(learning_rate=.0001),metrics = ['accuracy'])
  
  model.fit(x =xtrain,y = ytrain,epochs=100)
  
  Epoch 1/100
  </code></pre>
  <hr />
  <p>TypeError                                 Traceback (most recent call last)
   in ()
  ----&gt; 1 model.fit(x =xtrain,y = ytrain,epochs=100)</p>
  <p>1 frames
  /usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in autograph_handler(*args, **kwargs)
  1127           except Exception as e:  # pylint:disable=broad-except
  1128             if hasattr(e, &quot;ag_error_metadata&quot;):
  -&gt; 1129               raise e.ag_error_metadata.to_exception(e)
  1130             else:
  1131               raise</p>
  <p>TypeError: in user code:</p>
  <pre><code>File &quot;/usr/local/lib/python3.7/dist-packages/keras/engine/training.py&quot;, line 878, in train_function  *
      return step_function(self, iterator)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/engine/training.py&quot;, line 867, in step_function  **
      outputs = model.distribute_strategy.run(run_step, args=(data,))
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/engine/training.py&quot;, line 860, in run_step  **
      outputs = model.train_step(data)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/engine/training.py&quot;, line 810, in train_step
      y, y_pred, sample_weight, regularization_losses=self.losses)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/engine/compile_utils.py&quot;, line 201, in __call__
      loss_value = loss_obj(y_t, y_p, sample_weight=sw)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/losses.py&quot;, line 141, in __call__
      losses = call_fn(y_true, y_pred)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/losses.py&quot;, line 245, in call  **
      return ag_fn(y_true, y_pred, **self._fn_kwargs)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/losses.py&quot;, line 752, in __init__  **
      from_logits=from_logits)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/losses.py&quot;, line 227, in __init__
      super().__init__(reduction=reduction, name=name)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/losses.py&quot;, line 88, in __init__
      losses_utils.ReductionV2.validate(reduction)
  File &quot;/usr/local/lib/python3.7/dist-packages/keras/utils/losses_utils.py&quot;, line 82, in validate
      if key not in cls.all():
  
  TypeError: Expected float32, but got auto of type 'str'.
  </code></pre>