C3W2 Q4 of TF Data and Deployment Coursera is Incorrect

Greetings all my name is Richard, I am a fellow TF learner.

In Coursera TF Data and Deployment Specialization, especially in Data Pipelines with TensorFlow Data Services course Week 2 Quiz, I found an incorrect question-answer. Question 4 is

How many validation splits will this code generate?

val_ds = tfds.load(‘mnist:3..’, split = [‘train[{}]:{}]’.format(k/4,(k+40)/4) for k in range(0,400,40)])

And I believe the answer should be “Will throw an Error” because it has an invalid Python format () syntax. Instead of

‘train[{}]:{}]’

It should be

‘train[{:0.0f}:{:0.0f}]’

Because it has 1 excess square bracket closure, which makes it become train[0]:10]. Aside from that, because of fraction/division in the format method, it converts the integer data into float type. I found that TFDS raises an error because it doesn’t accept the float type number, even in TF 2.x. Finally, when I converted it back into integer type, the code run successfully.

Below I attached screenshots of the code and its output I did in Colab.


The first is the original snippet from the Coursera quiz


The second is an edited snippet when I removed the additional “]”


Finally, when I removed the additional “]” and converted the data format from float back into integer.


This is the SS of Coursera quiz C3W2 Q4

Hi @richardso8 and welcome to the community! :wave:

Thank you for reporting this. We will check this question.