# tf.compat.v1.estimator.tpu.RunConfig

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/estimator/tree/master/tensorflow_estimator/python/estimator/tpu/tpu_config.py#L237-L338) |

RunConfig with TPU support. (deprecated)

Inherits From: [`RunConfig`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/estimator/RunConfig)

    tf.compat.v1.estimator.tpu.RunConfig(
        tpu_config=None,
        evaluation_master=None,
        master=None,
        cluster=None,
        **kwargs
    )

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

<br />

<br />

<br />

| ## Args ||
|---|---|
| `tpu_config` | the TPUConfig that specifies TPU-specific configuration. |
| `evaluation_master` | a string. The address of the master to use for eval. Defaults to master if not set. |
| `master` | a string. The address of the master to use for training. |
| `cluster` | a ClusterResolver |
| `**kwargs` | keyword config parameters. |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | if cluster is not None and the provided session_config has a cluster_def already. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `checkpoint_save_graph_def` | <br /> <br /> |
| `cluster` | <br /> <br /> |
| `cluster_spec` | <br /> <br /> |
| `device_fn` | Returns the device_fn. <br /> If device_fn is not `None`, it overrides the default device function used in `Estimator`. Otherwise the default one is used. |
| `eval_distribute` | Optional [`tf.distribute.Strategy`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/distribute/Strategy) for evaluation. |
| `evaluation_master` | <br /> <br /> |
| `experimental_max_worker_delay_secs` | <br /> <br /> |
| `global_id_in_cluster` | The global id in the training cluster. <br /> All global ids in the training cluster are assigned from an increasing sequence of consecutive integers. The first id is 0. > [!NOTE] > **Note:** Task id (the property field `task_id`) is tracking the index of the node among all nodes with the SAME task type. For example, given the cluster definition as follows: cluster = {'chief': ['host0:2222'], 'ps': ['host1:2222', 'host2:2222'], 'worker': ['host3:2222', 'host4:2222', 'host5:2222']} Nodes with task type `worker` can have id 0, 1, 2. Nodes with task type `ps` can have id, 0, 1. So, `task_id` is not unique, but the pair (`task_type`, `task_id`) can uniquely determine a node in the cluster. Global id, i.e., this field, is tracking the index of the node among ALL nodes in the cluster. It is uniquely assigned. For example, for the cluster spec given above, the global ids are assigned as: task_type  | task_id  |  global_id --- chief      | 0        |  0 worker     | 0        |  1 worker     | 1        |  2 worker     | 2        |  3 ps         | 0        |  4 ps         | 1        |  5 <br /> |
| `is_chief` | <br /> <br /> |
| `keep_checkpoint_every_n_hours` | <br /> <br /> |
| `keep_checkpoint_max` | <br /> <br /> |
| `log_step_count_steps` | <br /> <br /> |
| `master` | <br /> <br /> |
| `model_dir` | <br /> <br /> |
| `num_ps_replicas` | <br /> <br /> |
| `num_worker_replicas` | <br /> <br /> |
| `protocol` | Returns the optional protocol value. |
| `save_checkpoints_secs` | <br /> <br /> |
| `save_checkpoints_steps` | <br /> <br /> |
| `save_summary_steps` | <br /> <br /> |
| `service` | Returns the platform defined (in TF_CONFIG) service dict. |
| `session_config` | <br /> <br /> |
| `session_creation_timeout_secs` | <br /> <br /> |
| `task_id` | <br /> <br /> |
| `task_type` | <br /> <br /> |
| `tf_random_seed` | <br /> <br /> |
| `tpu_config` | <br /> <br /> |
| `train_distribute` | Optional [`tf.distribute.Strategy`](https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/distribute/Strategy) for training. |

<br />

## Methods

### `replace`

[View source](https://github.com/tensorflow/estimator/tree/master/tensorflow_estimator/python/estimator/tpu/tpu_config.py#L331-L338)

    replace(
        **kwargs
    )

Returns a new instance of `RunConfig` replacing specified properties.

Only the properties in the following list are allowed to be replaced:

- `model_dir`,
- `tf_random_seed`,
- `save_summary_steps`,
- `save_checkpoints_steps`,
- `save_checkpoints_secs`,
- `session_config`,
- `keep_checkpoint_max`,
- `keep_checkpoint_every_n_hours`,
- `log_step_count_steps`,
- `train_distribute`,
- `device_fn`,
- `protocol`.
- `eval_distribute`,
- `experimental_distribute`,
- `experimental_max_worker_delay_secs`,

In addition, either `save_checkpoints_steps` or `save_checkpoints_secs`
can be set (should not be both).

<br />

<br />

<br />

| Args ||
|---|---|
| `**kwargs` | keyword named properties with new values. |

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ValueError` | If any property name in `kwargs` does not exist or is not allowed to be replaced, or both `save_checkpoints_steps` and `save_checkpoints_secs` are set. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| a new instance of `RunConfig`. ||

<br />