# tff.program.SavedModelFileReleaseManager

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |

A [`tff.program.ReleaseManager`](https://www.tensorflow.org/federated/api_docs/python/tff/program/ReleaseManager) that releases values to a file system.

Inherits From: [`ReleaseManager`](https://www.tensorflow.org/federated/api_docs/python/tff/program/ReleaseManager)

    tff.program.SavedModelFileReleaseManager(
        root_dir: Union[str, os.PathLike[str]], prefix: str = 'release_'
    )

A [`tff.program.SavedModelFileReleaseManager`](https://www.tensorflow.org/federated/api_docs/python/tff/program/SavedModelFileReleaseManager) is a utility for releasing values
from a federated program to a file system and is used to release values from
platform storage to customer storage in a federated program.

Values are released to the file system using the SavedModel (see
[`tf.saved_model`](https://www.tensorflow.org/api_docs/python/tf/saved_model)) format. When the value is released, each
[`tff.program.MaterializableValueReference`](https://www.tensorflow.org/federated/api_docs/python/tff/program/MaterializableValueReference) is materialized. The structure of
the value is discarded.

> [!NOTE]
> **Note:** The SavedModel format can only contain values that can be converted to a [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) (see [`tf.convert_to_tensor`](https://www.tensorflow.org/api_docs/python/tf/convert_to_tensor)), releasing any other values will result in an error.

See <https://www.tensorflow.org/guide/saved_model> for more information about
the SavedModel format.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `root_dir` | A path on the file system to save program state. If this path does not exist it will be created. |
| `prefix` | A string to use as the prefix for filenames. |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If `root_dir` is an empty string. |

<br />

## Methods

### `get_value`

[View source](https://github.com/tensorflow/federated/blob/v0.87.0
Version 2.0, January 2004
Licensed under the Apache License, Version 2.0 (the)

    get_value(
        key
    ) -> https://www.tensorflow.org/federated/api_docs/python/tff/program#ReleasableStructure

Returns the value for the given `key`.

<br />

<br />

<br />

| Args ||
|---|---|
| `key` | Used to reference the released `value`. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A retrieved value matching `structure`. ||

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `ReleasedValueNotFoundError` | If there is no released value for the given `key`. |

<br />

### `release`

[View source](https://github.com/tensorflow/federated/blob/v0.87.0
Version 2.0, January 2004
Licensed under the Apache License, Version 2.0 (the)

    release(
        value, key
    )

Releases `value` from a federated program.

<br />

<br />

<br />

| Args ||
|---|---|
| `value` | A [`tff.program.ReleasableStructure`](https://www.tensorflow.org/federated/api_docs/python/tff/program#ReleasableStructure) to release. |
| `key` | Used to reference (in the file system) the released `value`. |

<br />