# tf.experimental.dtensor.name_based_save

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.14.0/tensorflow/dtensor/python/save_restore.py#L176-L222) |

Saves name based Tensor into a Checkpoint.

    tf.experimental.dtensor.name_based_save(
        mesh: https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/experimental/dtensor/Mesh,
        checkpoint_prefix: Union[str, https://www.tensorflow.org/versions/r2.14/api_docs/python/tf/Tensor],
        name_tensor_dict: Dict[str, Union[tensor_lib.Tensor, tf_variables.Variable]]
    )

The function prepares the input dictionary to the format of a `sharded_save`,
so that it can take advantage of DTensor SPMD based distributed save.

Same as restore, the function only supports saving on the single mesh.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `mesh` | The single mesh that all Tensors would be restored to. |
| `checkpoint_prefix` | The prefix of checkpoint to be restored. |
| `name_tensor_dict` | A ordered dictionary of tensor_names to a DTensor. The DTensor shape/dtype must match the tensors being saved/restored for now. |

<br />