def to_deeper_model(self, target_id, new_layer): """Insert a relu-conv-bn block after the target block. Args: target_id: A convolutional layer ID. The new block should be inserted after the block. new_layer: An instance of StubLayer subclasses. """ self.operation_history.append(('to_deeper_model', target_id, new_layer)) input_id = self.layer_id_to_input_node_ids[target_id][0] output_id = self.layer_id_to_output_node_ids[target_id][0] if self.weighted: if is_layer(new_layer, 'Dense'): init_dense_weight(new_layer) elif is_layer(new_layer, 'Conv'): init_conv_weight(new_layer) elif is_layer(new_layer, 'BatchNormalization'): init_bn_weight(new_layer) self._insert_new_layers([new_layer], input_id, output_id)
def to_deeper_model(self, target_id, new_layer): """Insert a relu-conv-bn block after the target block. Args: target_id: A convolutional layer ID. The new block should be inserted after the block. new_layer: An instance of StubLayer subclasses. """ self.operation_history.append(('to_deeper_model', target_id, new_layer)) input_id = self.layer_id_to_input_node_ids[target_id][0] output_id = self.layer_id_to_output_node_ids[target_id][0] if self.weighted: if is_layer(new_layer, LayerType.DENSE): init_dense_weight(new_layer) elif is_layer(new_layer, LayerType.CONV): init_conv_weight(new_layer) elif is_layer(new_layer, LayerType.BATCH_NORM): init_bn_weight(new_layer) self._insert_new_layers([new_layer], input_id, output_id)