MCPcopy Create free account
hub / github.com/PeizeSun/SparseR-CNN / activation_count_operators

Function activation_count_operators

detectron2/utils/analysis.py:76–94  ·  view source on GitHub ↗

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
)

Source from the content-addressed store, hash-verified

74
75
76def 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
97def _flatten_to_tuple(outputs):

Callers 1

do_activationFunction · 0.90

Calls 1

_wrapper_count_operatorsFunction · 0.85

Tested by

no test coverage detected