Skip to content

Commit 2fcd381

Browse files
Override assertEqual only in test cases (#2513) (#2526)
* Override assert equal only in test cases * Support python -m pytest --------- Co-authored-by: Jinghui <jinghui.gu@intel.com>
1 parent 42d1a01 commit 2fcd381

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

intel_extension_for_pytorch/xpu/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,4 +496,7 @@ def get_device_type() -> str:
496496
if intel_extension_for_pytorch._C._has_xpu():
497497
if is_available() and not has_fp64_dtype():
498498
override_tensor_totype()
499-
override_assert_equal()
499+
500+
exec_path = sys.argv[0].split("/")
501+
if (len(exec_path) > 0 and "pytest" in exec_path):
502+
override_assert_equal()

0 commit comments

Comments
 (0)