Parses `Example` protos. Args: serialized: A vector (1-D Tensor) of strings, a batch of binary serialized `Example` protos. names: A vector (1-D Tensor) of strings (optional), the names of the serialized protos. sparse_keys: A list of string keys in the examples' features.
(serialized,
names=None,
sparse_keys=None,
sparse_types=None,
dense_keys=None,
dense_types=None,
dense_defaults=None,
dense_shapes=None,
name=None)
| 809 | |
| 810 | |
| 811 | def _parse_example_raw(serialized, |
| 812 | names=None, |
| 813 | sparse_keys=None, |
| 814 | sparse_types=None, |
| 815 | dense_keys=None, |
| 816 | dense_types=None, |
| 817 | dense_defaults=None, |
| 818 | dense_shapes=None, |
| 819 | name=None): |
| 820 | """Parses `Example` protos. |
| 821 | |
| 822 | Args: |
| 823 | serialized: A vector (1-D Tensor) of strings, a batch of binary |
| 824 | serialized `Example` protos. |
| 825 | names: A vector (1-D Tensor) of strings (optional), the names of |
| 826 | the serialized protos. |
| 827 | sparse_keys: A list of string keys in the examples' features. |
| 828 | The results for these keys will be returned as `SparseTensor` objects. |
| 829 | sparse_types: A list of `DTypes` of the same length as `sparse_keys`. |
| 830 | Only `tf.float32` (`FloatList`), `tf.int64` (`Int64List`), |
| 831 | and `tf.string` (`BytesList`) are supported. |
| 832 | dense_keys: A list of string keys in the examples' features. |
| 833 | The results for these keys will be returned as `Tensor`s |
| 834 | dense_types: A list of DTypes of the same length as `dense_keys`. |
| 835 | Only `tf.float32` (`FloatList`), `tf.int64` (`Int64List`), |
| 836 | and `tf.string` (`BytesList`) are supported. |
| 837 | dense_defaults: A dict mapping string keys to `Tensor`s. |
| 838 | The keys of the dict must match the dense_keys of the feature. |
| 839 | dense_shapes: A list of tuples with the same length as `dense_keys`. |
| 840 | The shape of the data for each dense feature referenced by `dense_keys`. |
| 841 | Required for any input tensors identified by `dense_keys`. Must be |
| 842 | either fully defined, or may contain an unknown first dimension. |
| 843 | An unknown first dimension means the feature is treated as having |
| 844 | a variable number of blocks, and the output shape along this dimension |
| 845 | is considered unknown at graph build time. Padding is applied for |
| 846 | minibatch elements smaller than the maximum number of blocks for the |
| 847 | given feature along this dimension. |
| 848 | name: A name for this operation (optional). |
| 849 | |
| 850 | Returns: |
| 851 | A `dict` mapping keys to `Tensor`s and `SparseTensor`s. |
| 852 | |
| 853 | """ |
| 854 | with ops.name_scope(name, "ParseExample", [serialized, names]): |
| 855 | (names, dense_defaults_vec, sparse_keys, sparse_types, |
| 856 | dense_keys, dense_shapes, _) = _process_raw_parameters( |
| 857 | names, dense_defaults, sparse_keys, sparse_types, dense_keys, |
| 858 | dense_types, dense_shapes) |
| 859 | |
| 860 | outputs = gen_parsing_ops.parse_example( |
| 861 | serialized=serialized, |
| 862 | names=names, |
| 863 | dense_defaults=dense_defaults_vec, |
| 864 | sparse_keys=sparse_keys, |
| 865 | sparse_types=sparse_types, |
| 866 | dense_keys=dense_keys, |
| 867 | dense_shapes=dense_shapes, |
| 868 | name=name) |
no test coverage detected