Skip to content

Instantly share code, notes, and snippets.

@jithinjees
jithinjees / tf_table_lookup.py
Last active March 21, 2024 04:07
tensorflow 2.2 code for using lookup tables
import tensorflow as tf
print('tensorflow version ',tf.__version__)
##tensorflow version = 2.2 (also works with tensorflow 2.1)
##This is a simple sample code to use table lookup in tensorflow using 2 different options
##1st method is a file backed table lookup & 2nd one is based on an in memory list
vocab_path='vocab_test.txt'
model_dir_lookup='model/lookup'