tensorflow / 2.9.1 / test / with_eager_op_as_function.html /

tf.test.with_eager_op_as_function

Adds methods that call original methods with eager_op_as_function enabled.

Example:

@test_util.with_eager_op_as_function class SessionTest(test.TestCase):

def testEnabledForEagerOpAsFunction(self): ...

@disable_eager_op_as_function("b/xyzabc") def testDisabledForEagerOpAsFunction(self): ...

Generated class:

class SessionTest(test.TestCase):

def testEnabledForEagerOpAsFunction(self): ...

def testEnabledForEagerOpAsFunctionWithEagerOpAsFunctionEnabled(self): // Enable run_eager_op_as_function // Reset context testEnabledForEagerOpAsFunction(self) // Disable run_eager_op_as_function // Reset context

def testDisabledForEagerOpAsFunction(self): ...

Args
cls class to decorate.
only_as_function whether to run all the tests in the TestCase in eager mode and in eager_op_as_function mode. By default it will run all tests in both modes. When only_as_function=True tests will not be run in eager mode.
Returns
cls with new test methods added.

© 2022 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.9/api_docs/python/tf/test/with_eager_op_as_function