tfr.data.parse_from_tf_example
Stay organized with collections
Save and categorize content based on your preferences.
Parse function to convert tf.train.Example
to feature maps.
tfr.data.parse_from_tf_example(
serialized,
context_feature_spec=None,
example_feature_spec=None,
size_feature_name=None,
mask_feature_name=None
)
Args |
serialized
|
(tf.train.Example ) A serialized proto object containing
context and example features.
|
context_feature_spec
|
(dict) A mapping from feature keys to
FixedLenFeature , VarLenFeature or RaggedFeature values for context
in tf.train.Example proto.
|
example_feature_spec
|
(dict) A mapping from feature keys to
FixedLenFeature , VarLenFeature or RaggedFeature values for examples
in tf.train.Example proto.
|
size_feature_name
|
(str) Name of feature for example list sizes. Populates
the feature dictionary with a tf.int32 Tensor of shape [batch_size] for
this feature name. If None, which is default, this feature is not
generated.
|
mask_feature_name
|
(str) Name of feature for example list masks. Populates
the feature dictionary with a tf.bool Tensor of shape [batch_size,
list_size] for this feature name. If None, which is default, this feature
is not generated.
|
Returns |
A mapping from feature keys to Tensor , SparseTensor or RaggedTensor .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-08-18 UTC.
[null,null,["Last updated 2023-08-18 UTC."],[],[],null,["# tfr.data.parse_from_tf_example\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/ranking/blob/v0.5.3/tensorflow_ranking/python/data.py#L1348-L1395) |\n\nParse function to convert [`tf.train.Example`](https://www.tensorflow.org/api_docs/python/tf/train/Example) to feature maps. \n\n tfr.data.parse_from_tf_example(\n serialized,\n context_feature_spec=None,\n example_feature_spec=None,\n size_feature_name=None,\n mask_feature_name=None\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `serialized` | ([`tf.train.Example`](https://www.tensorflow.org/api_docs/python/tf/train/Example)) A serialized proto object containing context and example features. |\n| `context_feature_spec` | (dict) A mapping from feature keys to `FixedLenFeature`, `VarLenFeature` or `RaggedFeature` values for context in [`tf.train.Example`](https://www.tensorflow.org/api_docs/python/tf/train/Example) proto. |\n| `example_feature_spec` | (dict) A mapping from feature keys to `FixedLenFeature`, `VarLenFeature` or `RaggedFeature` values for examples in [`tf.train.Example`](https://www.tensorflow.org/api_docs/python/tf/train/Example) proto. |\n| `size_feature_name` | (str) Name of feature for example list sizes. Populates the feature dictionary with a [`tf.int32`](https://www.tensorflow.org/api_docs/python/tf#int32) Tensor of shape \\[batch_size\\] for this feature name. If None, which is default, this feature is not generated. |\n| `mask_feature_name` | (str) Name of feature for example list masks. Populates the feature dictionary with a [`tf.bool`](https://www.tensorflow.org/api_docs/python/tf#bool) Tensor of shape \\[batch_size, list_size\\] for this feature name. If None, which is default, this feature is not generated. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A mapping from feature keys to `Tensor`, `SparseTensor` or `RaggedTensor`. ||\n\n\u003cbr /\u003e"]]