tf.raw_ops.Restore
Stay organized with collections
Save and categorize content based on your preferences.
Restores a tensor from checkpoint files.
tf.raw_ops.Restore(
file_pattern, tensor_name, dt, preferred_shard=-1, name=None
)
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 Save
Op may speed up Restore. This attribute only affects
performance, not correctness. The default value -1 means files are processed in
order.
See also RestoreSlice
.
Args |
file_pattern
|
A Tensor of type string .
Must have a single element. The pattern of the files from
which we read the tensor.
|
tensor_name
|
A Tensor of type string .
Must have a single element. The name of the tensor to be
restored.
|
dt
|
A tf.DType . The type of the tensor to be restored.
|
preferred_shard
|
An optional int . Defaults to -1 .
Index of file to open first if multiple files match
file_pattern .
|
name
|
A name for the operation (optional).
|
Returns |
A Tensor of type dt .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tf.raw_ops.Restore\n\n\u003cbr /\u003e\n\nRestores a tensor from checkpoint files.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.raw_ops.Restore`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/Restore)\n\n\u003cbr /\u003e\n\n tf.raw_ops.Restore(\n file_pattern, tensor_name, dt, preferred_shard=-1, name=None\n )\n\nReads a tensor stored in one or several files. If there are several files (for\ninstance because a tensor was saved as slices), `file_pattern` may contain\nwildcard symbols (`*` and `?`) in the filename portion only, not in the\ndirectory portion.\n\nIf a `file_pattern` matches several files, `preferred_shard` can be used to hint\nin which file the requested tensor is likely to be found. This op will first\nopen the file at index `preferred_shard` in the list of matching files and try\nto restore tensors from that file. Only if some tensors or tensor slices are\nnot found in that first file, then the Op opens all the files. Setting\n`preferred_shard` to match the value passed as the `shard` input\nof a matching `Save` Op may speed up Restore. This attribute only affects\nperformance, not correctness. The default value -1 means files are processed in\norder.\n\nSee also `RestoreSlice`.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------------|------------------------------------------------------------------------------------------------------------------|\n| `file_pattern` | A `Tensor` of type `string`. Must have a single element. The pattern of the files from which we read the tensor. |\n| `tensor_name` | A `Tensor` of type `string`. Must have a single element. The name of the tensor to be restored. |\n| `dt` | A [`tf.DType`](../../tf/dtypes/DType). The type of the tensor to be restored. |\n| `preferred_shard` | An optional `int`. Defaults to `-1`. Index of file to open first if multiple files match `file_pattern`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor` of type `dt`. ||\n\n\u003cbr /\u003e"]]