In [5]:
def forward_pass(X, parameters):
    
    # to make forward pass calculations we need W1 and W2 so we will extract them from dictionary parameters
    W1 = parameters['W1']
    W2 = parameters['W2']
    b1 = parameters['b1']
    b2 = parameters['b2']

    
    # first layer calculations - hidden layer calculations
    Z1 = np.dot(W1, X) + b1
    A1 = tanh(Z1)  # activation in the first layer is tanh
    
    # output layer calculations
    Z2 = np.dot(W2, A1) + b2
    A2 = sigmoid(Z2)# A2 are predictions, y_hat
    
    # cache values for backpropagation calculations
    cache = {'Z1':Z1,
             'A1':A1,
             'Z2':Z2,
             'A2':A2
            }
    
    return A2, cache