class_docstr: Samples a fixed number of pixels within denoted xy bounds uniformly at random.
  For each pixel, a fixed number of points is sampled along its ray at uniformly-spaced
  z-coordinates such that the z-coordinates range between a predefined minimum
  and maximum depth.
  
  For practical purposes, this is similar to MultinomialRaysampler without a mask,
  however sampling at real-valued locations bypassing replacement checks may be faster.
class_docstr_tok: ["Samples","a","fixed","number","of","pixels","within","denoted","xy","bounds","uniformly","at","random",".","For","each","pixel",",","a","fixed","number","of","points","is","sampled","along","its","ray","at","uniformly-spaced","z-coordinates","such","that","the","z-coordinates","range","between","a","predefined","minimum","and","maximum","depth",".","For","practical","purposes",",","this","is","similar","to","MultinomialRaysampler","without","a","mask",",","however","sampling","at","real-valued","locations","bypassing","replacement","checks","may","be","faster","."]
docstr: Args:
      min_x: The smallest x-coordinate of each ray's source pixel.
      max_x: The largest x-coordinate of each ray's source pixel.
      min_y: The smallest y-coordinate of each ray's source pixel.
      max_y: The largest y-coordinate of each ray's source pixel.
      n_rays_per_image: The number of rays randomly sampled in each camera.
          `n_rays_per_image` and `n_rays_total` cannot both be defined.
      n_pts_per_ray: The number of points sampled along each ray.
      min_depth: The minimum depth of each ray-point.
      max_depth: The maximum depth of each ray-point.
      n_rays_total: How many rays in total to sample from the cameras provided. The result
          is as if `n_rays_total_training` cameras were sampled with replacement from the
          cameras provided and for every camera one ray was sampled. If set returns the
          HeterogeneousRayBundle with batch_size=n_rays_total.
          `n_rays_per_image` and `n_rays_total` cannot both be defined.
      unit_directions: whether to normalize direction vectors in ray bundle.
      stratified_sampling: if True, performs stratified sampling in n_pts_per_ray
          bins for each ray; otherwise takes n_pts_per_ray deterministic points
          on each ray with uniform offsets.
docstr_tok: ["Args",":","min_x",":","The","smallest","x-coordinate","of","each","ray","'s","source","pixel",".","max_x",":","The","largest","x-coordinate","of","each","ray","'s","source","pixel",".","min_y",":","The","smallest","y-coordinate","of","each","ray","'s","source","pixel",".","max_y",":","The","largest","y-coordinate","of","each","ray","'s","source","pixel",".","n_rays_per_image",":","The","number","of","rays","randomly","sampled","in","each","camera",".","`","n_rays_per_image","`","and","`","n_rays_total","`","can","not","both","be","defined",".","n_pts_per_ray",":","The","number","of","points","sampled","along","each","ray",".","min_depth",":","The","minimum","depth","of","each","ray-point",".","max_depth",":","The","maximum","depth","of","each","ray-point",".","n_rays_total",":","How","many","rays","in","total","to","sample","from","the","cameras","provided",".","The","result","is","as","if","`","n_rays_total_training","`","cameras","were","sampled","with","replacement","from","the","cameras","provided","and","for","every","camera","one","ray","was","sampled",".","If","set","returns","the","HeterogeneousRayBundle","with","batch_size=n_rays_total",".","`","n_rays_per_image","`","and","`","n_rays_total","`","can","not","both","be","defined",".","unit_directions",":","whether","to","normalize","direction","vectors","in","ray","bundle",".","stratified_sampling",":","if","True",",","performs","stratified","sampling","in","n_pts_per_ray","bins","for","each","ray",";","otherwise","takes","n_pts_per_ray","deterministic","points","on","each","ray","with","uniform","offsets","."]
code: def __init__(
      self,
      min_x: float,
      max_x: float,
      min_y: float,
      max_y: float,
      n_rays_per_image: int,
      n_pts_per_ray: int,
      min_depth: float,
      max_depth: float,
      *,
      n_rays_total: Optional[int] = None,
      unit_directions: bool = False,
      stratified_sampling: bool = False,
  ) -> None:
      """
      Args:
          min_x: The smallest x-coordinate of each ray's source pixel.
          max_x: The largest x-coordinate of each ray's source pixel.
          min_y: The smallest y-coordinate of each ray's source pixel.
          max_y: The largest y-coordinate of each ray's source pixel.
          n_rays_per_image: The number of rays randomly sampled in each camera.
              `n_rays_per_image` and `n_rays_total` cannot both be defined.
          n_pts_per_ray: The number of points sampled along each ray.
          min_depth: The minimum depth of each ray-point.
          max_depth: The maximum depth of each ray-point.
          n_rays_total: How many rays in total to sample from the cameras provided. The result
              is as if `n_rays_total_training` cameras were sampled with replacement from the
              cameras provided and for every camera one ray was sampled. If set returns the
              HeterogeneousRayBundle with batch_size=n_rays_total.
              `n_rays_per_image` and `n_rays_total` cannot both be defined.
          unit_directions: whether to normalize direction vectors in ray bundle.
          stratified_sampling: if True, performs stratified sampling in n_pts_per_ray
              bins for each ray; otherwise takes n_pts_per_ray deterministic points
              on each ray with uniform offsets.
      """
      super().__init__()
      self._min_x = min_x
      self._max_x = max_x
      self._min_y = min_y
      self._max_y = max_y
      self._n_rays_per_image = n_rays_per_image
      self._n_pts_per_ray = n_pts_per_ray
      self._min_depth = min_depth
      self._max_depth = max_depth
      self._n_rays_total = n_rays_total
      self._unit_directions = unit_directions
      self._stratified_sampling = stratified_sampling
  
imports: import warnings
  from typing import Optional, Tuple, Union
  import torch
  from pytorch3d.common.compat import meshgrid_ij
  from pytorch3d.ops import padded_to_packed
  from pytorch3d.renderer.cameras import CamerasBase
  from pytorch3d.renderer.implicit.utils import HeterogeneousRayBundle, RayBundle
  from torch.nn import functional
label_desc: Use image node_id 1 to create a new MonteCarloRaysampler object from inherited base classes: torch.nn with example: obj = MonteCarloRaysampler(min_x, max_x, min_y, max_y, n_rays_per_image, n_pts_per_ray, min_depth, max_depth)