Fixed training for TF XLNet
Author: tlkh
Pull request: yes

This PR makes the following changes and fully fixes `model.fit()` training for XLNet. It now works, and was tested with a slightly modified `run_tf_glue.py`, and also tested with XLA, AMP and tf.distribute

- Fix dtype error with `input_mask` and `attention_mask`
- `rel_attn_core()` does not work properly in non-eager mode, resulting in shape errors. `tf.shape` is now used to obtain the shape of `ac` instead of calling `ac.shape`, and training now works in non-eager mode.

@thomwolf 

Comments:
# [Codecov](https://codecov.io/gh/huggingface/transformers/pull/1763?src=pr&el=h1) Report
> Merging [#1763](https://codecov.io/gh/huggingface/transformers/pull/1763?src=pr&el=desc) into [master](https://codecov.io/gh/huggingface/transformers/commit/d49c43ff789d309e688fb7b252511e9e618e46db?src=pr&el=desc) will **decrease** coverage by `0.08%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/huggingface/transformers/pull/1763/graphs/tree.svg?width=650&token=9qOlN6Hb1c&height=150&src=pr)](https://codecov.io/gh/huggingface/transformers/pull/1763?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master    #1763      +/-   ##
==========================================
- Coverage   84.11%   84.03%   -0.09%     
==========================================
  Files         105       94      -11     
  Lines       15545    14032    -1513     
==========================================
- Hits        13076    11792    -1284     
+ Misses       2469     2240     -229
```


| [Impacted Files](https://codecov.io/gh/huggingface/transformers/pull/1763?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [transformers/modeling\_tf\_xlnet.py](https://codecov.io/gh/huggingface/transformers/pull/1763/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL21vZGVsaW5nX3RmX3hsbmV0LnB5) | `87.82% <100%> (-0.37%)` | :arrow_down: |
| [transformers/modeling\_tf\_pytorch\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/1763/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL21vZGVsaW5nX3RmX3B5dG9yY2hfdXRpbHMucHk=) | `92.95% <0%> (-2.19%)` | :arrow_down: |
| [transformers/modeling\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/1763/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL21vZGVsaW5nX3V0aWxzLnB5) | `89.64% <0%> (-1.22%)` | :arrow_down: |
| [transformers/tokenization\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/1763/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL3Rva2VuaXphdGlvbl91dGlscy5weQ==) | `91.2% <0%> (-0.71%)` | :arrow_down: |
| [transformers/configuration\_auto.py](https://codecov.io/gh/huggingface/transformers/pull/1763/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL2NvbmZpZ3VyYXRpb25fYXV0by5weQ==) | `58.82% <0%> (-0.64%)` | :arrow_down: |
| [transformers/modeling\_tf\_roberta.py](https://codecov.io/gh/huggingface/transformers/pull/1763/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL21vZGVsaW5nX3RmX3JvYmVydGEucHk=) | `89.9% <0%> (-0.53%)` | :arrow_down: |
| [transformers/modeling\_tf\_transfo\_xl.py](https://codecov.io/gh/huggingface/transformers/pull/1763/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL21vZGVsaW5nX3RmX3RyYW5zZm9feGwucHk=) | `92.21% <0%> (-0.33%)` | :arrow_down: |
| [transformers/modeling\_tf\_utils.py](https://codecov.io/gh/huggingface/transformers/pull/1763/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL21vZGVsaW5nX3RmX3V0aWxzLnB5) | `92.4% <0%> (-0.33%)` | :arrow_down: |
| [transformers/tests/modeling\_tf\_common\_test.py](https://codecov.io/gh/huggingface/transformers/pull/1763/diff?src=pr&el=tree#diff-dHJhbnNmb3JtZXJzL3Rlc3RzL21vZGVsaW5nX3RmX2NvbW1vbl90ZXN0LnB5) | `96.8% <0%> (-0.28%)` | :arrow_down: |
| ... and [37 more](https://codecov.io/gh/huggingface/transformers/pull/1763/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/huggingface/transformers/pull/1763?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/huggingface/transformers/pull/1763?src=pr&el=footer). Last update [d49c43f...41e0859](https://codecov.io/gh/huggingface/transformers/pull/1763?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


This looks good to me, thank you @tlkh !

I see that the changes were already incorporated, so closing this PR.