MCPcopy Create free account
hub / github.com/alinlab/SelfPatch / make_block_plugins

Method make_block_plugins

segmentation/backbones/resnet.py:222–243  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected