Vectorized Convolution Implementation

Hello,

I am currently doing the first assignment of Week 1 and in the notebook it says “For this exercise, don’t worry about vectorization! Just implement everything with for-loops”. However, I would still like to know how we can reformulate the convolution forward and backward pass in a vectorized way to speed up computation. Could someone show me how to do that or point me into the right direction? :slightly_smiling_face:

Best regards,
Kevin

Hi, @kevinsuedmersen!

You will see it later in the course. It’s just using the tensorflow built-in functions and layers. You just have to create the network with convolutional layers and TF will do it for you :wink:

Hi @alvaroramajo

thanks for your answer. Sorry, I think I didn’t phrase my question well enough. I was wondering if there is something like a clever way to arrange the input data and use vectorization, such that we can refrain from looping over each height and width index of an image sequentially. Because theoretically, I think it should be possible to compute each single step convolution (see function conv_single_step in the assignment), at once, since they’re all independent computations. I am pretty sure TF is doing that under the hood already, but I would like to be able to re-implement that myself with NumPy.

Best regards,
Kevin