torchscan.modules¶
The modules subpackage contains tools for inspecting modules. See Understanding results for counting conventions and Model and input support for the capability matrix.
FLOPs¶
Related to the number of floating-point operations performed during model inference.
module_flops ¶
Estimate the number of floating point operations performed by the module
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
Module | Callable[..., Tensor]
|
PyTorch module |
required |
inputs
|
Tuple[Any, ...]
|
input to the module |
required |
out
|
Any
|
output of the module |
required |
Returns: number of FLOPs
MACs¶
Related to the number of multiply-accumulate operations performed during model inference.
module_macs ¶
Estimate the number of multiply-accumulation operations performed by the module
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
Module
|
PyTorch module |
required |
inp
|
Tensor
|
input to the module |
required |
out
|
Tensor
|
output of the module |
required |
Returns: int: number of MACs
DMAs¶
Related to the number of direct memory accesses during model inference.
module_dmas ¶
Estimate the number of direct memory accesses by the module. The implementation overhead is neglected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
Module
|
PyTorch module |
required |
inp
|
Tensor
|
input to the module |
required |
out
|
Tensor
|
output of the module |
required |
Returns: int: number of DMAs
Receptive field¶
Related to the effective receptive field of a layer.
module_rf ¶
Estimate the spatial receptive field of the module
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
Module
|
PyTorch module |
required |
inp
|
Tensor
|
input to the module |
required |
out
|
Tensor
|
output of the module |
required |
Returns: receptive field effective stride effective padding