title: Tensorflow, possible to downweigh gradients for certain data items
body: <p>Say I have a multi output model with outputs y_0 and y_1.
  For some data examples I am confident that y_0 is correct, but know that y_1 may be a complete guess. My idea was to use a custom training loop and multiply by a calculated weight, but this does not seem to be working. Is there a way to do this through the keras api that may be simpler than this?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>            @tf.function
              def train_on_batch(x,y):
  
                  y_true = y[:, 0]
                  weights = y[:,1]
  
                  with tf.GradientTape() as tape:
                      y_pred = model(x, training=True)
                      print("ytrainpred ", y_pred)
                      loss_value_pre = loss(y_true, y_pred)   
                      loss_value = loss_value_pre * weights
  
                  # compute gradient 
                  grads = tape.gradient(loss_value, model.trainable_weights)
  
                  # update weights
                  optimizer.apply_gradients(zip(grads, model.trainable_weights))
  
                  # update metrics
                  loss_1_train.update_state(y_true[:, 0], loss_value[:,0])
                  loss_2_train.update_state(y_true[:, 1], loss_value[:,1)
  
                  return loss_value</code></pre>
  </div>
  </div>
  </p>