<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/models/blob/v2.20.0/official/nlp/modeling/models/t5.py#L1379-L1593) |

Transformer Encoder+Decoder for sequence to sequence.

    tfm.nlp.models.T5Transformer(
        config: https://www.tensorflow.org/api_docs/python/tfm/nlp/models/T5TransformerParams,
        compute_dtype: tf.DType = tf.float32,
        **kwargs
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `dtype` | the variable allocation dtype. |
| `name` | a string for the module name. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `checkpoint_items` | <br /> <br /> |

<br />

## Methods

### `create_variable`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/nlp/modeling/models/t5.py#L52-L59)

    create_variable(
        name: Text,
        shape: ShapeLike,
        initializer: Initializer,
        dtype: tf.DType = tf.float32,
        **kwargs
    )

### `decode`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/nlp/modeling/models/t5.py#L1457-L1539)

    decode(
        encoded,
        decoder_target_tokens,
        encoder_input_tokens=None,
        encoder_dense_inputs=None,
        decoder_input_tokens=None,
        encoder_segment_ids=None,
        encoder_dense_segment_ids=None,
        decoder_segment_ids=None,
        decode_position=None,
        cache=None,
        max_decode_len=None,
        decode=False,
        training=False
    ) -> Dict[str, tf.Tensor]

### `encode`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/nlp/modeling/models/t5.py#L1417-L1455)

    encode(
        encoder_input_tokens=None,
        encoder_segment_ids=None,
        encoder_dense_inputs=None,
        encoder_dense_segment_ids=None,
        training=False
    )

### `read_variable`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/nlp/modeling/models/t5.py#L61-L66)

    read_variable(
        variable: tf.Variable, as_dtype: Optional[tf.DType] = None
    )

### `__call__`

[View source](https://github.com/tensorflow/models/blob/v2.20.0/official/nlp/modeling/models/t5.py#L1541-L1589)

    __call__(
        encoder_input_tokens=None,
        decoder_target_tokens=None,
        encoder_dense_inputs=None,
        encoder_dense_segment_ids=None,
        decoder_input_tokens=None,
        encoder_segment_ids=None,
        decoder_segment_ids=None,
        training=False
    )

Applies Transformer model on the inputs.

<br />

<br />

<br />

| Args ||
|---|---|
| `encoder_input_tokens` | input tokens to the encoder. |
| `decoder_target_tokens` | target tokens to the decoder. |
| `encoder_dense_inputs` | input dense vectors to the encoder. |
| `encoder_dense_segment_ids` | dense input segmentation info for packed |
| `decoder_input_tokens` | input tokens to the decoder, only required for training. |
| `encoder_segment_ids` | input segmentation info for packed examples. examples. |
| `decoder_segment_ids` | target segmentation info for packed examples. |
| `training` | whether it is training pass, affecting dropouts. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| a dictionary of logits/cache. ||

<br />