mmengine.analysis.activation_count¶
- mmengine.analysis.activation_count(model, inputs, supported_ops=None)[源代码]¶
Given a model and an input to the model, compute the total number of activations of the model.
Adopted from https://github.com/facebookresearch/fvcore/blob/main/fvcore/nn/activation_count.py
- 参数:
model (nn.Module) – The model to compute activation counts.
inputs (tuple) – Inputs that are passed to model to count activations. Inputs need to be in a tuple.
supported_ops (dict(str,Callable) or None) – provide additional handlers for extra ops, or overwrite the existing handlers for convolution and matmul. The key is operator name and the value is a function that takes (inputs, outputs) of the op.
- 返回:
A dictionary that records the number of activation (mega) for each operation and a Counter that records the number of unsupported operations.
- 返回类型:
tuple[defaultdict, Counter]