未验证 提交 2d6f3a56 编写于 作者: D duanyanhui 提交者: GitHub

update npu api (#9688)

上级 6d44c678
......@@ -134,7 +134,16 @@ def check_device(use_gpu, use_xpu=False, use_npu=False, use_mlu=False):
if use_xpu and not paddle.device.is_compiled_with_xpu():
print(err.format("use_xpu", "xpu", "xpu", "use_xpu"))
sys.exit(1)
if use_npu and not paddle.device.is_compiled_with_npu():
if use_npu:
if int(paddle.version.major) != 0 and int(
paddle.version.major) <= 2 and int(
paddle.version.minor) <= 4:
if not paddle.device.is_compiled_with_npu():
print(err.format("use_npu", "npu", "npu", "use_npu"))
sys.exit(1)
# is_compiled_with_npu() has been updated after paddle-2.4
else:
if not paddle.device.is_compiled_with_custom_device("npu"):
print(err.format("use_npu", "npu", "npu", "use_npu"))
sys.exit(1)
if use_mlu and not paddle.device.is_compiled_with_mlu():
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册