Skip to content

Commit

Permalink
Fixes unclear exception message for F.conv2d (pytorch#11053)
Browse files Browse the repository at this point in the history
Summary:
Fixes pytorch#11033
Pull Request resolved: pytorch#11053

Differential Revision: D9573606

Pulled By: soumith

fbshipit-source-id: 9729cbd6c8afcef0fd487bdd425b0d1f55189009
  • Loading branch information
ptrblck authored and facebook-github-bot committed Sep 2, 2018
1 parent 593d740 commit cf10efb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions aten/src/ATen/native/Convolution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ static void check_input_shape_forward(const at::Tensor& input,
<< " instead";
throw std::runtime_error(ss.str());
}
if (weight.size(0) % groups != 0) {
std::stringstream ss;
ss << "Given groups=" << groups << ", expected weight to be divisible by "
<< groups << " at dimension 0, but got weight of size " << weight.sizes()
<< " instead";
throw std::runtime_error(ss.str());
}

if (!transposed) {
if (input.size(1) != (weight.size(1) * groups)) {
Expand Down

0 comments on commit cf10efb

Please sign in to comment.