Skip to content

Instantly share code, notes, and snippets.

@hadifar
Created November 12, 2018 21:03
Show Gist options
  • Save hadifar/a7a35a7b36bcf5e3d2de1ff1d30d57df to your computer and use it in GitHub Desktop.
Save hadifar/a7a35a7b36bcf5e3d2de1ff1d30d57df to your computer and use it in GitHub Desktop.
table = tf.contrib.lookup.index_table_from_file(vocabulary_file="vocab.txt", num_oov_buckets=1)
csv_dataset = csv_dataset.map(lambda x, y: (tf.string_split([x]).values, y))
csv_dataset = csv_dataset.map(lambda x, y: (tf.cast(table.lookup(x), tf.int32), y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment