make plugins for block. Args: in_channels (int): Input channels of plugin. plugins (list[dict]): List of plugins cfg to build. Returns: list[str]: List of the names of plugin.
(self, in_channels, plugins)
| 214 | planes * self.expansion, self.after_conv3_plugins) |
| 215 | |
| 216 | def make_block_plugins(self, in_channels, plugins): |
| 217 | """make plugins for block. |
| 218 | |
| 219 | Args: |
| 220 | in_channels (int): Input channels of plugin. |
| 221 | plugins (list[dict]): List of plugins cfg to build. |
| 222 | Returns: |
| 223 | list[str]: List of the names of plugin. |
| 224 | """ |
| 225 | assert isinstance(plugins, list) |
| 226 | plugin_names = [] |
| 227 | for plugin in plugins: |
| 228 | plugin = plugin.copy() |
| 229 | name, layer = build_plugin_layer(plugin, |
| 230 | in_channels=in_channels, |
| 231 | postfix=plugin.pop('postfix', '')) |
| 232 | assert not hasattr(self, name), f'duplicate plugin {name}' |
| 233 | self.add_module(name, layer) |
| 234 | plugin_names.append(name) |
| 235 | return plugin_names |
| 236 | |
| 237 | def forward_plugin(self, x, plugin_names): |
| 238 | out = x |