Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NPU] Fix op test: check use_npu before using it. #32231

Merged
merged 1 commit into from
Apr 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion python/paddle/fluid/tests/unittests/op_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,8 @@ def check_grad_with_place(self,
# FIXME: Replace numeric_place with place to calculate numeric_grads.
# NOTE(liym27): There is an unknown error when call op.run() on NPUPlace, which
# needs to be fixed.
if self.__class__.use_npu == True:
if hasattr(self.__class__,
"use_npu") and self.__class__.use_npu == True:
numeric_place = paddle.CPUPlace()
else:
numeric_place = place
Expand Down