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.


Bring Your Own Cause

If you think any info here has remotely helped you consider dropping a penny for this cause, just click me . You can visit https://www.bbc.com/news/world-asia-india-52672764 Unfortunately, there are plenty of sad things happening all over the world, if you have a different cause or charity you'd rather support please do. And if you did make a donation, please drop a note to me (annotated) or leave a comment here (anonymous is OK!) and I will use that as motivation to write more useful content here.

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