Process raw parameters to params used by `gen_parsing_ops`. Args: names: A vector (1-D Tensor) of strings (optional), the names of the serialized protos. dense_defaults: A dict mapping string keys to `Tensor`s. The keys of the dict must match the dense_keys of the feature.
(names, dense_defaults, sparse_keys, sparse_types,
dense_keys, dense_types, dense_shapes)
| 877 | |
| 878 | |
| 879 | def _process_raw_parameters(names, dense_defaults, sparse_keys, sparse_types, |
| 880 | dense_keys, dense_types, dense_shapes): |
| 881 | """Process raw parameters to params used by `gen_parsing_ops`. |
| 882 | |
| 883 | Args: |
| 884 | names: A vector (1-D Tensor) of strings (optional), the names of |
| 885 | the serialized protos. |
| 886 | dense_defaults: A dict mapping string keys to `Tensor`s. |
| 887 | The keys of the dict must match the dense_keys of the feature. |
| 888 | sparse_keys: A list of string keys in the examples' features. |
| 889 | The results for these keys will be returned as `SparseTensor` objects. |
| 890 | sparse_types: A list of `DTypes` of the same length as `sparse_keys`. |
| 891 | Only `tf.float32` (`FloatList`), `tf.int64` (`Int64List`), |
| 892 | and `tf.string` (`BytesList`) are supported. |
| 893 | dense_keys: A list of string keys in the examples' features. |
| 894 | The results for these keys will be returned as `Tensor`s |
| 895 | dense_types: A list of DTypes of the same length as `dense_keys`. |
| 896 | Only `tf.float32` (`FloatList`), `tf.int64` (`Int64List`), |
| 897 | and `tf.string` (`BytesList`) are supported. |
| 898 | dense_shapes: A list of tuples with the same length as `dense_keys`. |
| 899 | The shape of the data for each dense feature referenced by `dense_keys`. |
| 900 | Required for any input tensors identified by `dense_keys`. Must be |
| 901 | either fully defined, or may contain an unknown first dimension. |
| 902 | An unknown first dimension means the feature is treated as having |
| 903 | a variable number of blocks, and the output shape along this dimension |
| 904 | is considered unknown at graph build time. Padding is applied for |
| 905 | minibatch elements smaller than the maximum number of blocks for the |
| 906 | given feature along this dimension. |
| 907 | |
| 908 | Returns: |
| 909 | Tuple of `names`, `dense_defaults_vec`, `sparse_keys`, `sparse_types`, |
| 910 | `dense_keys`, `dense_shapes`. |
| 911 | |
| 912 | Raises: |
| 913 | ValueError: If sparse and dense key sets intersect, or input lengths do not |
| 914 | match up. |
| 915 | """ |
| 916 | names = [] if names is None else names |
| 917 | dense_defaults = collections.OrderedDict( |
| 918 | ) if dense_defaults is None else dense_defaults |
| 919 | sparse_keys = [] if sparse_keys is None else sparse_keys |
| 920 | sparse_types = [] if sparse_types is None else sparse_types |
| 921 | dense_keys = [] if dense_keys is None else dense_keys |
| 922 | dense_types = [] if dense_types is None else dense_types |
| 923 | dense_shapes = ([[]] * len(dense_keys) |
| 924 | if dense_shapes is None else dense_shapes) |
| 925 | |
| 926 | num_dense = len(dense_keys) |
| 927 | num_sparse = len(sparse_keys) |
| 928 | |
| 929 | if len(dense_shapes) != num_dense: |
| 930 | raise ValueError("len(dense_shapes) != len(dense_keys): %d vs. %d" % |
| 931 | (len(dense_shapes), num_dense)) |
| 932 | if len(dense_types) != num_dense: |
| 933 | raise ValueError("len(dense_types) != len(num_dense): %d vs. %d" % |
| 934 | (len(dense_types), num_dense)) |
| 935 | if len(sparse_types) != num_sparse: |
| 936 | raise ValueError("len(sparse_types) != len(sparse_keys): %d vs. %d" % |
no test coverage detected