Hello @yanivh ,

Without revealing my solution… the closest thing would be to say that I almost literally copied the sample lines of “The functions and their inputs are:” from the cell “Use the helper functions”

## 4 - Two-layer Neural Network

### Exercise 1 - two_layer_model

Use the helper functions you have implemented in the previous assignment to build a 2-layer neural network with the following structure: *LINEAR → RELU → LINEAR → SIGMOID*. The functions and their inputs are:

```
def initialize_parameters(n_x, n_h, n_y):
...
return parameters
def linear_activation_forward(A_prev, W, b, activation):
...
return A, cache
def compute_cost(AL, Y):
...
return cost
def linear_activation_backward(dA, cache, activation):
...
return dA_prev, dW, db
def update_parameters(parameters, grads, learning_rate):
...
return parameters
```

but obviously replacing the AL with the appropriate variable, and assigning the proper “activation” according to the corresponding layers…

Note that the provided “initialize_parameters” function doesn’t accept the three dimensions as individual parameters, but seems to expect an array(list)…hence I used **layers_dim**

That said, training my implementation of this “two_layer_model” on the next cell:

### 4.1 - Train the model

```
parameters, costs = two_layer_model(. . . )
```

gave:

Cost after iteration 0: 0.6950464961800915

Cost after iteration 100: 0.5892596054583805

Cost after iteration 200: 0.5232609173622991

. . .

. . .

Cost after iteration 2300: 0.028387859212946117

Cost after iteration 2400: 0.026615212372776077

Cost after iteration 2499: 0.024821292218353375

Not the “expected” results, but similar ones…

I’ve repeatedly re-checked these lines:

```
# Initialize parameters dictionary
# parameters = ...
# YOUR CODE STARTS HERE
. . .
# YOUR CODE ENDS HERE
```

```
# Forward propagation:
# A1, cache1 = ...
# A2, cache2 = ...
# YOUR CODE STARTS HERE
. . .
# YOUR CODE ENDS HERE
```

```
# Compute cost
# cost = ...
# YOUR CODE STARTS HERE
. . .
# YOUR CODE ENDS HERE
```

```
# Backward propagation.
# dA1, dW2, db2 = ...
# dA0, dW1, db1 = ...
# YOUR CODE STARTS HERE
. . .
# YOUR CODE ENDS HERE
```

```
# Update parameters.
# parameters = ...
# YOUR CODE STARTS HERE
. . .
# YOUR CODE ENDS HERE
```

and don’t see my error(s)…

Note that the problem happens upon executing “two_layer_model_test” evaluation cell:

```
parameters, costs = two_layer_model(train_x, train_y, layers_dims = (n_x, n_h, n_y), num_iterations = 2, print_cost=False)
print("Cost after first iteration: " + str(costs[0]))
two_layer_model_test(two_layer_model)
```

I get “exactly” the same “error” messages as image|690x437

presented by @tfu on post " Week 4 exercise 4 not passing both tests" but @tfu solution

made it work by replacing layers_dim with the three dimensions

doesn’t work for me…

I feel that any further than this would be revealing my implemented solution…