<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/training/checkpoint_utils.py#L46-L80) |

Returns `CheckpointReader` for checkpoint found in `ckpt_dir_or_file`.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.train.load_checkpoint(
        ckpt_dir_or_file
    )

### Used in the notebooks

| Used in the guide |
|---|
| - [Migrating model checkpoints](https://www.tensorflow.org/guide/migrate/migrating_checkpoints) - [Training checkpoints](https://www.tensorflow.org/guide/checkpoint) - [Migrate the fault tolerance mechanism](https://www.tensorflow.org/guide/migrate/fault_tolerance) |

If `ckpt_dir_or_file` resolves to a directory with multiple checkpoints,
reader for the latest checkpoint is returned.

#### Example usage:

    import tensorflow as tf
    a = tf.Variable(1.0)
    b = tf.Variable(2.0)
    ckpt = tf.train.Checkpoint(var_list={'a': a, 'b': b})
    ckpt_path = ckpt.save('tmp-ckpt')
    reader= tf.train.load_checkpoint(ckpt_path)
    print(reader.get_tensor('var_list/a/.ATTRIBUTES/VARIABLE_VALUE'))  # 1.0

<br />

<br />

<br />

| ## Args ||
|---|---|
| `ckpt_dir_or_file` | Directory with checkpoints file or path to checkpoint file. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| `CheckpointReader` object. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If `ckpt_dir_or_file` resolves to a directory with no checkpoints. |

<br />