tf.test.with_eager_op_as_function
Добавляет методы, которые вызывают исходные методы с включённым eager_op_as_function.
tf.test.with_eager_op_as_function(
cls=None, only_as_function=False
)
Пример:
@test_util.with_eager_op_as_function class SessionTest(test.TestCase):
def testEnabledForEagerOpAsFunction(self): ...
@disable_eager_op_as_function("b/xyzabc") def testDisabledForEagerOpAsFunction(self): ...
Сгенерированный класс:
class SessionTest(test.TestCase):
def testEnabledForEagerOpAsFunction(self): ...
def testEnabledForEagerOpAsFunctionWithEagerOpAsFunctionEnabled(self): // Включить run_eager_op_as_function // Сбросить контекст testEnabledForEagerOpAsFunction(self) // Отключить run_eager_op_as_function // Сбросить контекст
def testDisabledForEagerOpAsFunction(self): ...
| Аргументы | |
|---|---|
cls | класс для декорирования. |
only_as_function | нужно ли запускать все тесты в TestCase в режиме eager и в режиме eager_op_as_function. По умолчанию все тесты будут запускаться в обоих режимах. Когда only_as_function=True тесты не будут выполняться в режиме eager. |
| Возвращаемое значение | |
|---|---|
| cls с добавленными новыми методами тестов. |
© 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