def __new__(metacls, typename, bases, namespace):
annotations = namespace.get("__annotations__", {})
for t in annotations.values():
if type(t) == type(Union):
for ut in t.__args__:
_assert_tensorizer_type(ut)
else:
After Change
def __new__(metacls, typename, bases, namespace):
annotations = namespace.get("__annotations__", {})
for t in annotations.values():
if getattr(t, "__origin__", "") is Union:
for ut in t.__args__:
_assert_tensorizer_type(ut)
else: