docstr: Checks the corresponding_cameras_alignment function.
docstr_tok: ["Checks","the","corresponding_cameras_alignment","function","."]
code: def test_corresponding_cameras_alignment(self):
      """
      Checks the corresponding_cameras_alignment function.
      """
      device = torch.device("cuda:0")
  
      # try few different random setups
      for _ in range(3):
          for estimate_scale in (True, False):
              # init true alignment transform
              R_align_gt = random_rotations(1, device=device)[0]
              T_align_gt = torch.randn(
                  3, dtype=torch.float32, device=device
              )
  
              # init true scale
              if estimate_scale:
                  s_align_gt = torch.randn(
                      1, dtype=torch.float32, device=device
                  ).exp()
              else:
                  s_align_gt = torch.tensor(
                      1.0, dtype=torch.float32, device=device
                  )
  
              for cam_type in (
                  SfMOrthographicCameras,
                  OpenGLPerspectiveCameras,
                  OpenGLOrthographicCameras,
                  SfMPerspectiveCameras,
              ):
                  # try well-determined and underdetermined cases
                  for batch_size in (10, 4, 3, 2, 1):
                      # get random cameras
                      cameras = init_random_cameras(
                          cam_type, batch_size, random_z=True
                      ).to(device)
                      # try all alignment modes
                      for mode in ("extrinsics", "centers"):
                          # try different noise levels
                          for add_noise in (0.0, 0.01, 1e-4):
                              self._corresponding_cameras_alignment_test_case(
                                  cameras,
                                  R_align_gt,
                                  T_align_gt,
                                  s_align_gt,
                                  estimate_scale,
                                  mode,
                                  add_noise,
                              )
  
file_path: pytorch3d/tests/test_cameras_alignment.py
imports: import unittest
  import numpy
  import torch
  from pytorch3d.ops import corresponding_cameras_alignment
  from pytorch3d.renderer.cameras import OpenGLOrthographicCameras, OpenGLPerspectiveCameras, SfMOrthographicCameras, SfMPerspectiveCameras
  from pytorch3d.transforms.rotation_conversions import random_rotations
  from pytorch3d.transforms.so3 import so3_exp_map, so3_relative_angle
  from .common_testing import TestCaseMixin
  from .test_cameras import init_random_cameras
label_desc: Use image node_id 2 for calling the TestCamerasAlignment obj's underlying member method code with example usage: obj.test_corresponding_cameras_alignment() without return types