提交 c465ea32 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!3031 fix context mode and device target dependency issue

Merge pull request !3031 from wangqiuliang/fix-tensor-bool-operation
......@@ -176,10 +176,7 @@ class _Context:
self._context_switches.push(True, None)
else:
if self.enable_debug_runtime:
if self.device_target == "CPU":
self.set_backend_policy("vm")
else:
self.set_backend_policy("ge")
self.set_backend_policy("ge")
self._context_switches.push(False, None)
def set_backend_policy(self, policy):
......@@ -221,6 +218,8 @@ class _Context:
success = self._context_handle.set_device_target(target)
if not success:
raise ValueError("Target device name is invalid!!!")
if self.enable_debug_runtime and self.device_target == "CPU":
self.set_backend_policy("vm")
@property
def device_id(self):
......
......@@ -29,8 +29,7 @@ from .....mindspore_test_framework.utils.bprop_util import bprop
def setup_module(module):
context.set_context(device_target="CPU")
context.set_context(mode=context.GRAPH_MODE)
context.set_context(mode=context.GRAPH_MODE, device_target="CPU")
def teardown_module(module):
context.set_context(device_target="Ascend")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册