tf.data.experimental.at
Stay organized with collections
Save and categorize content based on your preferences.
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:
tf.data.Dataset.from_tensor_slices
,
tf.data.Dataset.from_tensors
,
tf.data.Dataset.shuffle
,
tf.data.Dataset.batch
,
tf.data.Dataset.shard
,
tf.data.Dataset.map
,
tf.data.Dataset.range
,
tf.data.Dataset.zip
,
tf.data.Dataset.skip
,
tf.data.Dataset.repeat
,
tf.data.Dataset.list_files
,
tf.data.Dataset.SSTableDataset
,
tf.data.Dataset.concatenate
,
tf.data.Dataset.enumerate
,
tf.data.Dataset.parallel_map
,
tf.data.Dataset.prefetch
,
tf.data.Dataset.take
,
tf.data.Dataset.cache
(in-memory only)
Users can use the cache operation to enable random access for any dataset,
even one comprised of transformations which are not on this list.
E.g., to get the third element of a TFDS dataset:
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.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-04-26 UTC."}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[]]