From: Akshay Modi Date: Wed, 28 Mar 2018 01:18:33 +0000 (-0700) Subject: Pass options to TFE_ContextOptionsSetAsync X-Git-Tag: tflite-v0.1.7~67^2^2~72 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9d0b5ba5cfdf0f1c35a228abac9c84c11bb7d695;p=platform%2Fupstream%2Ftensorflow.git Pass options to TFE_ContextOptionsSetAsync PiperOrigin-RevId: 190707017 --- diff --git a/tensorflow/python/eager/context.py b/tensorflow/python/eager/context.py index 6c9a147..8c1bb06 100644 --- a/tensorflow/python/eager/context.py +++ b/tensorflow/python/eager/context.py @@ -232,7 +232,7 @@ class Context(object): pywrap_tensorflow.TFE_ContextOptionsSetDevicePlacementPolicy( opts, self._device_policy) if self._execution_mode == ASYNC: - pywrap_tensorflow.TFE_ContextOptionsSetAsync(True) + pywrap_tensorflow.TFE_ContextOptionsSetAsync(opts, True) self._context_handle = pywrap_tensorflow.TFE_NewContext(opts, status) finally: pywrap_tensorflow.TFE_DeleteContextOptions(opts) diff --git a/tensorflow/python/eager/core_test.py b/tensorflow/python/eager/core_test.py index 6ebf5b2..5f19f64 100644 --- a/tensorflow/python/eager/core_test.py +++ b/tensorflow/python/eager/core_test.py @@ -97,6 +97,14 @@ class TFETest(test_util.TensorFlowTestCase): self.assertTrue(has_cpu_device) del ctx + def testAsyncBasic(self): + ctx = context.Context(execution_mode=context.ASYNC) + has_cpu_device = False + for x in ctx.devices(): + has_cpu_device = has_cpu_device or 'CPU' in x + self.assertTrue(has_cpu_device) + del ctx + def testRunMetadata(self): context.enable_run_metadata() t = constant_op.constant(1.0)