Hi, having trouble with exercises 2 and 6.
Here’s my challenge in 2 …
GRADED FUNCTION: layer_sizes
def layer_sizes(X, Y):
“”"
Arguments:
X – input dataset of shape (input size, number of examples)
Y – labels of shape (output size, number of examples)
Returns:
n_x -- the size of the input layer
n_y -- the size of the output layer
"""
### START CODE HERE ### (~ 2 lines of code)
# Size of input layer.
n_x = np.size(X[0][0])
# Size of output layer.
n_y = np.size(Y[0][0])
### END CODE HERE ###
return (n_x, n_y)
Here’s my graded result:
Wrong size of the input layer n_x for the test case, where array X has a shape (5, 100).
Expected: 5.
Got: 1.
Wrong size of the output layer n_y for the test case, where array Y has a shape (3, 100).
Expected: 3.
Got: 1.
2 Tests passed
2 Tests failed
Here’s my challenge in 6 …
I’e input this code as required:
START CODE HERE ### (~ 1 line of code)
parameters_multi = nn_model(X_multi_norm, Y_multi_norm, num_iterations=100, print_cost=True)
END CODE HERE
print("W = " + str(parameters_multi[“W”]))
print("b = " + str(parameters_multi[“b”]))
W_multi = parameters_multi[“W”]
b_multi = parameters_multi[“b”]
But this is the error I;m getting:
ValueError Traceback (most recent call last)
in
1 ### START CODE HERE ### (~ 1 line of code)
----> 2 parameters_multi = nn_model(X_multi_norm, Y_multi_norm, num_iterations=100, print_cost=True)
3 ### END CODE HERE ###
4
5 print("W = " + str(parameters_multi[“W”]))
in nn_model(X, Y, num_iterations, print_cost)
27 ### START CODE HERE ### (~ 2 lines of code)
28 # Forward propagation. Inputs: “X, parameters”. Outputs: “Y_hat”.
—> 29 Y_hat = forward_propagation(X, parameters)
30
31 # Cost function. Inputs: “Y_hat, Y”. Outputs: “cost”.
in forward_propagation(X, parameters)
18 # Implement Forward Propagation to calculate Z.
19 ### START CODE HERE ### (~ 2 lines of code)
—> 20 Z = W @ X + b
21 Y_hat = Z
22 ### END CODE HERE ###
ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 2 is different from 1)
Any help on how I can get around this problem??