main function
void
main()
Implementation
void main() {
// Example 3-channel input (like an RGB image with 5x5 pixels)
List<Matrix2d> input = [
Matrix2d(5, 5), // Red channel
Matrix2d(5, 5), // Green channel
Matrix2d(5, 5), // Blue channel
];
// Create Max Pooling Layer (2x2 kernel, stride 2)
Pooling2d maxPool =
Pooling2d(kernelSize: 2, stride: 2, type: PoolingType.max);
List<Matrix2d> maxPooledOutput = maxPool.forward(input);
print(
"Max Pooling Output Size: ${maxPooledOutput[0].rows()}x${maxPooledOutput[0].cols()}");
// Create Average Pooling Layer (2x2 kernel, stride 2)
Pooling2d avgPool =
Pooling2d(kernelSize: 2, stride: 2, type: PoolingType.average);
List<Matrix2d> avgPooledOutput = avgPool.forward(input);
print(
"Average Pooling Output Size: ${avgPooledOutput[0].rows()}x${avgPooledOutput[0].cols()}");
}