3.3 - Convolutional Neural Networks - Forward pass In the forward pass, you will take…
- User
3.3 - Convolutional Neural Networks - Forward pass
In the forward pass, you will take many filters and convolve them on the input. Each 'convolution' gives you a 2D matrix output. You will then stack these outputs to get a 3D volume:
Task 3: Implement the
conv_forwardfunction belowThe function convolves the filters W on an input activation A_prev. This function takes as input A_prev, the activations output by the previous layer (for a batch of m inputs), F filters/weights denoted by W, and a bias vector denoted by b, where each filter has its own (single) bias. Finally you also have access to the hyperparameters dictionary which contains the stride and the padding.
Hint:
- To select a 2x2 slice at the upper left corner of a matrix "a_prev" (shape (5,5,3)), you would do:
a_slice_prev = a_prev[0:2,0:2,:]This will be useful when you will define
a_slice_prevbelow, using thestart/endindexes you will define. 2. To define a_slice you will need to first define its cornersvert_start,vert_end,horiz_startandhoriz_end. This figure may be helpful for you to find how each of the corner can be defined using h, w, f and s in the code below.Reminder: The formulas relating the output shape of the convolution to the input shape is:
- Assistant
- User
- Assistant