multiclasshead 1

multiclasshead

def _my_model_fn(features, labels, mode):
  my_head = tf.estimator.MultiClassHead(n_classes=3)
  logits = tf.keras.Model(...)(features)

Here is what the above code is Doing:
1. The model is defined as a Keras model.
2. The model is called on the features to produce logits.
3. The logits are passed to the head to compute loss, predictions, and metrics.
4. The EstimatorSpec is returned.

Similar Posts