Course 4, Week 1, Assignment 2, The first argument to `Layer.call` must always be passed

Can anyone guide me as to how to debug this error.


ValueError Traceback (most recent call last)
in
----> 1 happy_model = happyModel()
2 # Print a summary for each layer
3 for layer in summary(happy_model):
4 print(layer)
5

in happyModel()
34 # YOUR CODE STARTS HERE
35
—> 36 tfl.ZeroPadding2D(padding = 3)(input_shape = (64, 64, 3)),
37 tfl.Conv2D(32, (7,7), stride = 1),
38 tfl.BatchNormalization(axis = 3),

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
914 # not to any other argument.
915 # - setting the SavedModel saving spec.
→ 916 inputs, args, kwargs = self._split_out_first_arg(args, kwargs)
917 input_list = nest.flatten(inputs)
918

/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in _split_out_first_arg(self, args, kwargs)
2978 else:
2979 raise ValueError(
→ 2980 ‘The first argument to Layer.call must always be passed.’)
2981 return inputs, args, kwargs
2982

ValueError: The first argument to Layer.call must always be passed.

Fix is tfl.ZeroPadding2D(padding = 3, input_shape = (64, 64, 3))

The reason the solution shown above is the ‘fix’ is that when using the Sequential API input_shape is an (optional) argument to the first layer, and thus needs to be within the parentheses constructing it (the ZeroPadding2D layer in this case.); not provided within a second set of parentheses on its own. This code kind of mixes the Sequential API and Functional API styles in a way the parser didn’t welcome :blush:. Below is a thread providing compare and contrast of the two TF Model APIs: