Week 2 Assignment 1 Ex 3 'TensorFlowOpLayer'

I get the following error,

Test failed 
 Expected value 

 ['Add', (None, 15, 15, 256), 0] 

 does not match the input value: 

 ['TensorFlowOpLayer', [(None, 15, 15, 256)], 0]

Any idea of what can it be?


The way you specified the “Add” layer is incorrect. Sorry if it seems like I am simply stating the obvious, but it’s telling you where to look, right?

It’s probably the Add for the shortcut path in the identity_block. You probably just used + instead of calling the Add() function as described on this link.


Thanks, I was having the same problem. Solved!

The order seems to be important: X = Add()([X, X_shortcut]) in both identity_block() and convolutional_block()!

Yes, you can understand why by examining the test code that it is “throwing” with the other order. Even though addition is commutative, they actually check your models by just printing the “summary” of the model and then doing a string compare with the correct one. If you do it in the other order, then the compute graph is different, so the compare fails.

1 Like