Course 4 Week 1 - conv_forward


On the last part of the function it asks to convole the 3D spliced with the correct filter of W and B with this snippet:

# Use the corners to define the (3D) slice of a_prev_pad (See Hint above the cell). (≈1 line)
                    # a_slice_prev = None
                    # Convolve the (3D) slice with the correct filter W and bias b, to get back one output neuron. (≈3 line)
                    # weights = None
                    # biases = None
                    # Z[i, h, w, c] = None

I know I have to use the single step convolution function coded previously in the notebook, but I don’t really understand what to do with the weights and biases portion of the code. Do I have use W[…] where the blank is what is needed to fill in?

Welcome to the community.

If you look at the description about “arguments” for conv_forward(), it says

W -- Weights, numpy array of shape (f, f, n_C_prev, n_C)
b -- Biases, numpy array of shape (1, 1, 1, n_C)

Then, what you are requested is to pick an appropriate slice (portion) of W (like W[:,,.]) and b for calculating Z.

1 Like

Thank you. Another thing, if I have other questions, should I make a new thread for the specific question?

It is better to create a new thread so that other learners can easily search relevant topics if they encounter similar problem.
If a question is the same context, then, you can keep using this thread.