C1 W3 Assignment problem with shapes

Hi everybody. I have a problem which I think starts in exercise 3. I have the expected output but I get this error.

Later in exercise 4 I get the expected output but get an error aswell.

Same with exercise 5. Almost the expected output. But also problems with shapes

Same with exercise 6

Does anybody have the solution for this? Thank you in advance!

Hello @Tom_Post and welcome to the DeepLearning community.

Your errors suggest that you are trying to perform an operation between two arrays that cannot be broadcast together because they have different shapes.

The first step in fixing this type of error, you need to make sure that the shapes of the arrays match up so that they can be broadcast together. Here are some possible approaches:

Check the shapes of the arrays: The first step is to make sure that you are working with arrays of the correct shape. You can use the shape attribute of the arrays to check their dimensions. In this case, it seems that one array has shape (2, 2) and the other has shape (2, 5). You may need to reshape one of the arrays to match the shape of the other array. You can use the reshape function to change the shape of an array.

An example of using the NumPy function reshape can look like this

a = np.array([[1, 2], [3, 4]])

# reshape a to have shape (2, 5)
a_reshaped = np.reshape(a, (2, 5))

Let me know if this helps.

Happy learning
Isaak

Thank you Isaak. I changed it with W @ X and it fixed the problem. But in exercise 5 and 6 I do get this error. Any idea what it is?