TextFileStringTableInitializer
Inherits From: TextFileInitializer
Defined in tensorflow/python/ops/lookup_ops.py
.
Table initializer for int64
IDs to string tables from a text file.
key_dtype
The expected table key dtype.
value_dtype
The expected table value dtype.
__init__
__init__( filename, key_column_index=TextFileIndex.LINE_NUMBER, value_column_index=TextFileIndex.WHOLE_LINE, vocab_size=None, delimiter='\t', name='text_file_string_table_init' )
Constructs an initializer for an id-to-string table from a text file.
It populates a table that its key and value types are int64 and string, respectively. It generates one key-value pair per line. The content of the key and value are specified by key_column_index
and value_column_index
.
delimiter
.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 keys from. The default is to use the line number, starting from zero.value_column_index
: The column index from the text file to get the values from. The default is to use the whole line content.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.TypeError
: when the filename is empty, or when the table key and value data types do not match the expected data types.initialize
initialize(table)
Initializes the table from a text file.
table
: The table to be initialized.The operation that initializes the table.
TypeError
: when the keys and values data types do not match the table key and value data types.
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/lookup/TextFileStringTableInitializer