Skip to content

AttributeError: 'ShuffleDataset' object has no attribute 'output_shapes' #1278

Description

@zaabek

Text classification with an RNN with the tutorial:
https://www.tensorflow.org/tutorials/text/text_classification_rnn
Description of the bug.

Environment information

  • Operating System: Windows 8.1
  • Python version: 3.6.4
  • tensorflow-datasets/tfds-nightly version: 1.3.2
  • tensorflow/tensorflow-gpu/tf-nightly/tf-nightly-gpu version: <2.0.0

Reproduction instructions

from __future__ import absolute_import, division, print_function, unicode_literals
import tensorflow_datasets as tfds
import tensorflow as tf

dataset, info = tfds.load('imdb_reviews/subwords8k', with_info=True, as_supervised=True)
train_dataset, test_dataset = dataset['train'], dataset['test']

encoder = info.features['text'].encoder

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)

Link to logs
2019-12-08 17:20:18.271202: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Traceback (most recent call last):
File "C:/Users/Oskar/Desktop/Twitter/analiza/main1.py", line 51, in
train_dataset = train_dataset.padded_batch(BATCH_SIZE, train_dataset.output_shapes)
AttributeError: 'ShuffleDataset' object has no attribute 'output_shapes'

Expected behavior
Should go run the above code without any error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions