Dataset对象报错ValueError: GraphDef cannot be larger than 2GB或Cannot create a tensor proto whose content is larger than 2GB
f.data.Dataset对象在小规模数据集上简洁方便,但是不适用于大数据集,以cifar-10为例,50000张图片加载到内存中,以tf.data.Dataset.from_tensor_slices()方式创建数据集对象,便会报错,根本原因是数组会被转化为 tf.constant() ,占用大量计算图空间。
解决办法:在python部分完成数据集shuffle等操作
PS:https://stackoverflow.com/questions/46207211/tensorflow-dataset-api-causes-graph-size-to-explode