Manoj Rao bio photo

Manoj Rao

Your Average Common Man

Email Twitter Github

In an earlier post we saw what a crosscorr2d() operator is. In this we will see how it is applied.

A convolution layer performs crosscorr2d() operation on the input and kernels. It then adds a scalar bias to produce the output. A convolution layer accepts the kernel and a scalar bias as inputs.

class conv2D : public Block {
    conv2D(kernel_size, ...)
    {
        Shape s{1};
        my_weight = get_params("weight", kernel_size);
        my_bias = get_params("bias", s);
    }

    void forward(x)
    {
        return crosscorr2d(x, my_weight.data(), my_bias.data());
    }
};

The forward computation function calls crosscorr2d function and adds the bias.


My Podcast!

If you like topics such as this then please consider subscribing to my podcast. I talk to some of the stalwarts in tech and ask them what their favorite productivity hacks are:

Available on iTunes Podcast

Visit Void Star Podcast’s page on iTunes Podcast Portal. Please Click ‘Subscribe’, leave a comment.

Get it iTunes

Available on Google Play Music

Visit Void Star Podcast’s page on Google Play Music. Please Click ‘Subscribe’ and leave a comment.

Listen on Google Play Music
Available on Stitcher

Visit Void Star Podcast’s page on Sticher. Please Click ‘Subscribe’ and leave a comment.

Listen to Stitcher

Your app not listed here? Not an issue..

You should be able to search for ‘VoidStar Podcast’ on your favorite app. Most apps use one of the above sources for listing podcasts. This was tested on Podcast Addict (where you can also specify the search engine) and RatPoison on Android.