tf.contrib.lookup.index_to_string(
tensor,
mapping,
default_value='UNK',
name=None
)
Defined in tensorflow/contrib/lookup/lookup_ops.py
.
Maps tensor
of indices into string values based on mapping
. (deprecated)
This operation converts int64
indices into string values. The mapping is
initialized from a string mapping
tensor where each element is a value and
the corresponding index within the tensor is the key.
Any input which does not have a corresponding index in 'mapping'
(an out-of-vocabulary entry) is assigned the default_value
The underlying table must be initialized by calling
session.run(tf.tables_initializer)
once.
For example:
mapping_string = tf.constant(["emerson", "lake", "palmer"])
indices = tf.constant([1, 5], tf.int64)
values = tf.contrib.lookup.index_to_string(
indices, mapping=mapping_string, default_value="UNKNOWN")
...
tf.tables_initializer().run()
values.eval() ==> ["lake", "UNKNOWN"]
Args:
tensor
: Aint64
Tensor
with the indices to map to strings.mapping
: A 1-D stringTensor
that specifies the strings to map from indices.default_value
: The string value to use for out-of-vocabulary indices.name
: A name for this op (optional).
Returns:
The strings values associated to the indices. The resultant dense
feature value tensor has the same shape as the corresponding indices
.