Args: model (nn.Module): the model containing layers to obtain weights and activations from. layers (list of strings): a list of layer names to obtain weights and activations from. Names are hierarchical, separated by /. For example, If a layer follow
(self, model, layers)
| 161 | """ |
| 162 | |
| 163 | def __init__(self, model, layers): |
| 164 | """ |
| 165 | Args: |
| 166 | model (nn.Module): the model containing layers to obtain weights and activations from. |
| 167 | layers (list of strings): a list of layer names to obtain weights and activations from. |
| 168 | Names are hierarchical, separated by /. For example, If a layer follow a path |
| 169 | "s1" ---> "pathway0_stem" ---> "conv", the layer path is "s1/pathway0_stem/conv". |
| 170 | """ |
| 171 | self.model = model |
| 172 | self.hooks = {} |
| 173 | self.layers_names = layers |
| 174 | # eval mode |
| 175 | self.model.eval() |
| 176 | self._register_hooks() |
| 177 | |
| 178 | def _get_layer(self, layer_name): |
| 179 | """ |
nothing calls this directly
no test coverage detected