File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed
tests/torch/experimental/fracbits Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 305305 "compression_rate" : with_attributes (NUMBER , description = "Target compression rate" ),
306306 "criteria" : with_attributes (STRING , description = "Criteria to measure the distance between the target "
307307 "compression rate and the currrent compression rate. Choose L1 or L2." ),
308- "flip_loss" : with_attributes (BOOLEAN , description = "If true, we compute the compression loss by "
309- "|1 / target_compression_rate - (current_model_size / target_model_size)|, rather than "
310- "|target_compression_rate - (target_model_size / current_model_size)|." ),
308+ "flip_loss" : with_attributes (
309+ BOOLEAN ,
310+ description = "If true, we compute the compression loss by "
311+ "|1 / target_compression_rate - (current_model_size / target_model_size)|, "
312+ "otherwise, we compute it by "
313+ "|target_compression_rate - (target_model_size / current_model_size)|." ),
311314 "alpha" : with_attributes (NUMBER , description = "Scale multiplier for the compression loss." ),
312315 },
313316 "additionalProperties" : False
Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ def set_manual_seed():
2424 torch .manual_seed (3003 )
2525
2626
27- @pytest .fixture (scope = "function" )
28- def linear_problem (num_bits : int = 4 , sigma : float = 0.2 ):
27+ @pytest .fixture (scope = "function" , name = "linear_problem" )
28+ def fxt_linear_problem (num_bits : int = 4 , sigma : float = 0.2 ):
2929 set_manual_seed ()
3030
3131 levels = 2 ** num_bits
@@ -48,11 +48,11 @@ def qspec(request):
4848 logarithm_scale = False )
4949
5050
51- @pytest .fixture
52- def config (model_size : int = 4 ):
53- config = get_empty_config (model_size )
51+ @pytest .fixture ( name = "config" )
52+ def fxt_config (model_size : int = 4 ):
53+ new_config = get_empty_config (model_size )
5454
55- config ["compression" ] = {
55+ new_config ["compression" ] = {
5656 "algorithm" : "fracbits_quantization" ,
5757 "initializer" : {
5858 "range" : {
@@ -68,12 +68,12 @@ def config(model_size: int = 4):
6868 "alpha" : 1.0
6969 }
7070 }
71- register_bn_adaptation_init_args (config )
72- return config
71+ register_bn_adaptation_init_args (new_config )
72+ return new_config
7373
7474
75- @pytest .fixture
76- def conv_model ():
75+ @pytest .fixture ( name = "conv_model" )
76+ def fxt_conv_model ():
7777 set_manual_seed ()
7878 return BasicConvTestModel ()
7979
Original file line number Diff line number Diff line change @@ -118,5 +118,5 @@ def test_statistics(config, conv_model):
118118 stats : NNCFStatistics = ctrl .statistics ()
119119 assert stats .quantization is not None
120120
121- dict_stats = { k : v for k , v in stats }
121+ dict_stats = dict ( stats )
122122 assert dict_stats [ctrl .name ] is not None
You can’t perform that action at this time.
0 commit comments