W3_A1_Ex-6_backward_propagation [AssertionError: Wrong values for dW1]

Yes, my last theory turns out to be right: you can check by printing A1 and np.tanh(Z1) and you’ll see they are the same for the test case you can see in the notebook, but not for the test case in the file public_tests.py. Here are the first few lines of the test routine:

def backward_propagation_test(target):
    np.random.seed(1)
    X = np.random.randn(3, 7)
    Y = (np.random.randn(1, 7) > 0)
    parameters = {'W1': np.random.randn(9, 3),
         'W2': np.random.randn(1, 9),
         'b1': np.array([[ 0.], [ 0.], [ 0.], [ 0.], [ 0.], [ 0.], [ 0.], [ 0.], [ 0.]]),
         'b2': np.array([[ 0.]])}

    cache = {'A1': np.random.randn(9, 7),
         'A2': np.random.randn(1, 7),
         'Z1': np.random.randn(9, 7),
         'Z2': np.random.randn(1, 7),}

So you can see that there is no mathematical relationship between Z1 and A1 in the cache for that test case. You could argue this is bogus, but why not just use the A1 value? It’s easier (and more efficient at runtime) to write the code that way in any case.