tf.compat.v1.train.MonitoredSession.StepContext
Инструмент управления потоком выполнения для step_fn из run_step_fn().
tf.compat.v1.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()
Завершает цикл обучения, вызывая возврат True из should_stop().
Вызывает завершение step_fn, генерируя исключение.
| Вызывает исключение | |
|---|---|
| StopIteration |
run_with_hooks
run_with_hooks(
*args, **kwargs
)
То же, что и MonitoredSession.run. Принимает те же аргументы.
© 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/api_docs/python/tf/compat/v1/train/MonitoredSession/StepContext