AQIT 0.1.0
Loading...
Searching...
No Matches
aquin.compute.weight_trojans Namespace Reference

Functions

float _excess_kurtosis (torch.Tensor t)
float _outlier_density (torch.Tensor t)
float _sv_ratio (torch.Tensor t)
dict _analyse_tensor (str name, torch.Tensor t)
list[dict] _compute_risk (list[dict] layer_stats)
dict run_weight_trojan_analysis (model, Optional[list[int]] layer_range=None, int max_tensors_per_layer=4)

Variables

float KURTOSIS_FLAG = 4.0
float OUTLIER_FLAG = 0.002
float SV_RATIO_FLAG = 8.0
float RISK_SUSPICIOUS = 0.35
float RISK_HIGH = 0.65
dict SIGNAL_WEIGHTS = {"kurtosis": 0.40, "outlier": 0.35, "sv_ratio": 0.25}

Function Documentation

◆ _analyse_tensor()

dict _analyse_tensor ( str name,
torch.Tensor t )
protected

Definition at line 91 of file weight_trojans.py.

References _excess_kurtosis(), _outlier_density(), and _sv_ratio().

Referenced by run_weight_trojan_analysis().

◆ _compute_risk()

list[dict] _compute_risk ( list[dict] layer_stats)
protected

Definition at line 107 of file weight_trojans.py.

Referenced by run_weight_trojan_analysis().

◆ _excess_kurtosis()

float _excess_kurtosis ( torch.Tensor t)
protected

Definition at line 32 of file weight_trojans.py.

Referenced by _analyse_tensor().

◆ _outlier_density()

float _outlier_density ( torch.Tensor t)
protected

Definition at line 46 of file weight_trojans.py.

Referenced by _analyse_tensor().

◆ _sv_ratio()

float _sv_ratio ( torch.Tensor t)
protected

Definition at line 56 of file weight_trojans.py.

Referenced by _analyse_tensor().

◆ run_weight_trojan_analysis()

dict run_weight_trojan_analysis ( model,
Optional[list[int]] layer_range = None,
int max_tensors_per_layer = 4 )

Definition at line 162 of file weight_trojans.py.

References _analyse_tensor(), and _compute_risk().

Variable Documentation

◆ KURTOSIS_FLAG

float aquin.compute.weight_trojans.KURTOSIS_FLAG = 4.0

Definition at line 23 of file weight_trojans.py.

◆ OUTLIER_FLAG

float aquin.compute.weight_trojans.OUTLIER_FLAG = 0.002

Definition at line 24 of file weight_trojans.py.

◆ RISK_HIGH

float aquin.compute.weight_trojans.RISK_HIGH = 0.65

Definition at line 27 of file weight_trojans.py.

◆ RISK_SUSPICIOUS

float aquin.compute.weight_trojans.RISK_SUSPICIOUS = 0.35

Definition at line 26 of file weight_trojans.py.

◆ SIGNAL_WEIGHTS

dict aquin.compute.weight_trojans.SIGNAL_WEIGHTS = {"kurtosis": 0.40, "outlier": 0.35, "sv_ratio": 0.25}

Definition at line 29 of file weight_trojans.py.

◆ SV_RATIO_FLAG

float aquin.compute.weight_trojans.SV_RATIO_FLAG = 8.0

Definition at line 25 of file weight_trojans.py.