(num, num_tokens)
return tf.one_hot(indices, depth=num_tokens)
Makes one hot vectors of size [num, num_tokens].
Makes one hot vectors of size [num, num_tokens].
Makes one hot vectors of size [ num num_tokens ] .
def make_ordered_one_hot_vectors(num, num_tokens):
  """Makes one hot vectors of size [num, num_tokens]."""
  num_repeats = int(np.ceil(num / float(num_tokens)))
  indices = tf.stack([tf.range(num_tokens)] * num_repeats)
  indices = tf.reshape(tf.transpose(indices), [-1])[0:num]
  return tf.one_hot(indices, depth=num_tokens)
def make_ordered_one_hot_vectors ( num , num_tokens ) : num_repeats = int ( np . ceil ( num / float ( num_tokens ) ) ) indices = tf . stack ( [ tf . range ( num_tokens ) ] * num_repeats ) indices = tf . reshape ( tf . transpose ( indices ) , [ - 1 ] ) [ 0 : num ] return tf . one_hot ( indices , depth = num_tokens )