Implement operator-level activations counting using jit. This is a wrapper of fvcore.nn.activation_count, that supports standard detection models in detectron2. Note: The function runs the input through the model to compute activations. The activations of a detectio
(
model: nn.Module, inputs: list, **kwargs
)
| 74 | |
| 75 | |
| 76 | def activation_count_operators( |
| 77 | model: nn.Module, inputs: list, **kwargs |
| 78 | ) -> typing.DefaultDict[str, float]: |
| 79 | """ |
| 80 | Implement operator-level activations counting using jit. |
| 81 | This is a wrapper of fvcore.nn.activation_count, that supports standard detection models |
| 82 | in detectron2. |
| 83 | |
| 84 | Note: |
| 85 | The function runs the input through the model to compute activations. |
| 86 | The activations of a detection model is often input-dependent, for example, |
| 87 | the activations of box & mask head depends on the number of proposals & |
| 88 | the number of detected objects. |
| 89 | |
| 90 | Args: |
| 91 | model: a detectron2 model that takes `list[dict]` as input. |
| 92 | inputs (list[dict]): inputs to model, in detectron2's standard format. |
| 93 | """ |
| 94 | return _wrapper_count_operators(model=model, inputs=inputs, mode=ACTIVATIONS_MODE, **kwargs) |
| 95 | |
| 96 | |
| 97 | def _flatten_to_tuple(outputs): |
no test coverage detected