docstr: Generate random candidate negative indices until the candidate for every
  row is not present in corresponding row of neighbour_matrix.
docstr_tok: ["Generate","random","candidate","negative","indices","until","the","candidate","for","every","row","is","not","present","in","corresponding","row","of","neighbour_matrix","."]
code: def gen_negative_indices(self, neighbour_matrix):
      """Generate random candidate negative indices until the candidate for every
      row is not present in corresponding row of neighbour_matrix."""
      neighbour_matrix = np.asarray(neighbour_matrix)
      generate_cands = partial(
          np.random.randint, self.X.shape[0], dtype=self._idx_dtype
      )
      cands = generate_cands(size=len(neighbour_matrix))
  
      # Where random cand is present in neighbour row, invalid cand
      invalid_cands = (cands[:, np.newaxis] == neighbour_matrix).any(
          axis=1
      )
      n_invalid = invalid_cands.sum()
      while n_invalid > 0:
          cands[invalid_cands] = generate_cands(size=n_invalid)
          invalid_cands = (
              cands[:, np.newaxis] == neighbour_matrix
          ).any(axis=1)
          n_invalid = invalid_cands.sum()
      return cands
  
imports: from abc import ABC, abstractmethod
  from functools import partial
  import itertools
  import random
  import math
  import numpy
  from tensorflow.keras.utils import Sequence
  from scipy.sparse import issparse
  from ..data import get_uint_ctype
label_desc: Use image node_id 6 for calling the TripletGenerator obj's underlying member method code with example usage: obj.gen_negative_indices(neighbour_matrix) and returns: cands