python - TensorFlow 中的嵌套结构是什么?

标签 python tensorflow tensorflow-datasets

查看 tf.data.Datasets 的文档,我看到经常提到“嵌套结构”。那到底是什么意思呢?任何 Python 数据类型都可以被视为嵌套结构(例如,(1,3, (7,6, (0), 5))dict(k=dict(3), 7, 无) 还是特指 TensorFlow 数据类型?

最佳答案

目前支持的结构类型有tupledictnamedtuple

来自 https://www.tensorflow.org/api_docs/python/tf/data/Dataset :

Common Terms: Element: A single output from calling next() on a dataset iterator. Elements may be nested structures containing multiple components. For example, the element (1, (3, "apple")) has one tuple nested in another tuple. The components are 1, 3, and "apple". Component: The leaf in the nested structure of an element.

Supported types: Elements can be nested structures of tuples, named tuples, and dictionaries. Element components can be of any type representable by tf.TypeSpec, including tf.Tensor, tf.data.Dataset, tf.SparseTensor, tf.RaggedTensor, and tf.TensorArray.

关于python - TensorFlow 中的嵌套结构是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59092423/

相关文章:

pandas - 数据集 API 'flat_map' 方法对与 'map' 方法一起使用的相同代码产生错误

python - 扩展分组表格数据的高效算法

python - 如何在谷歌应用程序引擎中启动模块?

python - bool 值的大列表和小列表以及字节数组的相对性能

python - tensorflow/serving - reshape 的输入是一个具有 100 个值的张量,但请求的形状有 10000 个

python-3.x - 将 Keras 生成器转换为 Tensorflow 数据集以训练 Resnet50

python - Dataset.from_tensors 和 Dataset.from_tensor_slices 有什么区别?

python - 从文件夹中选择前 n 个最小的文件

linux - 没有名为 'tensorflow.python.platform' 的模块

tensorflow - keras模型转tpu模型的方法