code: def test_unified_inputs_pulsar(self):
      # Test data on different devices.
      for device in [torch.device("cpu"), torch.device("cuda")]:
          sphere_mesh = ico_sphere(1, device)
          verts_padded = sphere_mesh.verts_padded()
          pointclouds = Pointclouds(
              points=verts_padded,
              features=torch.ones_like(verts_padded),
          )
          R, T = look_at_view_transform(2.7, 0.0, 0.0)
          # Test the different camera types.
          for _, cameras in [
              (
                  "fovperspective",
                  FoVPerspectiveCameras(device=device, R=R, T=T),
              ),
              (
                  "fovorthographic",
                  FoVOrthographicCameras(device=device, R=R, T=T),
              ),
              (
                  "perspective",
                  PerspectiveCameras(device=device, R=R, T=T),
              ),
              (
                  "orthographic",
                  OrthographicCameras(device=device, R=R, T=T),
              ),
          ]:
              # Test different ways for image size specification.
              for image_size in (256, (256, 256)):
                  raster_settings = PointsRasterizationSettings(
                      image_size=image_size,
                      radius=5e-2,
                      points_per_pixel=1,
                  )
                  rasterizer = PointsRasterizer(
                      cameras=cameras, raster_settings=raster_settings
                  )
                  # Test that the compositor can be provided. It's value is ignored
                  # so use a dummy.
                  _ = PulsarPointsRenderer(
                      rasterizer=rasterizer, compositor=1
                  ).to(device)
                  # Constructor without compositor.
                  _ = PulsarPointsRenderer(rasterizer=rasterizer).to(
                      device
                  )
                  # Constructor with n_channels.
                  _ = PulsarPointsRenderer(
                      rasterizer=rasterizer, n_channels=3
                  ).to(device)
                  # Constructor with max_num_spheres.
                  renderer = PulsarPointsRenderer(
                      rasterizer=rasterizer, max_num_spheres=1000
                  ).to(device)
                  # Test the forward function.
                  if isinstance(
                      cameras, (PerspectiveCameras, OrthographicCameras)
                  ):
                      # znear and zfar is required in this case.
                      self.assertRaises(
                          ValueError,
                          lambda renderer=renderer, pointclouds=pointclouds: renderer.forward(
                              point_clouds=pointclouds, gamma=(1e-4,)
                          ),
                      )
                      renderer.forward(
                          point_clouds=pointclouds,
                          gamma=(1e-4,),
                          znear=(1.0,),
                          zfar=(2.0,),
                      )
                      # znear and zfar must be batched.
                      self.assertRaises(
                          TypeError,
                          lambda renderer=renderer, pointclouds=pointclouds: renderer.forward(
                              point_clouds=pointclouds,
                              gamma=(1e-4,),
                              znear=1.0,
                              zfar=(2.0,),
                          ),
                      )
                      self.assertRaises(
                          TypeError,
                          lambda renderer=renderer, pointclouds=pointclouds: renderer.forward(
                              point_clouds=pointclouds,
                              gamma=(1e-4,),
                              znear=(1.0,),
                              zfar=2.0,
                          ),
                      )
                  else:
                      # gamma must be batched.
                      self.assertRaises(
                          TypeError,
                          lambda renderer=renderer, pointclouds=pointclouds: renderer.forward(
                              point_clouds=pointclouds, gamma=1e-4
                          ),
                      )
                      renderer.forward(
                          point_clouds=pointclouds, gamma=(1e-4,)
                      )
                      # rasterizer width and height change.
                      renderer.rasterizer.raster_settings.image_size = 0
                      self.assertRaises(
                          ValueError,
                          lambda renderer=renderer, pointclouds=pointclouds: renderer.forward(
                              point_clouds=pointclouds, gamma=(1e-4,)
                          ),
                      )
  
imports: import unittest
  import warnings
  from os import path
  import numpy
  import torch
  from PIL import Image
  from pytorch3d.renderer.cameras import FoVOrthographicCameras, FoVPerspectiveCameras, look_at_view_transform, OrthographicCameras, PerspectiveCameras
  from pytorch3d.renderer.compositing import alpha_composite, norm_weighted_sum
  from pytorch3d.renderer.fisheyecameras import FishEyeCameras
  from pytorch3d.renderer.points import AlphaCompositor, NormWeightedCompositor, PointsRasterizationSettings, PointsRasterizer, PointsRenderer, PulsarPointsRenderer
  from pytorch3d.structures.pointclouds import Pointclouds
  from pytorch3d.utils.ico_sphere import ico_sphere
  from .common_testing import get_pytorch3d_dir, get_tests_dir, load_rgb_image, TestCaseMixin
label_desc: Use image node_id 4 for calling the TestRenderPoints obj's underlying member method code with example usage: obj.test_unified_inputs_pulsar() without return types