Simple CNN Architecture
Compute the total number of output activations (output size) produced by a single convolutional layer in a CNN. Given a square input, a square filter, and a number of filters, calculate the spatial output dimensions and multiply by the number of filters to get the total output size.
Formula (no padding, stride = 1):
spatial_output = input_size - filter_size + 1
total_output = spatial_output^2 * num_filters
Where:
input_size = height (or width) of the square input
filter_size = height (or width) of the square filter
num_filters = number of convolutional filters
Example:
Input: input_size = 28, filter_size = 3, num_filters = 10
spatial_output = 28 - 3 + 1 = 26
total_output = 26^2 * 10 = 676 * 10 = 6760
Output: 6760
Understanding output dimensions is fundamental to designing CNN architectures. Each convolutional layer transforms the input spatial dimensions based on the kernel size, stride, and padding. The total number of activations determines memory usage and computational cost of subsequent layers.
Constraints:
Test Cases
[28, 3, 10]67600[32, 5, 20]108900