提交 0b32b7e3 authored 作者: affanv14's avatar affanv14 提交者: Mohammed Affan

check a few conditions

上级 5cfff52b
...@@ -1526,6 +1526,16 @@ class BaseAbstractConv(Op): ...@@ -1526,6 +1526,16 @@ class BaseAbstractConv(Op):
] = kern ] = kern
if self.convdim == 2: if self.convdim == 2:
if img.shape[1] % self.num_groups != 0:
raise ValueError(
'number of input channels must be divible by num_groups')
if kern.shape[0] % self.num_groups != 0:
raise ValueError(
'number of filters must be divisible by num_groups')
if img.shape[1] // num_groups != kern.shape[1]:
raise ValueError(
'the number of input channels in the kernel should '
'specify the number of channels of 1 group')
val = _valfrommode(mode) val = _valfrommode(mode)
bval = _bvalfromboundary('fill') bval = _bvalfromboundary('fill')
input_channel_offset = img.shape[1] // self.num_groups input_channel_offset = img.shape[1] // self.num_groups
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论