docstr: Test that when cameras are passed in as a kwarg the rendering
  works as expected
docstr_tok: ["Test","that","when","cameras","are","passed","in","as","a","kwarg","the","rendering","works","as","expected"]
code: def test_cameras_kwarg(self):
      """
      Test that when cameras are passed in as a kwarg the rendering
      works as expected
      """
      device = torch.device("cuda:0")
  
      # Init mesh
      sphere_mesh = ico_sphere(5, device)
      verts_padded = sphere_mesh.verts_padded()
      faces_padded = sphere_mesh.faces_padded()
      feats = torch.ones_like(verts_padded, device=device)
      textures = TexturesVertex(verts_features=feats)
      sphere_mesh = Meshes(
          verts=verts_padded, faces=faces_padded, textures=textures
      )
  
      # No elevation or azimuth rotation
      rasterizer_tests = [
          RasterizerTest(
              MeshRasterizer, HardPhongShader, "phong", "hard_phong"
          ),
          RasterizerTest(
              MeshRasterizerOpenGL,
              SplatterPhongShader,
              "splatter",
              "splatter_phong",
          ),
      ]
      R, T = look_at_view_transform(2.7, 0.0, 0.0)
      for cam_type in (
          FoVPerspectiveCameras,
          FoVOrthographicCameras,
          PerspectiveCameras,
          OrthographicCameras,
      ):
          for test in rasterizer_tests:
              if (
                  test.rasterizer == MeshRasterizerOpenGL
                  and cam_type
                  in [
                      PerspectiveCameras,
                      OrthographicCameras,
                  ]
              ):
                  # MeshRasterizerOpenGL only works with FoV cameras.
                  continue
  
              cameras = cam_type(device=device, R=R, T=T)
  
              # Init shader settings
              materials = Materials(device=device)
              lights = PointLights(device=device)
              lights.location = torch.tensor(
                  [0.0, 0.0, +2.0], device=device
              )[None]
  
              raster_settings = RasterizationSettings(
                  image_size=512, blur_radius=0.0, faces_per_pixel=1
              )
              rasterizer = test.rasterizer(
                  raster_settings=raster_settings
              )
              blend_params = BlendParams(0.5, 1e-4, (0, 0, 0))
              shader = test.shader(
                  lights=lights,
                  materials=materials,
                  blend_params=blend_params,
              )
              renderer = MeshRenderer(
                  rasterizer=rasterizer, shader=shader
              )
  
              # Cameras can be passed into the renderer in the forward pass
              images = renderer(sphere_mesh, cameras=cameras)
              rgb = images.squeeze()[..., :3].cpu().numpy()
              image_ref = load_rgb_image(
                  f"test_simple_sphere_light_{test.reference_name}_{cam_type.__name__}.png",
                  DATA_DIR,
              )
              self.assertClose(rgb, image_ref, atol=0.05)
  
imports: import os
  import unittest
  from collections import namedtuple
  from itertools import product
  import numpy
  import torch
  from PIL import Image
  from pytorch3d.io import load_obj, load_objs_as_meshes
  from pytorch3d.renderer import AmbientLights, FoVOrthographicCameras, FoVPerspectiveCameras, look_at_view_transform, Materials, MeshRasterizer, MeshRenderer, MeshRendererWithFragments, OrthographicCameras, PerspectiveCameras, PointLights, RasterizationSettings, TexturesAtlas, TexturesUV, TexturesVertex
  from pytorch3d.renderer.fisheyecameras import FishEyeCameras
  from pytorch3d.renderer.mesh.shader import BlendParams, HardFlatShader, HardGouraudShader, HardPhongShader, SoftPhongShader, SoftSilhouetteShader, SplatterPhongShader, TexturedSoftPhongShader
  from pytorch3d.renderer.opengl import MeshRasterizerOpenGL
  from pytorch3d.structures.meshes import join_meshes_as_batch, join_meshes_as_scene, Meshes
  from pytorch3d.utils.ico_sphere import ico_sphere
  from pytorch3d.utils.torus import torus
  from .common_testing import get_pytorch3d_dir, get_tests_dir, load_rgb_image, TestCaseMixin
label_desc: Use image node_id 32 for calling the TestRenderMeshes obj's underlying member method code with example usage: obj.test_cameras_kwarg() without return types