<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/layers/self_attention_mask.py#L20-L45) |

Gets a 3D self-attention mask.

    tfm.nlp.layers.get_mask(
        inputs: tf.Tensor, to_mask: tf.Tensor, dtype: Optional[tf.DType] = None
    ) -> tf.Tensor

<br />

<br />

<br />

| ## Args ||
|---|---|
| `inputs` | from_tensor: 2D or 3D Tensor of shape \[batch_size, from_seq_length, ...\]. |
| `to_mask` | int32 Tensor of shape \[batch_size, to_seq_length\]. |
| `dtype` | the output Tensor dtype. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| float Tensor of shape \[batch_size, from_seq_length, to_seq_length\]. ||

<br />