docstr: Generates a view-sampling problem:
  - 4 source views, 1st/2nd from the first sequence 'seq1', the rest from 'seq2'
  - 3 sets of 3D points from sequences 'seq1', 'seq2', 'seq2' respectively.
      - first 50 points in each batch correctly project to the source views,
          while the remaining 50 do not land in any projection plane.
  - each source view is labeled with image feature tensors of shape 7x100x50,
      where all elements of the n-th tensor are set to `n+1`.
  - the elements of the source view masks are either set to random binary number
      (if `random_masks==True`), or all set to 1 (`random_masks==False`).
  - the source view cameras are uniformly distributed on a unit circle
      in the x-z plane and look at (0,0,0).
docstr_tok: ["Generates","a","view-sampling","problem",":","-","4","source","views",",","1st\/2nd","from","the","first","sequence","'seq1","'",",","the","rest","from","'seq2'","-","3","sets","of","3D","points","from","sequences","'seq1","'",",","'seq2","'",",","'seq2","'","respectively",".","-","first","50","points","in","each","batch","correctly","project","to","the","source","views",",","while","the","remaining","50","do","not","land","in","any","projection","plane",".","-","each","source","view","is","labeled","with","image","feature","tensors","of","shape","7x100x50",",","where","all","elements","of","the","n-th","tensor","are","set","to","`","n+1","`",".","-","the","elements","of","the","source","view","masks","are","either","set","to","random","binary","number","(","if","`","random_masks==True","`",")",",","or","all","set","to","1","(","`","random_masks==False","`",")",".","-","the","source","view","cameras","are","uniformly","distributed","on","a","unit","circle","in","the","x-z","plane","and","look","at","(","0,0,0",")","."]
code: def _init_view_sampler_problem(self, random_masks):
      """
      Generates a view-sampling problem:
      - 4 source views, 1st/2nd from the first sequence 'seq1', the rest from 'seq2'
      - 3 sets of 3D points from sequences 'seq1', 'seq2', 'seq2' respectively.
          - first 50 points in each batch correctly project to the source views,
              while the remaining 50 do not land in any projection plane.
      - each source view is labeled with image feature tensors of shape 7x100x50,
          where all elements of the n-th tensor are set to `n+1`.
      - the elements of the source view masks are either set to random binary number
          (if `random_masks==True`), or all set to 1 (`random_masks==False`).
      - the source view cameras are uniformly distributed on a unit circle
          in the x-z plane and look at (0,0,0).
      """
      seq_id_camera = ["seq1", "seq1", "seq2", "seq2"]
      seq_id_pts = ["seq1", "seq2", "seq2"]
      pts_batch = 3
      n_pts = 100
      n_views = 4
      fdim = 7
      H = 100
      W = 50
  
      # points that land into the projection planes of all cameras
      pts_inside = (
          torch.nn.functional.normalize(
              torch.randn(pts_batch, n_pts // 2, 3, device="cuda"),
              dim=-1,
          )
          * 0.1
      )
  
      # move the outside points far above the scene
      pts_outside = pts_inside.clone()
      pts_outside[:, :, 1] += 1e8
      pts = torch.cat([pts_inside, pts_outside], dim=1)
  
      R, T = pt3d.renderer.look_at_view_transform(
          dist=1.0,
          elev=0.0,
          azim=torch.linspace(0, 360, n_views + 1)[:n_views],
          degrees=True,
          device=pts.device,
      )
      focal_length = R.new_ones(n_views, 2)
      principal_point = R.new_zeros(n_views, 2)
      camera = pt3d.renderer.PerspectiveCameras(
          R=R,
          T=T,
          focal_length=focal_length,
          principal_point=principal_point,
          device=pts.device,
      )
  
      feats_map = (
          torch.arange(n_views, device=pts.device, dtype=pts.dtype) + 1
      )
      feats = {
          "feats": feats_map[:, None, None, None].repeat(1, fdim, H, W)
      }
  
      masks = (
          torch.rand(
              n_views, 1, H, W, device=pts.device, dtype=pts.dtype
          )
          > 0.5
      ).type_as(R)
  
      if not random_masks:
          masks[:] = 1.0
  
      return pts, camera, feats, masks, seq_id_camera, seq_id_pts
  
file_path: pytorch3d/tests/implicitron/test_viewsampling.py
imports: import unittest
  import pytorch3d
  import torch
  from pytorch3d.implicitron.models.view_pooler.view_sampler import ViewSampler
  from pytorch3d.implicitron.tools.config import expand_args_fields
label_desc: Use image node_id 2 for calling the TestViewsampling obj's underlying member method code with example usage: obj._init_view_sampler_problem(random_masks) and returns: pts,  camera,  feats,  masks,  seq_id_camera,  seq_id_pts