# tensorflow::ops::Restore Class Reference

# tensorflow::
ops::
Restore

`
#include <io_ops.h>
`


Restores a tensor from checkpoint files.

## Summary


Reads a tensor stored in one or several files. If there are several files (for instance because a tensor was saved as slices),
`
file_pattern
`
may contain wildcard symbols (
`
*
`
and
`
?
`
) in the filename portion only, not in the directory portion.


If a
`
file_pattern
`
matches several files,
`
preferred_shard
`
can be used to hint in which file the requested tensor is likely to be found. This op will first open the file at index
`
preferred_shard
`
in the list of matching files and try to restore tensors from that file. Only if some tensors or tensor slices are not found in that first file, then the Op opens all the files. Setting
`
preferred_shard
`
to match the value passed as the
`
shard
`
input of a matching
`
https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/save#classtensorflow_1_1ops_1_1_save
`
Op may speed up
[Restore](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/restore#classtensorflow_1_1ops_1_1_restore)
. This attribute only affects performance, not correctness. The default value -1 means files are processed in order.


See also
`
https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/restore-slice#classtensorflow_1_1ops_1_1_restore_slice
`
.


Args:

- scope: A [Scope](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object
- file_pattern: Must have a single element. The pattern of the files from which we read the tensor.
- tensor_name: Must have a single element. The name of the tensor to be restored.
- dt: The type of the tensor to be restored.

<br />


Optional attributes (see
`
https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/restore/attrs#structtensorflow_1_1ops_1_1_restore_1_1_attrs
`
):

- preferred_shard: Index of file to open first if multiple files match `
  file_pattern
  ` .

<br />


Returns:

- `
  https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output
  ` : The restored tensor.

<br />

| ### Constructors and Destructors ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/restore#classtensorflow_1_1ops_1_1_restore_1a06392cfeb62e5bbcd5a12c8c24f4a454 (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input file_pattern, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input tensor_name, DataType dt) ` ||
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/restore#classtensorflow_1_1ops_1_1_restore_1a6bc04bd5b6925c42d2ab9fac0d053774 (const :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input file_pattern, :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input tensor_name, DataType dt, const https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/restore/attrs#structtensorflow_1_1ops_1_1_restore_1_1_attrs & attrs) ` ||

| ### Public attributes ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/restore#classtensorflow_1_1ops_1_1_restore_1a512f0dcb5d23dea3939e1086b78490c9 ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/restore#classtensorflow_1_1ops_1_1_restore_1a7d6ad76f209f846683849ffcf4e5b2f9 ` | ` :: https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output ` |

| ### Public functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/restore#classtensorflow_1_1ops_1_1_restore_1a6b5a77883f915a4b7e800cbda2f6b18a () const ` | ` ::tensorflow::Node * ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/restore#classtensorflow_1_1ops_1_1_restore_1a20bb2f66a51a1413dda2b18f7880983f () const ` | ` ` |
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/restore#classtensorflow_1_1ops_1_1_restore_1ab93346099735ce634a6caa5d98b8785d () const ` | ` ` |

| ### Public static functions ||
|---|---|
| ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/restore#classtensorflow_1_1ops_1_1_restore_1afca86c5066310bcef8e07db991a9df2f (int64 x) ` | ` https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/restore/attrs#structtensorflow_1_1ops_1_1_restore_1_1_attrs ` |

| ### Structs ||
|---|---|
| [tensorflow:: ops:: Restore:: Attrs](https://www.tensorflow.org/versions/r2.5/api_docs/cc/struct/tensorflow/ops/restore/attrs) | Optional attribute setters for [Restore](https://www.tensorflow.org/versions/r2.5/api_docs/cc/class/tensorflow/ops/restore#classtensorflow_1_1ops_1_1_restore) . |

## Public attributes

### operation

```
Operation operation
```

### tensor

```
::tensorflow::Output tensor
```

## Public functions

### Restore

```
 Restore(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input file_pattern,
  ::tensorflow::Input tensor_name,
  DataType dt
)
```

### Restore

```
 Restore(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input file_pattern,
  ::tensorflow::Input tensor_name,
  DataType dt,
  const Restore::Attrs & attrs
)
```

### node

```
::tensorflow::Node * node() const 
```

### operator::tensorflow::Input

```
 operator::tensorflow::Input() const 
```

### operator::tensorflow::Output

```
 operator::tensorflow::Output() const 
```

## Public static functions

### PreferredShard

```
Attrs PreferredShard(
  int64 x
)
```