code: def smoke_test_torchvision_resnet50_classify(
      device: str = "cpu",
  ) -> None:
      img = read_image(
          str(SCRIPT_DIR / ".." / "gallery" / "assets" / "dog2.jpg")
      ).to(device)
  
      # Step 1: Initialize model with the best available weights
      weights = ResNet50_Weights.DEFAULT
      model = resnet50(weights=weights, progress=False).to(device)
      model.eval()
  
      # Step 2: Initialize the inference transforms
      preprocess = weights.transforms(
          antialias=(device != "mps")
      )  # antialias not supported on MPS
  
      # Step 3: Apply inference preprocessing transforms
      batch = preprocess(img).unsqueeze(0)
  
      # Step 4: Use the model and print the predicted category
      prediction = model(batch).squeeze(0).softmax(0)
      class_id = prediction.argmax().item()
      score = prediction[class_id].item()
      category_name = weights.meta["categories"][class_id]
      expected_category = "German shepherd"
      print(f"{category_name} ({device}): {100 * score:.1f}%")
      if category_name != expected_category:
          raise RuntimeError(
              f"Failed ResNet50 classify {category_name} Expected: {expected_category}"
          )
  
file_path: vision/test/smoke_test.py
imports: import sys
  from pathlib import Path
  import torch
  import torchvision
  from torchvision.io import decode_jpeg, read_file, read_image
  from torchvision.models import resnet50, ResNet50_Weights
label_desc: Use image node_id 5 for calling a global function with example usage: smoke_test_torchvision_resnet50_classify(device) without return types