def METHOD_NAME(
    self,
    input_ray_bundle: ImplicitronRayBundle,
    ray_weights: torch.Tensor,
    blurpool_weights: bool = False,
    sample_pdf_padding: float = 1e-5,
    **kwargs,
) -> ImplicitronRayBundle:
    """
    Args:
        input_ray_bundle: An instance of `ImplicitronRayBundle` specifying the
            source rays for sampling of the probability distribution.
        ray_weights: A tensor of shape
            `(..., input_ray_bundle.lengths.shape[-1])` with non-negative
            elements defining the probability distribution to sample
            ray points from.
        blurpool_weights: Use blurpool defined in [1], on the input weights.
        sample_pdf_padding: A constant preventing division by zero in case empty bins
            are present.
    Returns:
        ray_bundle: A new `ImplicitronRayBundle` instance containing the input ray
            points together with `n_pts_per_ray` additionally sampled
            points per ray. For each ray, the lengths are sorted.
    References:
        [1] Jonathan T. Barron, et al. "Mip-NeRF: A Multiscale Representation
            for Anti-Aliasing Neural Radiance Fields." ICCV 2021.
    """
    with torch.no_grad():
        if self.blurpool_weights:
            ray_weights = apply_blurpool_on_weights(ray_weights)
        n_pts_per_ray = self.n_pts_per_ray
        ray_weights = ray_weights.view(-1, ray_weights.shape[-1])
        if input_ray_bundle.bins is None:
            z_vals: torch.Tensor = input_ray_bundle.lengths
            ray_weights = ray_weights[..., 1:-1]
            bins = torch.lerp(z_vals[..., 1:], z_vals[..., :-1], 0.5)
        else:
            z_vals = input_ray_bundle.bins
            n_pts_per_ray += 1
            bins = z_vals
        z_samples = sample_pdf(
            bins.view(-1, bins.shape[-1]),
            ray_weights,
            n_pts_per_ray,
            det=not self.random_sampling,
            eps=self.sample_pdf_eps,
        ).view(*z_vals.shape[:-1], n_pts_per_ray)
    if self.add_input_samples:
        z_vals = torch.cat((z_vals, z_samples), dim=-1)
    else:
        z_vals = z_samples
    # Resort by depth.
    z_vals, _ = torch.sort(z_vals, dim=-1)
    ray_bundle = copy.copy(input_ray_bundle)
    if input_ray_bundle.bins is None:
        ray_bundle.lengths = z_vals
    else:
        ray_bundle.bins = z_vals
    return ray_bundle