Skip to content

Commit

Permalink
Fix V matrix size in Winograd CPU convolution.
Browse files Browse the repository at this point in the history
Fixes issue leela-zero#703.

Pull request leela-zero#714.
  • Loading branch information
Ttl authored and gcp committed Jan 23, 2018
1 parent c9dea8d commit 420c9f2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,12 @@ void Network::forward_cpu(std::vector<float>& 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<size_t>(output_channels),
static_cast<size_t>(INPUT_CHANNELS));
auto conv_out = std::vector<float>(output_channels * width * height);

auto V = std::vector<float>(WINOGRAD_TILE * input_channels * tiles);
Expand Down

0 comments on commit 420c9f2

Please sign in to comment.