pytorch / opacus
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 241 units with 1,816 lines of code in units (33.2% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 0 medium complex units (0 lines of code)
    • 6 simple units (121 lines of code)
    • 235 very simple units (1,695 lines of code)
0% | 0% | 0% | 6% | 93%
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% | 0% | 0% | 7% | 92%
js0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
opacus/layers0% | 0% | 0% | 25% | 74%
opacus/optimizers0% | 0% | 0% | 11% | 88%
opacus/validators0% | 0% | 0% | 11% | 88%
opacus/grad_sample0% | 0% | 0% | 11% | 88%
opacus0% | 0% | 0% | 0% | 100%
opacus/utils0% | 0% | 0% | 0% | 100%
opacus/accountants0% | 0% | 0% | 0% | 100%
website/pages0% | 0% | 0% | 0% | 100%
website/core0% | 0% | 0% | 0% | 100%
opacus/scripts0% | 0% | 0% | 0% | 100%
website/scripts0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def get_optimizer_class()
in opacus/optimizers/__init__.py
12 9 2
def initialize_cells()
in opacus/layers/dp_rnn.py
27 8 1
def load_state_dict()
in opacus/layers/dp_multihead_attention.py
30 8 2
def accumulated_iterations()
in opacus/optimizers/optimizer.py
18 6 1
def remove_hooks()
in opacus/grad_sample/grad_sample_module.py
16 6 1
def fix()
in opacus/validators/module_validator.py
18 6 2
def _log_sub()
in opacus/accountants/analysis/rdp.py
12 5 2
def _compute_log_a_for_frac_alpha()
in opacus/accountants/analysis/rdp.py
25 5 3
def _compute_rdp()
in opacus/accountants/analysis/rdp.py
11 5 3
def step()
in opacus/accountants/gdp.py
10 5 4
def switch_generator()
in opacus/data_loader.py
28 5 3
def __iter__()
in opacus/utils/uniform_sampler.py
17 5 1
def get_submodule()
in opacus/utils/module_utils.py
14 5 2
def are_state_dict_equal()
in opacus/utils/module_utils.py
13 5 2
def _batchnorm_to_instancenorm()
in opacus/validators/batch_norm.py
14 5 1
def gen_tutorials()
in website/scripts/parse_tutorials.py
29 5 1
def parse_sphinx()
in website/scripts/parse_sphinx.py
23 5 2
def hook_fn()
in opacus/accountants/accountant.py
5 4 1
def step()
in opacus/accountants/rdp.py
15 4 4
def iterate_layers()
in opacus/layers/dp_rnn.py
9 4 2