tf.data.experimental.at  |  TensorFlow v2.16.1 (original) (raw)

tf.data.experimental.at

Returns the element at a specific index in a datasest.

tf.data.experimental.at(
    dataset, index
)

Currently, random access is supported for the following tf.data operations:

 ds = tfds.load("mnist", split="train").cache()  
 elem = tf.data.Dataset.experimental.at(ds, 3)  
Args
dataset A tf.data.Dataset to determine whether it supports random access.
index The index at which to fetch the element.
Returns
A (nested) structure of values matching tf.data.Dataset.element_spec.
Raises UnimplementedError: If random access is not yet supported for a dataset.

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.