!3031 fix context mode and device target dependency issue
Merge pull request !3031 from wangqiuliang/fix-tensor-bool-operation
This commit is contained in:
commit
c465ea3269
|
@ -176,9 +176,6 @@ class _Context:
|
||||||
self._context_switches.push(True, None)
|
self._context_switches.push(True, None)
|
||||||
else:
|
else:
|
||||||
if self.enable_debug_runtime:
|
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)
|
self._context_switches.push(False, None)
|
||||||
|
|
||||||
|
@ -221,6 +218,8 @@ class _Context:
|
||||||
success = self._context_handle.set_device_target(target)
|
success = self._context_handle.set_device_target(target)
|
||||||
if not success:
|
if not success:
|
||||||
raise ValueError("Target device name is invalid!!!")
|
raise ValueError("Target device name is invalid!!!")
|
||||||
|
if self.enable_debug_runtime and self.device_target == "CPU":
|
||||||
|
self.set_backend_policy("vm")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device_id(self):
|
def device_id(self):
|
||||||
|
|
|
@ -29,8 +29,7 @@ from .....mindspore_test_framework.utils.bprop_util import bprop
|
||||||
|
|
||||||
|
|
||||||
def setup_module(module):
|
def setup_module(module):
|
||||||
context.set_context(device_target="CPU")
|
context.set_context(mode=context.GRAPH_MODE, device_target="CPU")
|
||||||
context.set_context(mode=context.GRAPH_MODE)
|
|
||||||
|
|
||||||
def teardown_module(module):
|
def teardown_module(module):
|
||||||
context.set_context(device_target="Ascend")
|
context.set_context(device_target="Ascend")
|
||||||
|
|
Loading…
Reference in New Issue