diff --git a/src/Network.cpp b/src/Network.cpp index 94a912608..cfe39cfb6 100644 --- a/src/Network.cpp +++ b/src/Network.cpp @@ -711,9 +711,12 @@ void Network::forward_cpu(std::vector& input, constexpr int tiles = (width + 1) * (height + 1) / 4; // Calculate output channels const auto output_channels = conv_biases[0].size(); - // Assumes that residual blocks are identical and have same - // number of inputs and outputs - const auto input_channels = output_channels; + //input_channels is the maximum number of input channels of any convolution. + //Residual blocks are identical, but the first convolution might be bigger + //when the network has very few filters + const auto input_channels = std::max( + static_cast(output_channels), + static_cast(INPUT_CHANNELS)); auto conv_out = std::vector(output_channels * width * height); auto V = std::vector(WINOGRAD_TILE * input_channels * tiles);