docstr: Test a textured point cloud is rendered correctly in a non square image.
docstr_tok: ["Test","a","textured","point","cloud","is","rendered","correctly","in","a","non","square","image","."]
code: def test_render_pointcloud(self):
      """
      Test a textured point cloud is rendered correctly in a non square image.
      """
      device = torch.device("cuda:0")
      pointclouds = Pointclouds(
          points=[torus_points * 2.0],
          features=torch.ones_like(torus_points[None, ...]),
      ).to(device)
      R, T = look_at_view_transform(2.7, 0.0, 0.0)
      cameras = FoVPerspectiveCameras(device=device, R=R, T=T)
      raster_settings = PointsRasterizationSettings(
          image_size=(512, 1024), radius=5e-2, points_per_pixel=1
      )
      rasterizer = PointsRasterizer(
          cameras=cameras, raster_settings=raster_settings
      )
      compositor = AlphaCompositor()
      renderer = PointsRenderer(
          rasterizer=rasterizer, compositor=compositor
      )
  
      # Load reference image
      image_ref = load_rgb_image(
          "test_pointcloud_rectangle_image.png", DATA_DIR
      )
  
      for bin_size in [0, None]:
          # Check both naive and coarse to fine produce the same output.
          renderer.rasterizer.raster_settings.bin_size = bin_size
          images = renderer(pointclouds)
          rgb = images[0, ..., :3].squeeze().cpu()
  
          if DEBUG:
              Image.fromarray(
                  (rgb.numpy() * 255).astype(np.uint8)
              ).save(DATA_DIR / "DEBUG_pointcloud_rectangle_image.png")
  
          # NOTE some pixels can be flaky
          cond1 = torch.allclose(rgb, image_ref, atol=0.05)
          self.assertTrue(cond1)
  
imports: import re
  import unittest
  from itertools import product
  import numpy
  import torch
  from PIL import Image
  from pytorch3d.io import load_obj
  from pytorch3d.renderer import BlendParams, FoVPerspectiveCameras, look_at_view_transform, Materials, MeshRasterizer, MeshRenderer, PointLights, RasterizationSettings, SoftPhongShader, SplatterPhongShader, TexturesUV
  from pytorch3d.renderer.mesh.rasterize_meshes import rasterize_meshes, rasterize_meshes_python
  from pytorch3d.renderer.mesh.rasterizer import Fragments
  from pytorch3d.renderer.opengl import MeshRasterizerOpenGL
  from pytorch3d.renderer.points import AlphaCompositor, PointsRasterizationSettings, PointsRasterizer, PointsRenderer
  from pytorch3d.renderer.points.rasterize_points import rasterize_points, rasterize_points_python
  from pytorch3d.renderer.points.rasterizer import PointFragments
  from pytorch3d.structures import Meshes, Pointclouds
  from pytorch3d.transforms.transform3d import Transform3d
  from pytorch3d.utils import torus
  from .common_testing import get_pytorch3d_dir, get_tests_dir, load_rgb_image, TestCaseMixin
label_desc: Use image node_id 7 for calling the TestRasterizeRectangleImagesPointclouds obj's underlying member method code with example usage: obj.test_render_pointcloud() without return types