[autoparallel] refactored shape consistency to remove redundancy (#1591)

* [autoparallel] refactored shape consistency to remove redundancy

* polish code

* polish code

* polish code
This commit is contained in:
Frank Lee
2022-09-13 18:30:18 +08:00
committed by GitHub
parent d164449d00
commit 27fe8af60c
13 changed files with 220 additions and 234 deletions

View File

@@ -15,4 +15,7 @@ class SingletonMeta(type):
if cls not in cls._instances:
instance = super().__call__(*args, **kwargs)
cls._instances[cls] = instance
else:
assert len(args) == 0 and len(
kwargs) == 0, f'{cls.__name__} is a singleton class and a instance has been created.'
return cls._instances[cls]