code: def test_simple_det(self):
      for n_bins, n_samples, batch in product(
          [7, 20], [2, 7, 31, 32, 33], [(), (1, 4), (31,), (32,), (33,)]
      ):
          weights = torch.rand(size=(batch + (n_bins,)))
          bins = torch.cumsum(
              torch.rand(size=(batch + (n_bins + 1,))), dim=-1
          )
          python = sample_pdf_python(bins, weights, n_samples, det=True)
  
          cpp = sample_pdf(bins, weights, n_samples, det=True)
          self.assertClose(cpp, python, atol=2e-3)
  
          nthreads = torch.get_num_threads()
          torch.set_num_threads(1)
          cpp_singlethread = sample_pdf(
              bins, weights, n_samples, det=True
          )
          self.assertClose(cpp_singlethread, python, atol=2e-3)
          torch.set_num_threads(nthreads)
  
          device = torch.device("cuda:0")
          cuda = sample_pdf(
              bins.to(device), weights.to(device), n_samples, det=True
          ).cpu()
  
          self.assertClose(cuda, python, atol=2e-3)
  
file_path: pytorch3d/tests/test_sample_pdf.py
imports: import unittest
  from itertools import product
  import torch
  from pytorch3d.renderer.implicit.sample_pdf import sample_pdf, sample_pdf_python
  from .common_testing import TestCaseMixin
label_desc: Use image node_id 3 for calling the TestSamplePDF obj's underlying member method code with example usage: obj.test_simple_det() without return types