'Create classification targets for each anchor.
Assign a classification target of for each anchor to the matching
groundtruth label that is provided by match.  Anchors that are not matched
to anything are given the target self._unmatched_cls_target
Args:
groundtruth_labels:  a tensor of shape [num_gt_boxes, d_1, ... d_k]
with labels for each of the ground_truth boxes. The subshape
[d_1, ... d_k] can be empty (corresponding to scalar labels).
match: a matcher.Match object that provides a matching between anchors
and groundtruth boxes.
Returns:
cls_targets: a float32 tensor with shape [num_anchors, d_1, d_2 ... d_k],
where the subshape [d_1, ..., d_k] is compatible with groundtruth_labels
which has shape [num_gt_boxes, d_1, d_2, ... d_k].'

def _create_classification_targets(self, groundtruth_labels, match):

    matched_anchor_indices = match.matched_column_indices()
    unmatched_ignored_anchor_indices = match.unmatched_or_ignored_column_indices()
    matched_gt_indices = match.matched_row_indices()
    matched_cls_targets = tf.gather(groundtruth_labels, matched_gt_indices)
    ones = (self._unmatched_cls_target.shape.ndims * [1])
    unmatched_ignored_cls_targets = tf.tile(tf.expand_dims(self._unmatched_cls_target, 0), tf.stack(([tf.size(unmatched_ignored_anchor_indices)] + ones)))
    cls_targets = tf.dynamic_stitch([matched_anchor_indices, unmatched_ignored_anchor_indices], [matched_cls_targets, unmatched_ignored_cls_targets])
    return cls_targets
