@@ -1706,6 +1706,7 @@ def conv2d_transpose(input,
1706
1706
padding = 0 ,
1707
1707
stride = 1 ,
1708
1708
dilation = 1 ,
1709
+ groups = None ,
1709
1710
param_attr = None ,
1710
1711
bias_attr = None ,
1711
1712
use_cudnn = True ,
@@ -1776,6 +1777,12 @@ def conv2d_transpose(input,
1776
1777
dilation(int|tuple): The dilation size. If dilation is a tuple, it must
1777
1778
contain two integers, (dilation_H, dilation_W). Otherwise, the
1778
1779
dilation_H = dilation_W = dilation. Default: dilation = 1.
1780
+ groups(int): The groups number of the Conv2d transpose layer. Inspired by
1781
+ grouped convolution in Alex Krizhevsky's Deep CNN paper, in which
1782
+ when group=2, the first half of the filters is only connected to the
1783
+ first half of the input channels, while the second half of the
1784
+ filters is only connected to the second half of the input channels.
1785
+ Default: groups=1
1779
1786
param_attr(ParamAttr): The parameters to the Conv2d_transpose Layer.
1780
1787
Default: None
1781
1788
bias_attr(ParamAttr): Bias parameter for the Conv2d layer. Default: None
@@ -1830,7 +1837,8 @@ def conv2d_transpose(input,
1830
1837
filter_size = utils .convert_to_list (filter_size , 2 ,
1831
1838
'conv2d_transpose.filter_size' )
1832
1839
1833
- filter_shape = [input_channel , num_filters ] + filter_size
1840
+ groups = 1 if groups is None else groups
1841
+ filter_shape = [input_channel , num_filters / groups ] + filter_size
1834
1842
img_filter = helper .create_parameter (
1835
1843
dtype = input .dtype , shape = filter_shape , attr = helper .param_attr )
1836
1844
0 commit comments