Course 4, week 1, Convolution_model_Step_by_Step_v1, Exercise 3 - unable to overcome shapes error

If u’re still stuck, please take a look at the following hints cuz I had the same issue:

Follow these instructions carefully which I obtained from here:

Preparation

Retreive information (m, n_H_prev, n_W_prev, n_C_prev) from A_prev and (f, f, n_C_prev, n_C) from W using .shape
Retreive stride and padding from hparameters python dictionnary
calculate n_H and n_W using the formula and the int() function as floor
initialize Z using .zeros with dimensions (m ,n_H, n_W, n_C)
use zero_pad() function to add padding to A_prev (result: A_prev_pad)

Loops:

first for loop:
loop over m Examples using index i and extract a_prev_pad from A_prev_pad using index in the first axis position

second for loop:
loop over vertical output layer axis (n_H) using index h and calculate (vert_start, vert_end):
multiply stride to index h for vert_start
add filter height f for vert_end

third for loop:
loop over horizontal output layer axis (n_W) using index w and calculate (horiz_start, horiz_end):
multiply stride to index w for horiz_start
add filter width f for horiz_end

fourth for loop:
loop over the number of output channels using index c
slice out a_slice_prev from a_prev_pad using [vert_start:vert_end, horiz_start:horiz_end, all]
slice out weights from W using [all, all, all, c]
slice out biases from b using [0, 0, 0, c]
calculate Z[i, h, w, c] using function conv_single_step() with inputs a_slice_prev, weights and biases

Please pay specific attention to the bold texts and also bold + italic in my comment! U’d definitely fix the problem :slight_smile:
Cheers,

23 Likes
Programming Assignment - Week 1- conv_forward
Week 1 Conv_Forward
C4 W1 A1 : concolution_model_step_by_step 1 ValueError: operands could not be broadcast together with shapes (3,3,4) (3,3)
DLS Course 4 [Week 1] Exercise 3 - conv_forward - wrong Z mean
CNN Week 1 Exercise 3 shape errors
Exercise 3, course 4, week 1 - Z's mean error
Week 1 Assignment 1 conv_forward (a small pitfall)
C4_w1_3.3: alueError: operands could not be broadcast together with shapes
Conv_Forward IndexError
CNN-W1 1st exercise
Getting error in Course 4 W1 A1
Conv_backward error
Convolutional Neural Networks W1 Exercise 3 - index 4 is out of bounds for axis 3 with size 4
Week 1 Assignment 1 exercise 3 - Conv fOrward questionn
Course 4 Week 1 Assignment 1 - Exercise 3 - conv_forward
Incorrect gradings / Week1/Programming Assignment: Convolutional Model, Step by Step
Course4, Week1, Ex. 3 Conv Forward
Course 4 week 1 exercise 3: Make sure you include stride
Exercise 3 conv_forward() error
Course 4 Week #1 Programming Assignment 1 Exercise 3 conv_forward
Course 4 Week 1 Exercise 3 - conv_forward Strange Issues
DLS Course 4 Week 1 - Convolution_model_Step_by_Step_v1 - Exercise 3
Stuck at C4W1 programming assignment 1
I'm stuck in Convolutional Neural Network week one exercise 1 conv_forward
CNN W1: 1st programming assignment, shapes wrong?
C4W1 Z's Convolution_model_Step_by_Step
Week 1 Conv_Forward
C4 : W1 : A1 : Ex 3 - Z's mean is incorrect
Prog Assn: Convolution_model_Step_by_Step_v1: Error Make sure you include stride in your calculation
3.3 - Convolutional Neural Networks - exercise Forward Pass C4W1
C4 W1 A1: Error in conv_forward and pool_forward
Course 4 Week 1 Exercise 3 Step by Step... Operands could not be broadcast together with shapes
Conv_forward C4 W1 A1 operands issue
Conv_forward
Pool_forward
I'm stuck in Convolutional Neural Network week one exercise 1 conv_forward
Convolutional Neural Networks W1 lab problem
Troubles in conv_forward (ex 3)
Week 1, Assignment 1, Convolution_model_Step_by_Step_v1, Exercise 3
Convolution_model_Step_by_Step_v1_Forward
Convolution_model_Step_by_Step_v1_Forward
Prog assignment Ex 3: operands could not be broadcast together
Prog assignment Ex 3: operands could not be broadcast together
DLS Course 4 [Week 1] Exercise 3 - conv_forward - wrong Z mean