(inputs)
return tf.bitcast(or_r2, tf.float32)
Replaces the lower bits of each element with iota.
Replaces the lower bits of each element with iota.
Replaces the lower bits of each element with iota .
def create_make_unique(inputs):
  """Replaces the lower bits of each element with iota."""
  if inputs.shape.ndims != 2:
    raise ValueError("Input of top_k_with_unique must be rank-2 "
                     "but got: %s" % inputs.shape)

  height = inputs.shape[0]
  width = inputs.shape[1]
  zeros = tf.zeros([height, width], dtype=tf.int32)

  log2_ceiling = int(math.ceil(math.log(int(width), 2)))
  next_power_of_two = 1 << log2_ceiling
  count_mask = ~(next_power_of_two - 1)
  count_mask_r0 = tf.constant(count_mask)
  count_mask_r2 = tf.fill([height, width], count_mask_r0)

  smallest_normal = 1 << 23
  smallest_normal_r0 = tf.constant(smallest_normal, dtype=tf.int32)
  smallest_normal_r2 = tf.fill([height, width], smallest_normal_r0)

  low_bit_mask = ~(1 << 31)
  low_bit_mask_r0 = tf.constant(low_bit_mask, dtype=tf.int32)
  low_bit_mask_r2 = tf.fill([height, width], low_bit_mask_r0)

  iota = tf.tile(
      tf.expand_dims(tf.range(width, dtype=tf.int32), 0), [height, 1])

  input_r2 = tf.bitcast(inputs, tf.int32)
  abs_r2 = tf.bitwise.bitwise_and(input_r2, low_bit_mask_r2)
  if_zero_r2 = tf.equal(abs_r2, zeros)
  smallest_normal_preserving_sign_r2 = tf.bitwise.bitwise_or(
      input_r2, smallest_normal_r2)
  input_no_zeros_r2 = tf.where(if_zero_r2, smallest_normal_preserving_sign_r2,
                               input_r2)

  and_r2 = tf.bitwise.bitwise_and(input_no_zeros_r2, count_mask_r2)
  or_r2 = tf.bitwise.bitwise_or(and_r2, iota)
  return tf.bitcast(or_r2, tf.float32)
def create_make_unique ( inputs ) : if inputs . shape . ndims != 2 : raise ValueError ( "Input of top_k_with_unique must be rank-2 " "but got: %s" % inputs . shape ) height = inputs . shape [ 0 ] width = inputs . shape [ 1 ] zeros = tf . zeros ( [ height , width ] , dtype = tf . int32 ) log2_ceiling = int ( math . ceil ( math . log ( int ( width ) , 2 ) ) ) next_power_of_two = 1 << log2_ceiling count_mask = ~ ( next_power_of_two - 1 ) count_mask_r0 = tf . constant ( count_mask ) count_mask_r2 = tf . fill ( [ height , width ] , count_mask_r0 ) smallest_normal = 1 << 23 smallest_normal_r0 = tf . constant ( smallest_normal , dtype = tf . int32 ) smallest_normal_r2 = tf . fill ( [ height , width ] , smallest_normal_r0 ) low_bit_mask = ~ ( 1 << 31 ) low_bit_mask_r0 = tf . constant ( low_bit_mask , dtype = tf . int32 ) low_bit_mask_r2 = tf . fill ( [ height , width ] , low_bit_mask_r0 ) iota = tf . tile ( tf . expand_dims ( tf . range ( width , dtype = tf . int32 ) , 0 ) , [ height , 1 ] ) input_r2 = tf . bitcast ( inputs , tf . int32 ) abs_r2 = tf . bitwise . bitwise_and ( input_r2 , low_bit_mask_r2 ) if_zero_r2 = tf . equal ( abs_r2 , zeros ) smallest_normal_preserving_sign_r2 = tf . bitwise . bitwise_or ( input_r2 , smallest_normal_r2 ) input_no_zeros_r2 = tf . where ( if_zero_r2 , smallest_normal_preserving_sign_r2 , input_r2 ) and_r2 = tf . bitwise . bitwise_and ( input_no_zeros_r2 , count_mask_r2 ) or_r2 = tf . bitwise . bitwise_or ( and_r2 , iota ) return tf . bitcast ( or_r2 , tf . float32 )