Function as argument in alpaca_model function

Hi folks!

In the second programming assignment of Week 2, the function alpaca_model receives a function as a parameter. The default value for it is “data_augmenter()”

When I try to use the parameter in order to “apply data augmentation to the inputs” the test fails:

x = data_augmentation(inputs)

['Sequential', (None, 160, 160, 3), 0] 

 does not match the input value: 

 ['Sequential', (None, None, 160, None), 0]

But if call the function directly it works just fine:

x = data_augmenter()(inputs)

All tests passed!
['InputLayer', [(None, 160, 160, 3)], 0]
['Sequential', (None, 160, 160, 3), 0]
['TensorFlowOpLayer', [(None, 160, 160, 3)], 0]
['TensorFlowOpLayer', [(None, 160, 160, 3)], 0]
['Functional', (None, 5, 5, 1280), 2257984]
['GlobalAveragePooling2D', (None, 1280), 0]
['Dropout', (None, 1280), 0, 0.2]
['Dense', (None, 1), 1281, 'linear']

What am I missing here?

1 Like

Hi rogeriovazp,

The test is based on model2, which is defined just below the function alpaca_model. model2 takes the global variable data_augmentation as a parameter, which was defined in cell 7, two cells below the function data_augmenter().

Could it be that you made some changes to the function data_augmenter() after having run cell 7, and did not rerun cell 7? That could explain it.

A way to find out is to rerun cell 7 and then try with x = data_augmentation(inputs). You could also try to rerun all cells up to and including the test and see if it passes this time.

3 Likes

That was it! Everything is running smoothly now. Thank you so much!