題組內容

1.(50 points) The convolutional layer is the core building block of a Convolutional Neural Network (CNN), which is widely used in today's machine learning methods to classify images and recognize speeches. For example, the figure below shows a CNN which contains two convolutional layers. The first convolutional layer applies 4 learnable filters (or kernels) to the input image and produces 4 feature maps.6201c6fd78351.jpg Although the above example uses 2-dimensional convolutions, let us start with I-dimensional convolution here for simplicity. The convolution of two 1-dimensional finite sequences is defined by as the following: 6201c7332d0b3.jpg
 where the symbol * denotes a convolution operator, fis the input sequence, and g is the convolution kernel of size (2M+1).
Suppose the input sequence fin our case study contains N data points, and each data point is represented by a 32-bit floating-point number. The convolution kernel g is also composed by 32-bit floating-point numbers. Please answer the following questions:

 (a) [5 points] Please write a C code to implement the convolution function in our case study. Please make sure that your code is comprehensive with sufficient comments.