我已经尝试在分配padded_batch之后改组数据集。我可以从文档中看到Shuffle没有属性(output_shapes)。我想不出另一种方法。
BUFFER_SIZE = 10000
BATCH_SIZE = 64
train_dataset = train_dataset.shuffle(BUFFER_SIZE)
train_dataset = train_dataset.padded_batch(BATCH_SIZE, train_dataset.output_shapes)
test_dataset = test_dataset.padded_batch(BATCH_SIZE, test_dataset.output_shapes)
接收此错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-7-8a10fa01af19> in <module>()
3
4 train_dataset = train_dataset.shuffle(BUFFER_SIZE)
----> 5 train_dataset = train_dataset.padded_batch(BATCH_SIZE, train_dataset.output_shapes)
6
7 test_dataset = test_dataset.padded_batch(BATCH_SIZE, test_dataset.output_shapes)
AttributeError: 'ShuffleDataset' object has no attribute 'output_shapes'
我一直在他们网站上浏览TensorFlow教程。在带有RNN的文本分类练习中,我遇到此错误。我试图进行一些更改,并且还复制了&& ......>
train_dataset = train_dataset.padded_batch(BATCH_SIZE, train_dataset.output_shapes)