Your question is Convolutional Neural Network in PyTorch. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Implement the inference path of a small convolutional neural network used to classify frames from a Bosch AUTODOME IP starlight 7000i camera. Do not use PyTorch convolution or pooling helpers. Implement the tensor operations directly with Python lists so that padding, stride, channel aggregation, activation, and pooling behavior are explicit.
The network has one convolutional layer, ReLU activation, non-overlapping max pooling, flattening, and a fully connected output layer. Return the index of the class with the largest logit. If logits tie, return the smallest class index.
Implement cnn_predict(image, kernels, biases, dense_weights, dense_bias, stride, padding, pool_size).
image is a 3D list with shape [input_channels][height][width].kernels is a 4D list with shape [output_channels][input_channels][kernel_size][kernel_size].biases contains one value per output channel.dense_weights has shape [classes][flattened_features].dense_bias contains one value per class.pool_size and stride pool_size.def cnn_predict(image, kernels, biases, dense_weights, dense_bias, stride, padding, pool_size):