code: def test_force_subclass_with_metadata(return_type):
      # Sanity checks for the ops in _FORCE_TORCHFUNCTION_SUBCLASS and tv_tensors with metadata
      # Largely the same as above, we additionally check that the metadata is preserved
      format, canvas_size = "XYXY", (32, 32)
      bbox = tv_tensors.BoundingBoxes(
          [[0, 0, 5, 5], [2, 2, 7, 7]],
          format=format,
          canvas_size=canvas_size,
      )
  
      tv_tensors.set_return_type(return_type)
      bbox = bbox.clone()
      if return_type == "TVTensor":
          assert bbox.format, bbox.canvas_size == (format, canvas_size)
  
      bbox = bbox.to(torch.float64)
      if return_type == "TVTensor":
          assert bbox.format, bbox.canvas_size == (format, canvas_size)
  
      bbox = bbox.detach()
      if return_type == "TVTensor":
          assert bbox.format, bbox.canvas_size == (format, canvas_size)
  
      assert not bbox.requires_grad
      bbox.requires_grad_(True)
      if return_type == "TVTensor":
          assert bbox.format, bbox.canvas_size == (format, canvas_size)
          assert bbox.requires_grad
      tv_tensors.set_return_type("tensor")
  
imports: from copy import deepcopy
  import pytest
  import torch
  from common_utils import assert_equal, make_bounding_boxes, make_image, make_segmentation_mask, make_video
  from PIL import Image
  from torchvision import tv_tensors
label_desc: Use image node_id 14 for calling a global function with example usage: test_force_subclass_with_metadata(return_type) without return types