(a)
return more_than_one_vals, indexes_in_a, dups_in_a
Find the duplicated elements in 1-D a tensor.
  Args:
    a: 1-D tensor.
    
  Return:
    more_than_one_vals: duplicated value in a.
    indexes_in_a: duplicated value's index in a.
    dups_in_a: duplicated value with duplicate in a.
Find the duplicated elements in 1-D a tensor.
  Args:
    a: 1-D tensor.
    
  Return:
    more_than_one_vals: duplicated value in a.
    indexes_in_a: duplicated value's index in a.
    dups_in_a: duplicated value with duplicate in a.
Find the duplicated elements in 1 - D a tensor . Args : a : 1 - D tensor . Return : more_than_one_vals : duplicated value in a . indexes_in_a : duplicated value s index in a . dups_in_a : duplicated value with duplicate in a .
def find_dup(a):
  """ Find the duplicated elements in 1-D a tensor.
  Args:
    a: 1-D tensor.
    
  Return:
    more_than_one_vals: duplicated value in a.
    indexes_in_a: duplicated value's index in a.
    dups_in_a: duplicated value with duplicate in a.
  """
  unique_a_vals, unique_idx = tf.unique(a)
  count_a_unique = tf.unsorted_segment_sum(tf.ones_like(a),
                                           unique_idx,
                                           tf.shape(a)[0])

  more_than_one = tf.greater(count_a_unique, 1)
  more_than_one_idx = tf.squeeze(tf.where(more_than_one))
  more_than_one_vals = tf.squeeze(tf.gather(unique_a_vals, more_than_one_idx))

  not_duplicated, _ = tf.setdiff1d(a, more_than_one_vals)
  dups_in_a, indexes_in_a = tf.setdiff1d(a, not_duplicated)

  return more_than_one_vals, indexes_in_a, dups_in_a
def find_dup ( a ) : unique_a_vals , unique_idx = tf . unique ( a ) count_a_unique = tf . unsorted_segment_sum ( tf . ones_like ( a ) , unique_idx , tf . shape ( a ) [ 0 ] ) more_than_one = tf . greater ( count_a_unique , 1 ) more_than_one_idx = tf . squeeze ( tf . where ( more_than_one ) ) more_than_one_vals = tf . squeeze ( tf . gather ( unique_a_vals , more_than_one_idx ) ) not_duplicated , _ = tf . setdiff1d ( a , more_than_one_vals ) dups_in_a , indexes_in_a = tf . setdiff1d ( a , not_duplicated ) return more_than_one_vals , indexes_in_a , dups_in_a