MCPcopy Create free account
hub / github.com/NVlabs/SPADE / find_class_in_module

Function find_class_in_module

util/util.py:180–192  ·  view source on GitHub ↗
(target_cls_name, module)

Source from the content-addressed store, hash-verified

178
179
180def find_class_in_module(target_cls_name, module):
181 target_cls_name = target_cls_name.replace('_', '').lower()
182 clslib = importlib.import_module(module)
183 cls = None
184 for name, clsobj in clslib.__dict__.items():
185 if name.lower() == target_cls_name:
186 cls = clsobj
187
188 if cls is None:
189 print("In %s, there should be a class whose name matches %s in lowercase without underscore(_)" % (module, target_cls_name))
190 exit(0)
191
192 return cls
193
194
195def save_network(net, label, epoch, opt):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected