def _gather_candidates_at_indices(keypoint_candidates, keypoint_scores, indices):
    'Gathers keypoint candidate coordinates and scores at indices.\n\n  Args:\n    keypoint_candidates: a float tensor of shape [batch_size, max_candidates,\n      num_keypoints, 2] with candidate coordinates.\n    keypoint_scores: a float tensor of shape [batch_size, max_candidates,\n      num_keypoints] with keypoint scores.\n    indices: an integer tensor of shape [batch_size, num_indices, num_keypoints]\n      with indices.\n\n  Returns:\n    A tuple with\n    gathered_keypoint_candidates: a float tensor of shape [batch_size,\n      num_indices, num_keypoints, 2] with gathered coordinates.\n    gathered_keypoint_scores: a float tensor of shape [batch_size,\n      num_indices, num_keypoints, 2].\n  '
    keypoint_candidates_transposed = tf.transpose(keypoint_candidates, [0, 2, 1, 3])
    keypoint_scores_transposed = tf.transpose(keypoint_scores, [0, 2, 1])
    nearby_candidate_inds_transposed = tf.transpose(indices, [0, 2, 1])
    nearby_candidate_coords_tranposed = tf.gather(keypoint_candidates_transposed, nearby_candidate_inds_transposed, batch_dims=2)
    nearby_candidate_scores_transposed = tf.gather(keypoint_scores_transposed, nearby_candidate_inds_transposed, batch_dims=2)
    gathered_keypoint_candidates = tf.transpose(nearby_candidate_coords_tranposed, [0, 2, 1, 3])
    gathered_keypoint_scores = tf.transpose(nearby_candidate_scores_transposed, [0, 2, 1])
    return (gathered_keypoint_candidates, gathered_keypoint_scores)
Gathers keypoint candidate coordinates and scores at indices.

Args:
  keypoint_candidates: a float tensor of shape [batch_size, max_candidates,
    num_keypoints, 2] with candidate coordinates.
  keypoint_scores: a float tensor of shape [batch_size, max_candidates,
    num_keypoints] with keypoint scores.
  indices: an integer tensor of shape [batch_size, num_indices, num_keypoints]
    with indices.

Returns:
  A tuple with
  gathered_keypoint_candidates: a float tensor of shape [batch_size,
    num_indices, num_keypoints, 2] with gathered coordinates.
  gathered_keypoint_scores: a float tensor of shape [batch_size,
    num_indices, num_keypoints, 2].
def _gather_candidates_at_indices(keypoint_candidates, keypoint_scores, indices):
    'Gathers keypoint candidate coordinates and scores at indices.\n\n  Args:\n    keypoint_candidates: a float tensor of shape [batch_size, max_candidates,\n      num_keypoints, 2] with candidate coordinates.\n    keypoint_scores: a float tensor of shape [batch_size, max_candidates,\n      num_keypoints] with keypoint scores.\n    indices: an integer tensor of shape [batch_size, num_indices, num_keypoints]\n      with indices.\n\n  Returns:\n    A tuple with\n    gathered_keypoint_candidates: a float tensor of shape [batch_size,\n      num_indices, num_keypoints, 2] with gathered coordinates.\n    gathered_keypoint_scores: a float tensor of shape [batch_size,\n      num_indices, num_keypoints, 2].\n  '
    keypoint_candidates_transposed = tf.transpose(keypoint_candidates, [0, 2, 1, 3])
    keypoint_scores_transposed = tf.transpose(keypoint_scores, [0, 2, 1])
    nearby_candidate_inds_transposed = tf.transpose(indices, [0, 2, 1])
    nearby_candidate_coords_tranposed = tf.gather(keypoint_candidates_transposed, nearby_candidate_inds_transposed, batch_dims=2)
    nearby_candidate_scores_transposed = tf.gather(keypoint_scores_transposed, nearby_candidate_inds_transposed, batch_dims=2)
    gathered_keypoint_candidates = tf.transpose(nearby_candidate_coords_tranposed, [0, 2, 1, 3])
    gathered_keypoint_scores = tf.transpose(nearby_candidate_scores_transposed, [0, 2, 1])
    return (gathered_keypoint_candidates, gathered_keypoint_scores)