Beispiel #1
0
 def build(self, input_shapes):
     input_shape = input_shapes[0]
     channel_axis = -1
     input_dim = input_shape[channel_axis]
     self.kernel_shape = self.kernel_size + (input_dim, self.filters)
     self.depthwise_kernel_shape = self.kernel_size + (input_dim, 1)
     self.pointwise_kernel_shape = (1, ) * 2 + (1 * input_dim, self.filters)
     param_indices = [
         np.product(self.depthwise_kernel_shape),
         np.product(self.pointwise_kernel_shape)
     ]
     if self.use_bias:
         self.bias_shape = (self.filters, )
         param_indices.append(self.filters)
     else:
         self.bias_shape = None
     self.param_indices = np.cumsum(param_indices)
     print("need", param_indices)
     self.initializer = BK.placeholder(
         shape=Conv2D.compute_output_shape(self, input_shape))
     self.built = True