mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
major refactoring of modules
Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
@@ -5,14 +5,14 @@ def isinstance_str(x: object, cls_name: str):
|
||||
"""
|
||||
Checks whether x has any class *named* cls_name in its ancestry.
|
||||
Doesn't require access to the class's implementation.
|
||||
|
||||
|
||||
Useful for patching!
|
||||
"""
|
||||
|
||||
for _cls in x.__class__.__mro__:
|
||||
if _cls.__name__ == cls_name:
|
||||
return True
|
||||
|
||||
|
||||
return False
|
||||
|
||||
|
||||
@@ -29,4 +29,3 @@ def init_generator(device: torch.device, fallback: torch.Generator=None):
|
||||
return init_generator(torch.device("cpu"))
|
||||
else:
|
||||
return fallback
|
||||
|
||||
Reference in New Issue
Block a user