Week 4 Assignment 2 - exercise 1

I believe I am writing the correct code but i keep getting this error:

AttributeError: ‘str’ object has no attribute 'dot’

this refers to the previous assignments linear_forward function which we implemented Z. it says the equation used is Z = W.dot(A) + b (which is why i get this error?), but when i go to the assignment and see what is being used it is actually Z = np.dot(W,A)+b.

Not sure if this happened to any one else but any help would be appreciated.
Thanks in advance.

Hi @km123, I am not sure in which function where you are getting the error you mentioned. In case you have an ndarray the two syntax are equivalent:

I have verified that in the linear_forward function of the assignment it is possible to use both ways.
Hope this helps

1 Like

The error indicates you are trying to use the dot function with a variable which is a string, obvioulsy that won’t work. Please check you are using the right variable.

In any case, are you sure this error is happening in week 4 assignment 2 exercise 1 (course 1)? I think the reference may be wrong because that exercise doesn’t involve any dot operation.