File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -25,14 +25,12 @@ def _init_class_optimizers(self):
25
25
return class_optimizers
26
26
27
27
def _init_file_optimizers (self ):
28
- opt_path = os .path .dirname (inspect .getfile (self .__class__ )) + '/passes'
29
- module_path = self .__module__ [:self .__module__ .rfind ('.' )] + '.passes'
30
- file_optimizers = extract_optimizers_from_path (opt_path , module_path , self )
31
- for base in self .__class__ .__bases__ :
32
- opt_path = os .path .dirname (inspect .getfile (base )) + '/passes'
33
- module_path = base .__module__ [:base .__module__ .rfind ('.' )] + '.passes'
34
- base_optimizers = extract_optimizers_from_path (opt_path , module_path , self )
35
- file_optimizers .update (base_optimizers )
28
+ file_optimizers = {}
29
+ for cls in [* self .__class__ .__bases__ , self .__class__ ]:
30
+ opt_path = os .path .dirname (inspect .getfile (cls )) + '/passes'
31
+ module_path = cls .__module__ [:cls .__module__ .rfind ('.' )] + '.passes'
32
+ cls_optimizers = extract_optimizers_from_path (opt_path , module_path , self )
33
+ file_optimizers .update (cls_optimizers )
36
34
return file_optimizers
37
35
38
36
def _get_layer_initializers (self ):
You can’t perform that action at this time.
0 commit comments