code: def test_boxes_to_tensor(self, shape, device, dtype):
      # quadrilateral with randomized vertices to reflect possible transforms.
      box = Boxes(
          torch.as_tensor(
              [[[2, 2], [2, 3], [1, 3], [1, 2]]],
              device=device,
              dtype=dtype,
          ).view(*shape, 2)
      )
  
      expected_box_xyxy = torch.as_tensor(
          [[1, 2, 3, 4]], device=device, dtype=dtype
      ).view(*shape)
      expected_box_xyxy_plus = torch.as_tensor(
          [[1, 2, 2, 3]], device=device, dtype=dtype
      ).view(*shape)
      expected_box_xywh = torch.as_tensor(
          [[1, 2, 2, 2]], device=device, dtype=dtype
      ).view(*shape)
      expected_vertices = torch.as_tensor(
          [[[1, 2], [3, 2], [3, 4], [1, 4]]], device=device, dtype=dtype
      ).view(*shape, 2)
      expected_vertices_plus = torch.as_tensor(
          [[[1, 2], [2, 2], [2, 3], [1, 3]]], device=device, dtype=dtype
      ).view(*shape, 2)
  
      boxes_xyxy = box.to_tensor(mode="xyxy")
      boxes_xyxy_plus = box.to_tensor(mode="xyxy_plus")
      boxes_xywh = box.to_tensor(mode="xywh")
      boxes_vertices = box.to_tensor(mode="vertices")
      boxes_vertices_plus = box.to_tensor(mode="vertices_plus")
  
      assert boxes_xyxy.shape == expected_box_xyxy.shape
      assert_close(boxes_xyxy, expected_box_xyxy)
  
      assert boxes_xyxy_plus.shape == expected_box_xyxy_plus.shape
      assert_close(boxes_xyxy_plus, expected_box_xyxy_plus)
  
      assert boxes_xywh.shape == expected_box_xywh.shape
      assert_close(boxes_xywh, expected_box_xywh)
  
      assert boxes_vertices.shape == expected_vertices.shape
      assert_close(boxes_vertices, expected_vertices)
  
      assert boxes_vertices_plus.shape == expected_vertices_plus.shape
      assert_close(boxes_vertices_plus, expected_vertices_plus)
  
imports: from functools import partial
  import pytest
  import torch
  from kornia.geometry.boxes import Boxes, Boxes3D
  from kornia.testing import assert_close, gradcheck, tensor_to_gradcheck_var
label_desc: Use image node_id 6 for calling the TestBoxes2D obj's underlying member method code with example usage: obj.test_boxes_to_tensor(shape, device, dtype) without return types