docstr: Args:
      logits: torch.Tensor
      pred_boxes: torch.Tensor
  Returns:
      scores: torch.Tensor
      cat_ids: torch.Tensor
      boxes: torch.Tensor
docstr_tok: ["Args",":","logits",":","torch.Tensor","pred_boxes",":","torch.Tensor","Returns",":","scores",":","torch.Tensor","cat_ids",":","torch.Tensor","boxes",":","torch.Tensor"]
code: def get_valid_predictions(self, logits, pred_boxes) -> Tuple:
      """
      Args:
          logits: torch.Tensor
          pred_boxes: torch.Tensor
      Returns:
          scores: torch.Tensor
          cat_ids: torch.Tensor
          boxes: torch.Tensor
      """
      import torch
  
      probs = logits.softmax(-1)
      scores = probs.max(-1).values
      cat_ids = probs.argmax(-1)
      valid_detections = torch.where(
          cat_ids < self.num_categories, 1, 0
      )
      valid_confidences = torch.where(
          scores >= self.confidence_threshold, 1, 0
      )
      valid_mask = valid_detections.logical_and(valid_confidences)
      scores = scores[valid_mask]
      cat_ids = cat_ids[valid_mask]
      boxes = pred_boxes[valid_mask]
      return scores, cat_ids, boxes
  
imports: import logging
  from typing import Any, Dict, List, Optional, Tuple, Union
  import numpy
  import pybboxes.functional
  from sahi.models.base import DetectionModel
  from sahi.prediction import ObjectPrediction
  from sahi.utils.compatibility import fix_full_shape_list, fix_shift_amount_list
  from sahi.utils.import_utils import check_requirements, ensure_package_minimum_version
label_desc: Use image node_id 9 for calling the HuggingfaceDetectionModel obj's underlying member method code with example usage: obj.get_valid_predictions(logits, pred_boxes) and returns: scores,  cat_ids,  boxes