code: def test_predict(predictor, data):
      predictions = predictor.predict(data)
  
      assert all(
          len(value) == len(data) for value in predictions.values()
      )
      # Boxes should have shape `(# detections, 4)`.
      assert all(boxes.ndim == 2 for boxes in predictions["pred_boxes"])
      assert all(
          boxes.shape[-1] == 4 for boxes in predictions["pred_boxes"]
      )
      # Labels should have shape `(# detections,)`.
      assert all(
          labels.ndim == 1 for labels in predictions["pred_labels"]
      )
      # Scores should have shape `(# detections,)`.
      assert all(
          scores.ndim == 1 for scores in predictions["pred_scores"]
      )
  
file_path: ray/python/ray/train/tests/test_torch_detection_predictor.py
imports: import numpy
  import pytest
  from torchvision import models
  from ray.air.util.tensor_extensions.utils import create_ragged_ndarray
  from ray.train.torch import TorchDetectionPredictor
label_desc: Use image node_id 2 for calling a global function with example usage: test_predict(predictor, data) without return types