def _select_top_k_scores(scores_in: tf.Tensor, pre_nms_num_detections: int):
    'Selects top_k scores and indices for each class.\n\n  Args:\n    scores_in: A `tf.Tensor` with shape `[batch_size, N, num_classes]`, which\n      stacks class logit outputs on all feature levels. The N is the number of\n      total anchors on all levels. The num_classes is the number of classes\n      predicted by the model.\n    pre_nms_num_detections: Number of candidates before NMS.\n\n  Returns:\n    scores and indices: A `tf.Tensor` with shape\n      `[batch_size, pre_nms_num_detections, num_classes]`.\n  '
    (batch_size, num_anchors, num_class) = scores_in.get_shape().as_list()
    if (batch_size is None):
        batch_size = tf.shape(scores_in)[0]
    scores_trans = tf.transpose(scores_in, perm=[0, 2, 1])
    scores_trans = tf.reshape(scores_trans, [(- 1), num_anchors])
    (top_k_scores, top_k_indices) = tf.nn.top_k(scores_trans, k=pre_nms_num_detections, sorted=True)
    top_k_scores = tf.reshape(top_k_scores, [batch_size, num_class, pre_nms_num_detections])
    top_k_indices = tf.reshape(top_k_indices, [batch_size, num_class, pre_nms_num_detections])
    return (tf.transpose(top_k_scores, [0, 2, 1]), tf.transpose(top_k_indices, [0, 2, 1]))
Selects top_k scores and indices for each class.

Args:
  scores_in: A `tf.Tensor` with shape `[batch_size, N, num_classes]`, which
    stacks class logit outputs on all feature levels. The N is the number of
    total anchors on all levels. The num_classes is the number of classes
    predicted by the model.
  pre_nms_num_detections: Number of candidates before NMS.

Returns:
  scores and indices: A `tf.Tensor` with shape
    `[batch_size, pre_nms_num_detections, num_classes]`.
def _select_top_k_scores(scores_in: tf.Tensor, pre_nms_num_detections: int):
    'Selects top_k scores and indices for each class.\n\n  Args:\n    scores_in: A `tf.Tensor` with shape `[batch_size, N, num_classes]`, which\n      stacks class logit outputs on all feature levels. The N is the number of\n      total anchors on all levels. The num_classes is the number of classes\n      predicted by the model.\n    pre_nms_num_detections: Number of candidates before NMS.\n\n  Returns:\n    scores and indices: A `tf.Tensor` with shape\n      `[batch_size, pre_nms_num_detections, num_classes]`.\n  '
    (batch_size, num_anchors, num_class) = scores_in.get_shape().as_list()
    if (batch_size is None):
        batch_size = tf.shape(scores_in)[0]
    scores_trans = tf.transpose(scores_in, perm=[0, 2, 1])
    scores_trans = tf.reshape(scores_trans, [(- 1), num_anchors])
    (top_k_scores, top_k_indices) = tf.nn.top_k(scores_trans, k=pre_nms_num_detections, sorted=True)
    top_k_scores = tf.reshape(top_k_scores, [batch_size, num_class, pre_nms_num_detections])
    top_k_indices = tf.reshape(top_k_indices, [batch_size, num_class, pre_nms_num_detections])
    return (tf.transpose(top_k_scores, [0, 2, 1]), tf.transpose(top_k_indices, [0, 2, 1]))