tf.train.MonitoredSession.StepContext
Инструмент управления потоком для step_fn из run_step_fn().
tf.train.MonitoredSession.StepContext(
session, run_with_hooks_fn
)
Пользователи step_fn могут выполнять вызовы run() без запуска хуков, обращаясь к session. Вызов run() с хуками можно выполнить, используя run_with_hooks(). Поток вычислений можно прервать с помощью request_stop().
| Аргументы | |
|---|---|
session | Экземпляр tf.compat.v1.Session. |
run_with_hooks_fn | Функция для выполнения запросов и хуков. |
| Атрибуты | |
|---|---|
session | |
Методы
request_stop
request_stop()
Выход из цикла обучения, вызывая should_stop() для возврата True.
Вызывает выход step_fn путём повышения исключения.
| Исключения | |
|---|---|
| StopIteration |
run_with_hooks
run_with_hooks(
*args, **kwargs
)
То же самое, что и MonitoredSession.run. Принимает те же аргументы.
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/train/MonitoredSession/StepContext