class_docstr: A simple scene model to demonstrate use of pulsar in PyTorch modules.
  
  The scene model is parameterized with sphere locations (vert_pos),
  channel content (vert_col), radiuses (vert_rad), camera position (cam_pos),
  camera rotation (cam_rot) and sensor focal length and width (cam_sensor).
  
  The forward method of the model renders this scene description. Any
  of these parameters could instead be passed as inputs to the forward
  method and come from a different model.
class_docstr_tok: ["A","simple","scene","model","to","demonstrate","use","of","pulsar","in","PyTorch","modules",".","The","scene","model","is","parameterized","with","sphere","locations","(","vert_pos",")",",","channel","content","(","vert_col",")",",","radiuses","(","vert_rad",")",",","camera","position","(","cam_pos",")",",","camera","rotation","(","cam_rot",")","and","sensor","focal","length","and","width","(","cam_sensor",")",".","The","forward","method","of","the","model","renders","this","scene","description",".","Any","of","these","parameters","could","instead","be","passed","as","inputs","to","the","forward","method","and","come","from","a","different","model","."]
code: def __init__(self):
      super(SceneModel, self).__init__()
      self.gamma = 1.0
      # Points.
      torch.manual_seed(1)
      vert_pos = torch.rand(N_POINTS, 3, dtype=torch.float32) * 10.0
      vert_pos[:, 2] += 25.0
      vert_pos[:, :2] -= 5.0
      self.register_parameter(
          "vert_pos", nn.Parameter(vert_pos, requires_grad=True)
      )
      self.register_parameter(
          "vert_col",
          nn.Parameter(
              torch.ones(N_POINTS, 3, dtype=torch.float32) * 0.5,
              requires_grad=True,
          ),
      )
      self.register_parameter(
          "vert_rad",
          nn.Parameter(
              torch.ones(N_POINTS, dtype=torch.float32) * 0.3,
              requires_grad=True,
          ),
      )
      self.register_buffer(
          "cam_params",
          torch.tensor(
              [0.0, 0.0, 0.0, 0.0, math.pi, 0.0, 5.0, 2.0],
              dtype=torch.float32,
          ),
      )
      # The volumetric optimization works better with a higher number of tracked
      # intersections per ray.
      self.renderer = Renderer(
          WIDTH, HEIGHT, N_POINTS, n_track=32, right_handed_system=True
      )
  
file_path: pytorch3d/docs/examples/pulsar_optimization.py
imports: import logging
  import math
  import cv2
  import imageio
  import numpy
  import torch
  from pytorch3d.renderer.points.pulsar import Renderer
  from torch import nn, optim
label_desc: Use image node_id 1 to create a new SceneModel object from inherited base classes: nn with example: obj = SceneModel()