title: TensorFlow Input Layer automatically converts from float64 to int32?
body: <p>I've been working on a model and I noticed that my input tensors are of datatype <code>tf.float64</code>, however my input layers require <code>tf.int32</code>, however everything works as expected. My question is, does the input layer:</p>
  <pre class="lang-py prettyprint-override"><code>x = tf.keras.layers.Input(shape=(5,), name='in', dtype='int32')
  </code></pre>
  <p>Automatically convert a tensor defined by:</p>
  <pre class="lang-py prettyprint-override"><code>element_spec = ({'in': tf.TensorSpec(shape=16, 5), dtype=tf.float64, name=None)})
  </code></pre>
  <p>Into the correct tensor datatype? Eg from <code>float64</code> to <code>int32</code>?</p>
  <p>The full script is:</p>
  <pre class="lang-py prettyprint-override"><code>import tensorflow as tf
  from transformers import TFAutoModel
  
  bert = TFAutoModel.from_pretrained('bert-base-cased')
  
  input_ids = tf.keras.layers.Input(shape=(512,), name='input_ids', dtype='int32')
  mask = tf.keras.layers.Input(shape=(512,), name='attention_mask', dtype='int32')
  
  embeddings = bert.bert(input_ids, attention_mask=mask)[1]
  x = tf.keras.layers.Dense(1024, activation='relu')(embeddings)
  y = tf.keras.layers.Dense(5, activation='softmax', name='outputs')(x)
  
  model = tf.keras.Model(inputs=[input_ids, mask], outputs=y)
  
  optimizer = tf.keras.optimizers.Adam(lr=1e-5, decay=1e-6)
  loss = tf.keras.losses.CategoricalCrossentropy()
  acc = tf.keras.metrics.CategoricalAccuracy('accuracy')
  
  model.compile(optimizer=optimizer, loss=loss, metrics=[acc])
  
  element_spec = ({'input_ids': tf.TensorSpec(shape=(16, 512), dtype=tf.float64, name=None),
                   'attention_mask': tf.TensorSpec(shape=(16, 512), dtype=tf.float64, name=None)},
                  tf.TensorSpec(shape=(16, 5), dtype=tf.float64, name=None))
  
  train_ds = tf.data.experimental.load('train', element_spec=element_spec)
  val_ds = tf.data.experimental.load('val', element_spec=element_spec)
  
  history = model.fit(
      train_ds,
      validation_data=val_ds,
      epochs=3
  )
  </code></pre>
  <p>When I check the <code>element_spec</code> of the dataset being loaded from file (before it is saved to file) I get:</p>
  <pre class="lang-py prettyprint-override"><code>tf.data.experimental.save(train_ds, 'train')
  tf.data.experimental.save(val_ds, 'val')
  
  print(train_ds.element_spec)
  &gt;&gt; ({'input_ids': TensorSpec(shape=(16, 512), dtype=tf.float64, name=None),
  &gt;&gt;   'attention_mask': TensorSpec(shape=(16, 512), dtype=tf.float64, name=None)},
  &gt;&gt;  TensorSpec(shape=(16, 5), dtype=tf.float64, name=None))
  </code></pre>