當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python tf.data.experimental.enumerate_dataset用法及代碼示例

枚舉數據集元素的轉換。 (已棄用)

用法

tf.data.experimental.enumerate_dataset(
    start=0
)

參數

返回

警告:此函數已棄用。它將在未來的版本中刪除。更新說明:使用 tf.data.Dataset.enumerate()

它類似於 python 的 enumerate 。例如:

# NOTE:The following examples use `{ ... }` to represent the
# contents of a dataset.
a = { 1, 2, 3 }
b = { (7, 8), (9, 10) }

# The nested structure of the `datasets` argument determines the
# structure of elements in the resulting dataset.
a.apply(tf.data.experimental.enumerate_dataset(start=5))
=> { (5, 1), (6, 2), (7, 3) }
b.apply(tf.data.experimental.enumerate_dataset())
=> { (0, (7, 8)), (1, (9, 10)) }

相關用法


注:本文由純淨天空篩選整理自tensorflow.org大神的英文原創作品 tf.data.experimental.enumerate_dataset。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。