diff --git a/imperative/python/megengine/device.py b/imperative/python/megengine/device.py index 63faa41b..8a31754a 100644 --- a/imperative/python/megengine/device.py +++ b/imperative/python/megengine/device.py @@ -44,7 +44,9 @@ def _str2device_type(type_str: str, allow_unspec: bool = True): elif type_str == "ROCM" or type_str == "AMDGPU": return DeviceType.ROCM else: - assert allow_unspec and str == "XPU", "device type can only be cpu, gpu or xpu" + assert ( + allow_unspec and type_str == "XPU" + ), "device type can only be cpu, gpu or xpu" return DeviceType.UNSPEC