def construct(self, input_shape): """Construct the convnet the operations for this layer.""" depth = convnet.depth_to_space_channels(input_shape[-1], self.block_size) op = convnet.create_conv( (self.patch_size, self.patch_size), (1, 1), input_shape[3], depth, self.bias, self.padding, self.initializer.construct() ) op.set_l2_factor(self.l2_factor) yield op yield convnet.create_depth_to_space(self.block_size)
def construct(self, input_shape): """Construct the convnet the operations for this layer.""" if self.operation.startswith("conv"): op = convnet.create_conv( (self.patch_size, self.patch_size), (self.stride, self.stride), input_shape[3], self.output_channels, self.operation.endswith("bias"), self.padding, self.initializer.construct() ) op.set_l2_factor(self.l2_factor) else: op = convnet.create_pool( self.operation, (self.patch_size, self.patch_size), (self.stride, self.stride), self.padding ) yield op