code: def test_set_return_type():
      img = make_image()
  
      assert type(img + 3) is torch.Tensor
  
      with tv_tensors.set_return_type("TVTensor"):
          assert type(img + 3) is tv_tensors.Image
      assert type(img + 3) is torch.Tensor
  
      tv_tensors.set_return_type("TVTensor")
      assert type(img + 3) is tv_tensors.Image
  
      with tv_tensors.set_return_type("tensor"):
          assert type(img + 3) is torch.Tensor
          with tv_tensors.set_return_type("TVTensor"):
              assert type(img + 3) is tv_tensors.Image
              tv_tensors.set_return_type("tensor")
              assert type(img + 3) is torch.Tensor
          assert type(img + 3) is torch.Tensor
      # Exiting a context manager will restore the return type as it was prior to entering it,
      # regardless of whether the "global" tv_tensors.set_return_type() was called within the context manager.
      assert type(img + 3) is tv_tensors.Image
  
      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 22 for calling a global function with example usage: test_set_return_type() without return types