# tensorflow::ops::RestoreV2

`#include <io_ops.h>`

Restores tensors from a V2 checkpoint.

## Summary

For backward compatibility with the V1 format, this Op currently allows restoring from a V1 checkpoint as well:

- This Op first attempts to find the V2 index file pointed to by "prefix", and if found proceed to read it as a V2 checkpoint;
- Otherwise the V1 read path is invoked. Relying on this behavior is not recommended, as the ability to fall back to read V1 might be deprecated and eventually removed.

<br />

By default, restores the named tensors in full. If the caller wishes to restore specific slices of stored tensors, "shape_and_slices" should be non-empty strings and correspondingly well-formed.

Callers must ensure all the named tensors are indeed stored in the checkpoint.

Arguments:

- scope: A [Scope](https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- prefix: Must have a single element. The prefix of a V2 checkpoint.
- tensor_names: shape {N}. The names of the tensors to be restored.
- shape_and_slices: shape {N}. The slice specs of the tensors to be restored. [Empty](https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/empty#classtensorflow_1_1ops_1_1_empty) strings indicate that they are non-partitioned tensors.
- dtypes: shape {N}. The list of expected dtype for the tensors. Must match those stored in the checkpoint.

<br />

Returns:

- `OutputList`: shape {N}. The restored tensors, whose shapes are read from the checkpoint directly.

<br />

| ### Constructors and Destructors ||
|---|---|
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/restore-v2#classtensorflow_1_1ops_1_1_restore_v2_1a57bca4a84e5b10e9920fdeeac3a05f5e(const ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input prefix, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input tensor_names, ::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input shape_and_slices, const DataTypeSlice & dtypes)` ||

| ### Public attributes ||
|---|---|
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/restore-v2#classtensorflow_1_1ops_1_1_restore_v2_1ac15e029a658d659cfed51e641fd25034` | `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation` |
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/restore-v2#classtensorflow_1_1ops_1_1_restore_v2_1acec293134264696f9ac7e0f1d900d542` | `::https://www.tensorflow.org/versions/r1.15/api_docs/cc/group/core#group__core_1gab449e6a3abd500c2f4ea93f9e89ba96c` |

| ### Public functions ||
|---|---|
| `https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/ops/restore-v2#classtensorflow_1_1ops_1_1_restore_v2_1a6bd9fcb0de236ef33532417834b3ed0d(size_t index) const ` | `::https://www.tensorflow.org/versions/r1.15/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output` |

## Public attributes

### operation

```
Operation operation
```

### tensors

```
::tensorflow::OutputList tensors
```

## Public functions

### RestoreV2

```
 RestoreV2(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input prefix,
  ::tensorflow::Input tensor_names,
  ::tensorflow::Input shape_and_slices,
  const DataTypeSlice & dtypes
)
```

### operator\[\]

```
::tensorflow::Output operator[](
  size_t index
) const 
```