diff options
author | Jongsoo Park <jongsoo@fb.com> | 2018-11-16 05:21:15 +0300 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2018-11-16 05:24:41 +0300 |
commit | 25ab38b1106e2f795d2f4cc40a4f0338e1137771 (patch) | |
tree | 2963b5518cfdde20a20d1c5d2065aea5bafe2d40 /include/fbgemm/ConvUtils.h | |
parent | 8392eca198742b949529e18619a7ec9a25f4b399 (diff) |
grouped conv (#8)
Summary:
Pull Request resolved: https://github.com/pytorch/FBGEMM/pull/8
This is the second diff of the stack that implements grouped convolution.
Reviewed By: jianyuh
Differential Revision: D13048844
fbshipit-source-id: 7f1e8c1412e499cc76ca788004bb8e41c8f0308c
Diffstat (limited to 'include/fbgemm/ConvUtils.h')
-rw-r--r-- | include/fbgemm/ConvUtils.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/fbgemm/ConvUtils.h b/include/fbgemm/ConvUtils.h index 667998c..fa6967a 100644 --- a/include/fbgemm/ConvUtils.h +++ b/include/fbgemm/ConvUtils.h @@ -53,6 +53,16 @@ struct conv_param_t { K(k), stride(strd), pad(pd) { + if (ic % g != 0) { + throw std::runtime_error( + "groups = " + std::to_string(g) + + " does not divide number of input channels = " + std::to_string(ic)); + } + if (oc % g != 0) { + throw std::runtime_error( + "groups = " + std::to_string(g) + + " does not divide number of output channels = " + std::to_string(oc)); + } for (int d = 0; d < SPATIAL_DIM; ++d) { dilation[d] = 1; IN_DIMP[d] = IN_DIM[d] + pad[d] + pad[SPATIAL_DIM + d]; |