# tff.types.FederatedType

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

An implementation of [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type) representing federated types in TFF.

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

#### View aliases


**Main aliases**

[`tff.FederatedType`](https://www.tensorflow.org/federated/api_docs/python/tff/types/FederatedType)

<br />

    tff.types.FederatedType(
        member: object,
        placement: https://www.tensorflow.org/federated/api_docs/python/tff/framework/PlacementLiteral,
        all_equal: Optional[bool] = None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `member` | An instance of [`tff.Type`](https://www.tensorflow.org/federated/api_docs/python/tff/types/Type) or something convertible to it, that represents the type of the member components of each value of this federated type. |
| `placement` | The specification of placement that the member components of this federated type are hosted on. Must be either a placement literal such as [`tff.SERVER`](https://www.tensorflow.org/federated/api_docs/python/tff#SERVER) or [`tff.CLIENTS`](https://www.tensorflow.org/federated/api_docs/python/tff#CLIENTS) to refer to a globally defined placement, or a placement label to refer to a placement defined in other parts of a type signature. Specifying placement labels is not implemented yet. |
| `all_equal` | A `bool` value that indicates whether all members of the federated type are equal (`True`), or are allowed to differ (`False`). If `all_equal` is `None`, the value is selected as the default for the placement, e.g., `True` for [`tff.SERVER`](https://www.tensorflow.org/federated/api_docs/python/tff#SERVER) and `False` for [`tff.CLIENTS`](https://www.tensorflow.org/federated/api_docs/python/tff#CLIENTS). |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `all_equal` | <br /> <br /> |
| `member` | <br /> <br /> |
| `placement` | <br /> <br /> |

<br />

## Methods

### `check_assignable_from`

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

    check_assignable_from(
        source_type: 'Type'
    ) -> None

Raises if values of `source_type` cannot be cast to this type.

### `check_equivalent_to`

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

    check_equivalent_to(
        other: 'Type'
    ) -> None

Raises if values of 'other' cannot be cast to and from this type.

### `check_identical_to`

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

    check_identical_to(
        other: 'Type'
    ) -> None

Raises if `other` and `Type` are not exactly identical.

### `children`

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

    children() -> Iterator[Type]

Returns a generator yielding immediate child types.

### `compact_representation`

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

    compact_representation() -> str

Returns the compact string representation of this type.

### `formatted_representation`

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

    formatted_representation() -> str

Returns the formatted string representation of this type.

### `is_assignable_from`

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

    is_assignable_from(
        source_type: https://www.tensorflow.org/federated/api_docs/python/tff/types/Type
    ) -> bool

Returns whether values of `source_type` can be cast to this type.

### `is_equivalent_to`

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

    is_equivalent_to(
        other: 'Type'
    ) -> bool

Returns whether values of `other` can be cast to and from this type.

### `is_identical_to`

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

    is_identical_to(
        other: 'Type'
    ) -> bool

Returns whether or not `self` and `other` are exactly identical.

### `__eq__`

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

    __eq__(
        other
    )

Determines whether two type definitions are identical.

Note that this notion of equality is stronger than equivalence. Two types
with equivalent definitions may not be identical, e.g., if they represent
templates with differently named type variables in their definitions.

<br />

<br />

<br />

| Args ||
|---|---|
| `other` | The other type to compare against. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| `True` if type definitions are syntactically identical (as defined above), otherwise `False`. ||

<br />

<br />

<br />

<br />

| Raises ||
|---|---|
| `NotImplementedError` | If not implemented in the derived class. |

<br />

### `__ne__`

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

    __ne__(
        other
    )

Return self!=value.