original_docstring: Positive and negative pair creation.
      Alternates between positive and negative pairs.
      
docstring: Positive and negative pair creation.
  Alternates between positive and negative pairs.
docstring_tokens: Positive and negative pair creation . Alternates between positive and negative pairs .
code: def create_pairs(x, digit_indices):
      '''Positive and negative pair creation.
      Alternates between positive and negative pairs.
      '''
      pairs = []
      labels = []
      num_classes = len(digit_indices)
      #n = min([len(digit_indices[d]) for d in range(num_classes)]) - 1
      for d in range(num_classes):
          n =len(digit_indices[d]) - 1
          if n < 1:
              continue
          for i in range(n):
              z1, z2 = digit_indices[d][i], digit_indices[d][i + 1]
              pairs += [[x[z1], x[z2]]]
              inc = random.randrange(1, num_classes)
              dn = (d + inc) % num_classes
              j = random.randrange(0, len(digit_indices[dn]))
              z1, z2 = digit_indices[d][i], digit_indices[dn][j]
              pairs += [[x[z1], x[z2]]]
              labels += [1, 0]
      return np.array(pairs), np.array(labels)
code_tokens: def create_pairs ( x , digit_indices ) : pairs = [ ] labels = [ ] num_classes = len ( digit_indices ) for d in range ( num_classes ) : n = len ( digit_indices [ d ] ) - 1 if n < 1 : continue for i in range ( n ) : z1 , z2 = digit_indices [ d ] [ i ] , digit_indices [ d ] [ i + 1 ] pairs += [ [ x [ z1 ] , x [ z2 ] ] ] inc = random . randrange ( 1 , num_classes ) dn = ( d + inc ) % num_classes j = random . randrange ( 0 , len ( digit_indices [ dn ] ) ) z1 , z2 = digit_indices [ d ] [ i ] , digit_indices [ dn ] [ j ] pairs += [ [ x [ z1 ] , x [ z2 ] ] ] labels += [ 1 , 0 ] return np . array ( pairs ) , np . array ( labels )
short_docstring: Positive and negative pair creation.
short_docstring_tokens: Positive and negative pair creation .
comment: '''Positive and negative pair creation.
      Alternates between positive and negative pairs.
      '''$SEP$#n = min([len(digit_indices[d]) for d in range(num_classes)]) - 1