facebookresearch / torchrec
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 860 units with 5,242 lines of code in units (40.6% of code).
    • 0 very complex units (0 lines of code)
    • 2 complex units (143 lines of code)
    • 4 medium complex units (203 lines of code)
    • 13 simple units (383 lines of code)
    • 841 very simple units (4,513 lines of code)
0% | 2% | 3% | 7% | 86%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
py0% | 2% | 4% | 7% | 85%
cpp0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
torchrec/linter0% | 66% | 0% | 0% | 33%
torchrec/modules0% | 13% | 0% | 10% | 75%
torchrec/distributed0% | 0% | 3% | 5% | 90%
torchrec/optim0% | 0% | 28% | 13% | 58%
torchrec/sparse0% | 0% | 0% | 10% | 89%
torchrec/datasets0% | 0% | 0% | 15% | 84%
torchrec/quant0% | 0% | 0% | 18% | 82%
torchrec/models0% | 0% | 0% | 0% | 100%
torchrec/fx0% | 0% | 0% | 0% | 100%
torchrec0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def check_class_definition()
in torchrec/linter/module_linter.py
98 36 2
def _call_impl()
in torchrec/modules/lazy_extension.py
45 32 3
def load_state_dict()
in torchrec/optim/keyed.py
76 25 3
def from_float()
in torchrec/distributed/quant_embedding_kernel.py
57 16 2
def _init_parameters()
in torchrec/distributed/model_parallel.py
17 12 2
def _partition_by_host()
in torchrec/distributed/planner/partitioners.py
53 11 2
def _get_node_args_helper()
in torchrec/distributed/train_pipeline.py
23 10 2
def _init_combined_embeddings()
in torchrec/distributed/cw_sharding.py
42 10 1
def load()
in torchrec/distributed/planner/proposers.py
27 9 2
def progress()
in torchrec/distributed/train_pipeline.py
34 8 2
def state_dict()
in torchrec/optim/keyed.py
22 8 1
def _to_data_type()
in torchrec/quant/embedding_modules.py
9 7 1
def _get_sharding_type_abbr()
in torchrec/distributed/planner/stats.py
17 7 1
def _init_ddp()
in torchrec/distributed/model_parallel.py
26 7 1
def __iter__()
in torchrec/datasets/criteo.py
35 7 1
def _load_data_for_rank()
in torchrec/datasets/criteo.py
29 6 1
def _get_multiplier()
in torchrec/optim/warmup.py
13 6 2
def split()
in torchrec/sparse/jagged_tensor.py
71 6 2
def forward()
in torchrec/modules/crossnet.py
35 6 2
def to_sparse_type()
in torchrec/quant/embedding_modules.py
11 5 1