有没有办法使用 TensorFlow 的数据集 API 对 tf.Dataset 进行分区? [英] Is there a way to partition a tf.Dataset with TensorFlow’s Dataset API?

查看:34
本文介绍了有没有办法使用 TensorFlow 的数据集 API 对 tf.Dataset 进行分区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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 开始,您还可以使用 window 转换以构建数据集的数据集.

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

这篇关于有没有办法使用 TensorFlow 的数据集 API 对 tf.Dataset 进行分区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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