code: def test_indices_ivfpq(self):
      res = faiss.StandardGpuResources()
      d = 128
      nb = 5000
      nlist = 10
      M = 4
      nbits = 8
  
      rs = np.random.RandomState(567)
      xb = rs.rand(nb, d).astype("float32")
      xb_indices_base = np.arange(nb, dtype=np.int64)
  
      # Force values to not be representable in int32
      xb_indices = (xb_indices_base + 4294967296).astype("int64")
  
      config = faiss.GpuIndexIVFPQConfig()
      idx = faiss.GpuIndexIVFPQ(
          res, d, nlist, M, nbits, faiss.METRIC_L2, config
      )
      idx.train(xb)
      idx.add_with_ids(xb, xb_indices)
  
      # invalid k (should be > 0)
      k = -5
      idx.nprobe = 3
      self.assertRaises(AssertionError, idx.search, xb[10:20], k)
  
      # nprobe is unsigned now, so this is caught before reaching C++
      # k = 5
      # idx.nprobe = -3
      # self.assertRaises(RuntimeError, idx.search, xb[10:20], k)
  
      # valid params
      k = 5
      idx.nprobe = 3
      _, I = idx.search(xb[10:20], k)
      self.assertTrue(np.array_equal(xb_indices[10:20], I[:, 0]))
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import math
  import unittest
  import numpy
  import faiss
  from faiss.contrib import datasets
  from faiss.contrib import ivf_tools
  from faiss.contrib.evaluation import knn_intersection_measure
label_desc: Use image node_id 1 for calling the TestInvalidParams obj's underlying member method code with example usage: obj.test_indices_ivfpq() without return types