Deep Neural Network - Application Assignment

Hello ! I am having hard times with the linear_backward function development in the Deep Neural Network - Application Assignment.

I am getting different types error such as TypeError: ‘int’ object is not subscriptable or cannot unpack non-iterable int.

Could somebody help me please ?
(Sorry for my English, I am French).

{moderator edit - solution code removed}

Hi, Mahaut.

Welcome to the course! You posted this under “General Discussion”, so I moved it to the category DLS Course 1 for you by using the little “edit pencil” on the title.

You mention the “Application Assignment”, but in that one you don’t have to write linear_backward. It is written in the Step by Step exercise and then you just call it in the Application Assignment. Are you really asking about the “Step by Step” exercise? That’s the first one in Week 4.

Note that they gave you this logic in the “template” for that function:

    A_prev, W, b = cache
    m = A_prev.shape[1]

So they’ve been kind enough to extract the three elements of the cache argument and place each one in a separate variable with a nice meaningful name. So you don’t need to reference cache[0] or cache[1] the way you do: just use the variables they gave you. That should make the code a lot more clear.

Once you make that change, please show us an actual error trace that you are getting when you run your code.

Regards,
Paul

You asked a question on the Coursera Forums about getting a fresh copy of a notebook. There are detailed instructions linked from the first topic on the DLS FAQ Thread here on Discourse. The key point is that the “Get Latest Version” procedure will not replace an existing file, so you need to rename your file first. Please see the detailed instructions.