title: gradient using tf.GradientTape() wrt inputs is None (Tensorflow 2.4)
body: <p>This is my model. Im using Tensorflow 2.4.1.</p>
  <pre><code>model = tf.keras.Sequential([
      tf.keras.layers.Embedding(input_dim=1000,
                                output_dim=64,
                                name='embedding',
                                mask_zero=True),
      tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(32)),
      tf.keras.layers.Dense(16, activation='relu'),
      tf.keras.layers.Dense(4, name='logits')
  ])
  
  metrics = [tf.keras.metrics.SparseCategoricalAccuracy()]
  
  # compile the model
  model.compile(optimizer='adam',
                loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),
                metrics=metrics)
  
  </code></pre>
  <p>when I run the following code, I get <code>None</code> as gradient wrt input.</p>
  <pre><code>def compute_gradients(t, target_class_idx):
      with tf.GradientTape() as tape:
          tape.watch(t)
          logits = model(t)
          probs = tf.nn.softmax(logits, axis=-1)[:, target_class_idx]
      grads = tape.gradient(probs, t)
      return grads
  </code></pre>
  <p>Here is a sample input, and the call</p>
  <pre><code>sample_tensor = tf.random.uniform(shape=(1, 50))
  
  path_gradients = compute_gradients(
      t=sample_tensor,
      target_class_idx=0)
  
  print(path_gradients)
  </code></pre>
  <p><code>None</code></p>
  <p>What am I doing wrong ?</p>
  <p>Thanks</p>