# tff.types.serialize_type

<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) |

Serializes 'type_spec' as a pb.Type.

    tff.types.serialize_type(
        type_spec: https://www.tensorflow.org/federated/api_docs/python/tff/types/Type
    ) -> pb.Type

> [!NOTE]
> **Note:** Currently only serialization for tensor, named tuple, sequence, and function types is implemented.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `type_spec` | A `computation_types.Type`. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The corresponding instance of `pb.Type`. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | if the argument is of the wrong type. |
| `NotImplementedError` | for type variants for which serialization is not implemented. |

<br />