# tf.estimator.SessionRunContext

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/training/session_run_hook.py#L210-L259) |

Provides information about the `session.run()` call being made. (deprecated)

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.estimator.SessionRunContext`](https://www.tensorflow.org/api_docs/python/tf/estimator/SessionRunContext), [`tf.compat.v1.train.SessionRunContext`](https://www.tensorflow.org/api_docs/python/tf/estimator/SessionRunContext)

<br />

    tf.estimator.SessionRunContext(
        original_args, session
    )

> [!WARNING]
> **Deprecated:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use tf.keras instead.

Provides information about original request to `Session.Run()` function.
SessionRunHook objects can stop the loop by calling `request_stop()` of
`run_context`. In the future we may use this object to add more information
about run without changing the Hook API.

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `original_args` | A `SessionRunArgs` object holding the original arguments of `run()`. <br /> If user called `MonitoredSession.run(fetches=a, feed_dict=b)`, then this field is equal to SessionRunArgs(a, b). |
| `session` | A TensorFlow session object which will execute the `run`. |
| `stop_requested` | Returns whether a stop is requested or not. <br /> If true, `MonitoredSession` stops iterations. Returns: A `bool` |

<br />

## Methods

### `request_stop`

[View source](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/training/session_run_hook.py#L253-L259)

    request_stop()

Sets stop requested field.

Hooks can use this function to request stop of iterations.
`MonitoredSession` checks whether this is called or not.