zoo/shufflenet/shufflenet_c.py
def pw_group_conv(self, x, n_partitions, n_filters, **metaparameters):
        ''' A Pointwise Group Convolution  
            x           : input tensor
            n_partitions: number of groups to partition feature maps (channels) into.
            n_filters   : number of filters
        '''
            
        # Calculate the number of input filters (channels)
        in_filters = x.shape[3]

        # Derive the number of input filters (channels) per group
        grp_in_filters  = in_filters // n_partitions
        # Derive the number of output filters per group (Note the rounding up)
        grp_out_filters = int(n_filters / n_partitions + 0.5)
      
        # Perform convolution across each channel group
        groups = []
        for i in range(n_partitions):
            # Slice the input across channel group
            group = Lambda(lambda x: x[:, :, :, grp_in_filters * i: grp_in_filters * (i + 1)])(x)

            # Perform convolution on channel group
            conv = self.Conv2D(group, grp_out_filters, (1,1), padding='same', strides=1, 
                               **metaparameters)
            # Maintain the point-wise group convolutions in a list
            groups.append(conv)

        # Concatenate the outputs of the group pointwise convolutions together
        x = Concatenate()(groups)
        # Do batch normalization of the concatenated filters (feature maps)
        x = self.BatchNormalization(x)
        return x
 A Pointwise Group Convolution  
            x           : input tensor
            n_partitions: number of groups to partition feature maps (channels) into.
            n_filters   : number of filters
        
A Pointwise Group Convolution
x           : input tensor
n_partitions: number of groups to partition feature maps (channels) into.
n_filters   : number of filters
A Pointwise Group Convolution x : input tensor n_partitions : number of groups to partition feature maps ( channels ) into . n_filters : number of filters
def pw_group_conv(self, x, n_partitions, n_filters, **metaparameters):
        in_filters = x.shape[3]
        grp_in_filters  = in_filters // n_partitions
        grp_out_filters = int(n_filters / n_partitions + 0.5)
        groups = []
        for i in range(n_partitions):
            group = Lambda(lambda x: x[:, :, :, grp_in_filters * i: grp_in_filters * (i + 1)])(x)
            conv = self.Conv2D(group, grp_out_filters, (1,1), padding='same', strides=1, 
                               **metaparameters)
            groups.append(conv)
        x = Concatenate()(groups)
        x = self.BatchNormalization(x)
        return x
def pw_group_conv ( self , x , n_partitions , n_filters , ** metaparameters ) : in_filters = x . shape [ 3 ] grp_in_filters = in_filters // n_partitions grp_out_filters = int ( n_filters / n_partitions + 0.5 ) groups = [ ] for i in range ( n_partitions ) : group = Lambda ( lambda x : x [ : , : , : , grp_in_filters * i : grp_in_filters * ( i + 1 ) ] ) ( x ) conv = self . Conv2D ( group , grp_out_filters , ( 1 , 1 ) , padding = 'same' , strides = 1 , ** metaparameters ) groups . append ( conv ) x = Concatenate ( ) ( groups ) x = self . BatchNormalization ( x ) return x
A Pointwise Group Convolution
x           : input tensor
n_partitions: number of groups to partition feature maps (channels) into.
A Pointwise Group Convolution x : input tensor n_partitions : number of groups to partition feature maps ( channels ) into .
''' A Pointwise Group Convolution  
            x           : input tensor
            n_partitions: number of groups to partition feature maps (channels) into.
            n_filters   : number of filters
        ''' # Calculate the number of input filters (channels) # Derive the number of input filters (channels) per group # Derive the number of output filters per group (Note the rounding up) # Perform convolution across each channel group # Slice the input across channel group # Perform convolution on channel group # Maintain the point-wise group convolutions in a list # Concatenate the outputs of the group pointwise convolutions together # Do batch normalization of the concatenated filters (feature maps)
self
x
n_partitions
n_filters