Initializes a table from a text file.
tf.raw_ops.InitializeTableFromTextFile( table_handle, filename, key_index, value_index, vocab_size=-1, delimiter='\t', name=None )
It inserts one key-value pair into the table for each line of the file. The key and value is extracted from the whole line content, elements from the split line based on delimiter
or the line number (starting from zero). Where to extract the key and value from a line is specified by key_index
and value_index
.
int64
.string
.delimiter
.Args | |
---|---|
table_handle | A Tensor of type mutable string . Handle to a table which will be initialized. |
filename | A Tensor of type string . Filename of a vocabulary text file. |
key_index | An int that is >= -2 . Column index in a line to get the table key values from. |
value_index | An int that is >= -2 . Column index that represents information of a line to get the table value values from. |
vocab_size | An optional int that is >= -1 . Defaults to -1 . Number of elements of the file, use -1 if unknown. |
delimiter | An optional string . Defaults to "\t" . Delimiter to separate fields in a line. |
name | A name for the operation (optional). |
Returns | |
---|---|
The created Operation. |
© 2020 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/versions/r2.3/api_docs/python/tf/raw_ops/InitializeTableFromTextFile