lmoroney / dlaicourse

Notebooks for learning deep learning
5.66k stars 5.38k forks source link

Update Course 3 - Week 3 - Lesson 1c.ipynb #152

Closed Gargeya-Grey closed 3 months ago

Gargeya-Grey commented 3 years ago

AttributeError: ShuffleObject don't have any output_shapes property.

so instead of using train_dataset.output_shapes and test_dataset.output_shapes, I am using tf.compat.v1.data.get_output_shapes(train_dataset) and same for test_dataset.

lc0 commented 3 years ago

Seems like it also could be fixed without using compat.v1, unfortunately not with more beautiful code 👍

train_dataset = train_dataset_base.shuffle(BUFFER_SIZE)
# train_dataset = train_dataset.padded_batch(BATCH_SIZE, train_dataset.output_shapes)
train_dataset = train_dataset.padded_batch(BATCH_SIZE, tuple(t.shape for t in train_dataset.element_spec))
# test_dataset = test_dataset.padded_batch(BATCH_SIZE, test_dataset.output_shapes)
test_dataset = test_dataset_base.padded_batch(BATCH_SIZE, tuple(t.shape for t in test_dataset_base.element_spec))