def compute_targets(self, features):
    'Compute the target token ids and phrase ids.'
    batch_size = tf.shape(features['label_flag'])[0]
    num_objects = tf.shape(features['label_flag'])[1]
    worker_position = self._caption_object_selector(features)
    valid_references = tf.gather(tf.reshape(features['reference'], [(- 1)]), worker_position)
    target_phrase = features['caption_token_id']
    target_phrase = tf.reshape(target_phrase, [(batch_size * num_objects), self._MAX_DECODE_LENGTH])
    valid_target_phrase = tf.gather(target_phrase, worker_position)
    return (valid_target_phrase, valid_references)
Compute the target token ids and phrase ids.
def compute_targets(self, features):
    
    batch_size = tf.shape(features['label_flag'])[0]
    num_objects = tf.shape(features['label_flag'])[1]
    worker_position = self._caption_object_selector(features)
    valid_references = tf.gather(tf.reshape(features['reference'], [(- 1)]), worker_position)
    target_phrase = features['caption_token_id']
    target_phrase = tf.reshape(target_phrase, [(batch_size * num_objects), self._MAX_DECODE_LENGTH])
    valid_target_phrase = tf.gather(target_phrase, worker_position)
    return (valid_target_phrase, valid_references)