Hi, All my values are right, but I’m getting this error below. My output is like a tuple , but is expected to be in a different format wrapped in square brackets. I cannot use a lamba fucntion, since it was not imported at the start. What else can I do? Please guide. Thank you!
"Test failed
Expected value
[‘TensorFlowOpLayer’, [(None, 160, 160, 3)], 0]
does not match the input value:
[‘TFOpLambda’, (None, 160, 160, 3), 0]
AssertionError Traceback (most recent call last)
in
10 [‘Dense’, (None, 1), 1281, ‘linear’]] #linear is the default activation
11
—> 12 comparator(summary(model2), alpaca_summary)
13
14 for layer in summary(model2):
~/work/W2A2/test_utils.py in comparator(learner, instructor)
21 “\n\n does not match the input value: \n\n”,
22 colored(f"{a}", “red”))
—> 23 raise AssertionError(“Error in test”)
24 print(colored(“All tests passed!”, “green”))
25
AssertionError: Error in test
Are you running this on the course website or on your local machine? Here’s a thread from a couple of years ago showing that you can get this error because of mismatching TF versions, which can’t really occur on the course website. Well, unless you manually import a new version, but why would you do that?
1 Like
Ah, makes sense. I’m running it on course website itself. But in a previous task of this assignment before this part, I got another error, for which I upgraded tf version, later when I re-ran the previous task I got module not found error. I tried restarting the kernel, before installing tf, but that didn’t help. So, I installed the tf again. I guess that created the problem. I will try following the thread to see if it helps.
Thank you so much for the prompt response.
It is always a mistake to change the version of TF in the assignments on the actual course website. Please let me know where you thought you had to do that in an earlier assignment.
If you hit a situation where you think you need to do that, you need to step back and consider another solution. It’s very unlikely that doing the manual import is going to work with the grader.
1 Like
I just re-started my kernel, and printed the tf version. It shows 2.3.0 (as mentioned in the threads you specified). Now when I’m running from the start, the first problem is again showing this error below, which was cleared last time, after upgrading the tf…
"AttributeError Traceback (most recent call last)
in
----> 1 augmenter = data_augmenter()
2
3 assert(augmenter.layers[0].name.startswith(‘random_flip’)), “First layer must be RandomFlip”
4 assert augmenter.layers[0].mode == ‘horizontal’, “RadomFlip parameter must be horizontal”
5 assert(augmenter.layers[1].name.startswith(‘random_rotation’)), “Second layer must be RandomRotation”
in data_augmenter()
10
11 data_augmentation = tf.keras.Sequential()
—> 12 data_augmentation.add(tf.keras.layers.RandomFlip(mode=‘horizontal’))
13 data_augmentation.add(tf.keras.layers.RandomRotation(0.2))
14
AttributeError: module ‘tensorflow.keras.layers’ has no attribute ‘RandomFlip’"
Got it. I will note that for future reference. Thank you…
Well, did you look at the “import” cell earlier in the notebook? That is not the version of RandomFlip
they are using.
They imported an experimental version under the name of RandomFlip
, so you shot yourself in the foot by not reading the code and assuming you had to invoke it by the full pathname.
2 Likes
Yeppp! I did use the full path… my bad! Thanks for pointing it. All the errors were cleared.! : )
1 Like
Great!
Just to state the high level point one more time to make sure everyone is clear: if you think you need to update the version of TF in the notebook when running on the course website, you are making a mistake. You need to step back and figure out the mistake, instead of importing a different version.
1 Like