add channel shuffle
@@ -1674,6 +1674,66 @@ class FCMP(Layer):
return self._output_size
+class ChannelShuffle(Layer):
+ '''
+ Channel Shuffle layer
+
+ Parameters
+ ----------
+ name : string, optional
+ Specifies the name of the layer.
+ n_groups : integer, optional
+ Specifies the number of groups for the layer.
+ Default: 1
+ scale : double, optional
+ Default: 1
+ src_layers : iter-of-Layers, optional
+ Specifies the layers directed to this layer.
+
+ Returns
+ -------
+ :class:`BN`
+
+ '''
+ type = 'channelshuffle'
+ type_label = 'ChannelShuffle'
+ type_desc = 'Channel Shuffle layer'
+ can_be_last_layer = False
+ number_of_instances = 0
+
+ def __init__(self, name=None, n_groups=1, scale=1.0, src_layers=None, **kwargs):
+
+ if not __dev__ and len(kwargs) > 0:
+ raise DLPyError('**kwargs can be used only in development mode.')
+
+ parameters = locals()
+ parameters = _unpack_config(parameters)
+ # _clean_parameters(parameters)
+ Layer.__init__(self, name, parameters, src_layers)
+ self._output_size = None
+ self.color_code = get_color(self.type)
+
+ @property
+ def kernel_size(self):
+ return None
+
+ @property
+ def num_weights(self):
+ return 0
+
+ @property
+ def output_size(self):
+ if self._output_size is None:
+ if self.src_layers is None:
+ self._output_size = 0
+ self._output_size = self.src_layers[0].output_size
+ return self._output_size
+
+ @property
+ def num_bias(self):
+ return 0
+
+
def _clean_input_parameters(parameters):
del parameters['self']
del parameters['name']
