Configuration for parsing a variable-length input feature into a `Tensor`. The resulting `Tensor` of parsing a single `SequenceExample` or `Example` has a static `shape` of `[None] + shape` and the specified `dtype`. The resulting `Tensor` of parsing a `batch_size` many `Example`s has a sta
| 155 | @tf_export("io.FixedLenSequenceFeature", |
| 156 | v1=["io.FixedLenSequenceFeature", "FixedLenSequenceFeature"]) |
| 157 | class FixedLenSequenceFeature(collections.namedtuple( |
| 158 | "FixedLenSequenceFeature", |
| 159 | ["shape", "dtype", "allow_missing", "default_value"])): |
| 160 | """Configuration for parsing a variable-length input feature into a `Tensor`. |
| 161 | |
| 162 | The resulting `Tensor` of parsing a single `SequenceExample` or `Example` has |
| 163 | a static `shape` of `[None] + shape` and the specified `dtype`. |
| 164 | The resulting `Tensor` of parsing a `batch_size` many `Example`s has |
| 165 | a static `shape` of `[batch_size, None] + shape` and the specified `dtype`. |
| 166 | The entries in the `batch` from different `Examples` will be padded with |
| 167 | `default_value` to the maximum length present in the `batch`. |
| 168 | |
| 169 | To treat a sparse input as dense, provide `allow_missing=True`; otherwise, |
| 170 | the parse functions will fail on any examples missing this feature. |
| 171 | |
| 172 | Fields: |
| 173 | shape: Shape of input data for dimension 2 and higher. First dimension is |
| 174 | of variable length `None`. |
| 175 | dtype: Data type of input. |
| 176 | allow_missing: Whether to allow this feature to be missing from a feature |
| 177 | list item. Is available only for parsing `SequenceExample` not for |
| 178 | parsing `Examples`. |
| 179 | default_value: Scalar value to be used to pad multiple `Example`s to their |
| 180 | maximum length. Irrelevant for parsing a single `Example` or |
| 181 | `SequenceExample`. Defaults to "" for dtype string and 0 otherwise |
| 182 | (optional). |
| 183 | """ |
| 184 | |
| 185 | def __new__(cls, shape, dtype, allow_missing=False, default_value=None): |
| 186 | return super(FixedLenSequenceFeature, cls).__new__( |
| 187 | cls, shape, dtype, allow_missing, default_value) |
| 188 | |
| 189 | |
| 190 | def _features_to_raw_params(features, types): |
no outgoing calls
no test coverage detected