是否可以使用TensorFlow的Dataset API对tf.Dataset进行分区? (不是简单的np.array的分区) [英] Is there a way to partition a tf.Dataset with TensorFlow’s Dataset API? (Not a partition of a simple np.array)

查看:115
本文介绍了是否可以使用TensorFlow的Dataset API对tf.Dataset进行分区? (不是简单的np.array的分区)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我检查了文档,但是我找不到方法为了它。我想取消交叉验证,所以我有点需要它。

I checked the doc but I could not find a method for it. I want to de cross validation, so I kind of need it.

请注意,我并不是问如何分割张量,因为我知道TensorFlow提供了一个API为此,已经在另一个问题中得到了回答。我在问如何对tf.Dataset进行分区(这是一个抽象)。

Note that I'm not asking how to split a tensor, as I know that TensorFlow provides an API for that an has been answered in another question. I'm asking on how to partition a tf.Dataset (which is an abstraction).

推荐答案

您可以:

1)使用分片转换将数据集划分为多个分片。请注意,为了获得最佳性能,应该对数据源(例如文件名)进行分片。

1) Use the shard transformation partition the dataset into multiple "shards". Note that for best performance, sharding should be to data sources (e.g. filenames).

2)从TensorFlow 1.12开始,您还可以使用窗口转换以构建数据集的数据集。

2) As of TensorFlow 1.12, you can also use the window transformation to build a dataset of datasets.

这篇关于是否可以使用TensorFlow的Dataset API对tf.Dataset进行分区? (不是简单的np.array的分区)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆