tf.contrib.lookup.TextFileIdTableInitializer
Table initializer for string to int64
IDs tables from a text file.
Inherits From: TextFileInitializer
tf.contrib.lookup.TextFileIdTableInitializer(
filename, key_column_index=TextFileIndex.WHOLE_LINE,
value_column_index=TextFileIndex.LINE_NUMBER, vocab_size=None, delimiter='\t',
name='text_file_id_table_init', key_dtype=tf.dtypes.string
)
Args |
filename | The filename of the text file to be used for initialization. The path must be accessible from wherever the graph is initialized (eg. trainer or eval workers). The filename may be a scalar Tensor . |
key_column_index | The column index from the text file to get the key values from. The default is to use the whole line content. |
value_column_index | The column index from the text file to get the value values from. The default is to use the line number, starting from zero. |
vocab_size | The number of elements in the file, if known. |
delimiter | The delimiter to separate fields in a line. |
name | Optional name for the op. |
key_dtype | The key data type. |
Raises |
TypeError | when the filename is empty, or when the table key and value data types do not match the expected data types. |
Attributes |
key_dtype | The expected table key dtype. |
value_dtype | The expected table value dtype. |
Methods
initialize
View source
initialize(
table
)
Initializes the table from a text file.
Args |
table | The table to be initialized. |
Returns |
The operation that initializes the table. |
Raises |
TypeError | when the keys and values data types do not match the table key and value data types. |