MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / get_structure

Function get_structure

tensorflow/python/data/ops/dataset_ops.py:2215–2233  ·  view source on GitHub ↗

Returns the type specification of an element of a `Dataset` or `Iterator`. Args: dataset_or_iterator: A `tf.data.Dataset` or `tf.data.Iterator`. Returns: A nested structure of `tf.TypeSpec` objects matching the structure of an element of `dataset_or_iterator` and spacifying the typ

(dataset_or_iterator)

Source from the content-addressed store, hash-verified

2213
2214@tf_export("data.experimental.get_structure")
2215def get_structure(dataset_or_iterator):
2216 """Returns the type specification of an element of a `Dataset` or `Iterator`.
2217
2218 Args:
2219 dataset_or_iterator: A `tf.data.Dataset` or `tf.data.Iterator`.
2220
2221 Returns:
2222 A nested structure of `tf.TypeSpec` objects matching the structure of an
2223 element of `dataset_or_iterator` and spacifying the type of individal
2224 components.
2225
2226 Raises:
2227 TypeError: If `dataset_or_iterator` is not a `Dataset` or `Iterator` object.
2228 """
2229 try:
2230 return dataset_or_iterator.element_spec # pylint: disable=protected-access
2231 except AttributeError:
2232 raise TypeError("`dataset_or_iterator` must be a Dataset or Iterator "
2233 "object, but got %s." % type(dataset_or_iterator))
2234
2235
2236@tf_export(v1=["data.get_output_classes"])

Callers 4

get_legacy_output_shapesFunction · 0.85
get_legacy_output_typesFunction · 0.85
__init__Method · 0.85

Calls 1

typeFunction · 0.85

Tested by

no test coverage detected