docstr: Generates and returns the triplet indices corresponding to the provided indexes.
  Neighbours are randomly sampled for each row from self.neighbour_matrix and negative
  samples that are not in the neighbour list are generated randomly.
docstr_tok: ["Generates","and","returns","the","triplet","indices","corresponding","to","the","provided","indexes",".","Neighbours","are","randomly","sampled","for","each","row","from","self.neighbour_matrix","and","negative","samples","that","are","not","in","the","neighbour","list","are","generated","randomly","."]
code: def get_triplet_indices(self, anchor_indices):
      """Generates and returns the triplet indices corresponding to the provided indexes.
      Neighbours are randomly sampled for each row from self.neighbour_matrix and negative
      samples that are not in the neighbour list are generated randomly.
      """
  
      neighbour_cands = self.get_all_neighbour_indices(anchor_indices)
      anchor_indices = np.fromiter(
          anchor_indices,
          dtype=self._idx_dtype,
          count=len(anchor_indices),
      )
      try:
          # Auto ragged array creation deprecated in NumPy 1.19, 2019-11-01, will throw error
          neighbour_cands = np.asarray(
              neighbour_cands, dtype=self._idx_dtype
          )
      except ValueError:
          # Handle ragged array with slower, more generic method
          return self.get_triplet_indices_generic(
              anchor_indices, neighbour_cands
          )
  
      # Older numpy versions will autocast to dtype=object instead of raise exception
      # Detect ragged array in this case and handle with generic method
      if neighbour_cands.ndim < 2:
          return self.get_triplet_indices_generic(
              anchor_indices, neighbour_cands
          )
  
      # Non-ragged array - use shape info to randomly select indices all at once
      neighbour_indices = neighbour_cands[
          :, np.random.randint(neighbour_cands.shape[1])
      ]
      negative_indices = self.gen_negative_indices(neighbour_cands)
      return (anchor_indices, neighbour_indices, negative_indices)
  
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 4 for calling the TripletGenerator obj's underlying member method code with example usage: obj.get_triplet_indices(anchor_indices) and returns: anchor_indices,  neighbour_indices,  negative_indices, self, self