W2 programming assignment

My individual implementation of every part is working fine but when I am integrating parts in final model error showing.
individual part running fine:
{code removed by mentor}

individual part showing error in model implementation-
{code removed by mentor}

Hello @Avinash_Maurya

Sharing code is not allowed here, so I have removed them for you. Next time, please only post the full error traceback.

From the following part of the error traceback, we know dim is an array but it is required to be a integer value.

image
image

It was an array because of you set X_train[0] to dim. X_train is a 2D array and X_train[0] becomes a 1D array. What’s more, it is not the correct way to find out the dim. dim here refers to the number of features in X_train. If you read the DocString, it says:

    Arguments:
    X_train -- training set represented by a numpy array of shape (num_px * num_px * 3, m_train)

which tells you that the “shape” of X_train is (num_px * num_px * 3, m_train). This is where you can pick the number of the features from. To get the shape programmatically, we do X_train.shape. From there, you need to pick the right value.

By the way, make sure you use every input arguments in your work: num_iterations, learning_rate, print_cost should appear in your work.

Cheers,
Raymond

PS: I have closed your other post because it repeated this one.