tf.io.FixedLenSequenceFeature
Stay organized with collections
Save and categorize content based on your preferences.
Configuration for parsing a variable-length input feature into a Tensor
.
tf.io.FixedLenSequenceFeature(
shape, dtype, allow_missing=False, default_value=None
)
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 static shape
of [batch_size, None] + shape
and the specified dtype
.
The entries in the batch
from different Examples
will be padded with
default_value
to the maximum length present in the batch
.
To treat a sparse input as dense, provide allow_missing=True
; otherwise,
the parse functions will fail on any examples missing this feature.
Fields |
shape
|
Shape of input data for dimension 2 and higher. First dimension is
of variable length None .
|
dtype
|
Data type of input.
|
allow_missing
|
Whether to allow this feature to be missing from a feature
list item. Is available only for parsing SequenceExample not for
parsing Examples .
|
default_value
|
Scalar value to be used to pad multiple Example s to their
maximum length. Irrelevant for parsing a single Example or
SequenceExample . Defaults to "" for dtype string and 0 otherwise
(optional).
|
Attributes |
shape
|
A namedtuple alias for field number 0
|
dtype
|
A namedtuple alias for field number 1
|
allow_missing
|
A namedtuple alias for field number 2
|
default_value
|
A namedtuple alias for field number 3
|
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. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.io.FixedLenSequenceFeature\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/ops/parsing_config.py#L318-L350) |\n\nConfiguration for parsing a variable-length input feature into a `Tensor`.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.FixedLenSequenceFeature`](https://www.tensorflow.org/api_docs/python/tf/io/FixedLenSequenceFeature), [`tf.compat.v1.io.FixedLenSequenceFeature`](https://www.tensorflow.org/api_docs/python/tf/io/FixedLenSequenceFeature)\n\n\u003cbr /\u003e\n\n tf.io.FixedLenSequenceFeature(\n shape, dtype, allow_missing=False, default_value=None\n )\n\nThe resulting `Tensor` of parsing a single `SequenceExample` or `Example` has\na static `shape` of `[None] + shape` and the specified `dtype`.\nThe resulting `Tensor` of parsing a `batch_size` many `Example`s has\na static `shape` of `[batch_size, None] + shape` and the specified `dtype`.\nThe entries in the `batch` from different `Examples` will be padded with\n`default_value` to the maximum length present in the `batch`.\n\nTo treat a sparse input as dense, provide `allow_missing=True`; otherwise,\nthe parse functions will fail on any examples missing this feature.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Fields ------ ||\n|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `shape` | Shape of input data for dimension 2 and higher. First dimension is of variable length `None`. |\n| `dtype` | Data type of input. |\n| `allow_missing` | Whether to allow this feature to be missing from a feature list item. Is available only for parsing `SequenceExample` not for parsing `Examples`. |\n| `default_value` | Scalar value to be used to pad multiple `Example`s to their maximum length. Irrelevant for parsing a single `Example` or `SequenceExample`. Defaults to \"\" for dtype string and 0 otherwise (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Attributes ---------- ||\n|-----------------|-----------------------------------------|\n| `shape` | A `namedtuple` alias for field number 0 |\n| `dtype` | A `namedtuple` alias for field number 1 |\n| `allow_missing` | A `namedtuple` alias for field number 2 |\n| `default_value` | A `namedtuple` alias for field number 3 |\n\n\u003cbr /\u003e"]]