Skip to content

Commit 9c8cc41

Browse files
committed
raise value error with duplicate backend target
1 parent f4ea637 commit 9c8cc41

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

utensor_cgen/backend/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def register(cls, backend_cls):
1919
raise TypeError(
2020
'can only register subclass of %s: get %s' % (Backend, backend_cls)
2121
)
22+
if backend_cls.TARGET in cls.BACKENDS:
23+
raise ValueError('duplicate TARGET detected: %s' % backend_cls.TARGET)
2224
cls.BACKENDS[backend_cls.TARGET] = backend_cls
2325
return backend_cls
2426

0 commit comments

Comments
 (0)