File tree 1 file changed +2
-6
lines changed
1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -40,10 +40,8 @@ def __init__(
40
40
from timm .models ._features_fx import get_graph_node_names , GraphExtractNet
41
41
42
42
node_names = get_graph_node_names (model )[0 if mode == 'train' else 1 ]
43
- matched = []
44
43
names = names or self .default_node_names
45
- for n in names :
46
- matched .extend (fnmatch .filter (node_names , n ))
44
+ matched = [g for g in node_names if any ([fnmatch .fnmatch (g , n ) for n in names ])]
47
45
if not matched :
48
46
raise RuntimeError (f'No node names found matching { names } .' )
49
47
@@ -55,10 +53,8 @@ def __init__(
55
53
from timm .models ._features import FeatureHooks
56
54
57
55
module_names = [n for n , m in model .named_modules ()]
58
- matched = []
59
56
names = names or self .default_module_names
60
- for n in names :
61
- matched .extend (fnmatch .filter (module_names , n ))
57
+ matched = [m for m in module_names if any ([fnmatch .fnmatch (m , n ) for n in names ])]
62
58
if not matched :
63
59
raise RuntimeError (f'No module names found matching { names } .' )
64
60
You can’t perform that action at this time.
0 commit comments