Cannot run the origin code in week2 Residual Networks

In exercise3 ResNet50, run the original code and get the TypeError: ‘Tensor’ object is not callable.

The functions convolutional_block and identity_block take arguments and produce a tensor as the output. You are then treating them as if they are Keras “Layer” functions and trying to invoke the output with (X) as the input. That syntax does not make sense, which is what that error message is telling you.

Also what do you mean by “original code”: that is code you wrote. Note that they give you a “worked example” of how to invoke those functions in the “Stage 2” section of the template code that they gave you for the ResNet50 function. If you have modified that, you can get a clean copy to see what it originally looked like by using the relevant topic on the FAQ Thread.

Update: The code you show for “Stage 2” is not how it originally looked. That is outside the “START HERE/END HERE” blocks and you didn’t need to change it.

1 Like