def prop(W, b, X, Y, lambd):
    m = X.shape[1]
    A = sigmoid((np.dot(W, X) + b))
    cost = (((1.0 / m) * np.sum(np.sum(np.square((A - Y)), axis=0, keepdims=True))) + ((lambd / (2 * m)) * np.sum(np.sum((W * W)))))
    Z = (np.dot(W, X) + b)
    dZ = (((2 * (A - Y)) * sigmoid(Z)) * (1 - sigmoid(Z)))
    dW = (((1.0 / m) * np.dot(dZ, X.T)) + ((lambd / m) * W))
    db = ((1.0 / m) * np.sum(dZ, axis=1, keepdims=True))
    grads = {'dW': dW, 'db': db}
    return (grads, cost)
def prop(W, b, X, Y, lambd):
    m = X.shape[1]
    A = sigmoid((np.dot(W, X) + b))
    cost = (((1.0 / m) * np.sum(np.sum(np.square((A - Y)), axis=0, keepdims=True))) + ((lambd / (2 * m)) * np.sum(np.sum((W * W)))))
    Z = (np.dot(W, X) + b)
    dZ = (((2 * (A - Y)) * sigmoid(Z)) * (1 - sigmoid(Z)))
    dW = (((1.0 / m) * np.dot(dZ, X.T)) + ((lambd / m) * W))
    db = ((1.0 / m) * np.sum(dZ, axis=1, keepdims=True))
    grads = {'dW': dW, 'db': db}
    return (grads, cost)